API Timbre (Facturas)
Create Invoice (Full)
Create an invoice from a receipt image in a single call, with automatic member creation
POST
Overview
Create an invoice from a receipt image in a single call. Provide complete tax info to use an existing member by RFC or automatically create a new member profile. Supports JSON (with base64 image) ormultipart/form-data (with file upload).
This operation requires 1 credit. Credits are consumed from the API key owner, not the member profile.
Authentication
Requires a valid API key with:- API key owner belongs to an organization
api_keys_enabledfeature flag enabled for the organization
Request Body
Tax information object
Receipt image as a base64 data URL (e.g.,
data:image/jpeg;base64,/9j/4AAQ...). When using multipart/form-data, send as a file upload instead.Contact email address
Phone number (e.g.,
+525512345678, 4431041040)Short description of the expense (max 50 characters)
Behavior
- Validates the API key, organization, feature flag, and input fields
- Looks up the RFC in the caller’s organization:
- Found — uses the existing profile
- Not found — creates a new member profile with the provided tax data, then submits the invoice
- Resolves the tax regime for the invoice:
- If
fiscal_regimenis in the request, uses it (validated against member’s regimes) - If the member has a single regime, uses it automatically
- If the member has multiple regimes and the provided value is not valid, returns
400
- If
- Checks credits on the API key owner
- Submits the invoice to the invoicing provider
- Returns the invoice, member, and whether a new profile was created
Response
Whether the request was successful
Response data object
Error Codes
| Status | Code | Description |
|---|---|---|
| 400 | MISSING_REQUIRED_FIELDS | Missing tax_id, cfdi_use, fiscal_regimen, taxpayer, postal_code, or receipt_image |
| 400 | INVALID_RFC_FORMAT | RFC doesn’t match Mexican format (12-13 chars) |
| 400 | INVALID_TAX_REGIME | Invalid fiscal regime code |
| 400 | INVALID_CFDI_FOR_REGIME | CFDI usage code not valid for the resolved regime |
| 400 | INVALID_REGIME | Specified regime not in the member’s registered regimes |
| 400 | INVALID_EMAIL | Email format is invalid |
| 400 | INVALID_PHONE_NUMBER | Phone number format is invalid |
| 401 | — | Missing API key |
| 401 | INVALID_API_KEY | API key not found |
| 403 | NO_ORGANIZATION | API key owner has no organization |
| 403 | FEATURE_DISABLED | api_keys_enabled not active for the organization |
| 403 | INSUFFICIENT_CREDITS | No credits remaining |
| 404 | RFC_NOT_FOUND | RFC not found in organization |
| 500 | LOOKUP_ERROR | Error looking up RFC |
| 500 | AUTH_USER_CREATION_FAILED | Failed to create auth user for new profile |
| 500 | PROFILE_CREATION_FAILED | Failed to create profile record |
| 500 | TAX_INFO_CREATION_FAILED | Failed to create tax info record |
| 500 | INTERNAL_ERROR | Unexpected server error |
| 503 | SERVICE_UNAVAILABLE | Invoicing provider is temporarily unavailable |