Preview Invoice PDF
Accepts the exact same request body as POST /organizations/{organizationId}/invoices, runs the exact same catalog/CFDI 4.0 validations, but never timbra (no PAC call) and never persists anything — no invoice, no cuota consumida, no idempotencyKey handling. Returns a PDF clearly marked as ‘VISTA PREVIA — NO VÁLIDO FISCALMENTE’ so it can never be confused with a real representación impresa.
CreateInvoiceDto shape, same type, customer/customerId, items[], etc. — and runs the exact same SAT catalog / CFDI 4.0 validations, so a payload that would fail to stamp also fails to preview with the same 400.
idempotencyKey if sent —
previews have nothing to deduplicate, since nothing is persisted.- A red banner reading “VISTA PREVIA — NO VÁLIDO FISCALMENTE”
- No folio fiscal (UUID)
- No digital seals (sellos)
- No SAT verification QR code
Authentication
Accepts either:- A Supabase Bearer session (
Authorization: Bearer <token>) — the authenticated user must be a member oforganizationId. - An API key (
X-API-Key: sk_...) with thewrite:invoicesscope — the key’s own organization must matchorganizationIdin the URL, or the request is rejected with403 Forbidden.
Path Parameters
Request Body
Same shape as Create Invoice — see that page for the full field reference (customer/customerId, items[], taxes[], etc.). idempotencyKey is accepted for shape compatibility but ignored.
Example Request
Example Response
This endpoint does not return a JSON body — it returns the generated PDF file directly in the response body with:Common Errors
400 Bad Request
Invalid or incomplete invoice payload — identical validation rules to Create Invoice: an issuing organization without complete fiscal data, sending both/neithercustomer and customerId, sending both/neither productId and the inline concept fields on an item, or a customer whose RFC/régimen/uso CFDI combination fails SAT catalog validation.
401 Unauthorized
Missing or invalid Bearer token / API key.403 Forbidden
The authenticated user is not a member oforganizationId, the API key does not have the write:invoices scope, or the API key belongs to a different organization than the one in the URL.
404 Not Found
customerId does not exist, or (for type: "E") relatedInvoiceUuid does not match any invoice — in either case, belonging to a different organization than organizationId counts as not found.Authorizations
API Key for authentication (format: sk_...)
Path Parameters
Body
"A"
"1"
"2026-07-30T22:50:00"
SAT uso CFDI catalog code
"G03"
Ingreso, Egreso, or Traslado (default: I)
I, E, T "I"
Required when type is E (Egreso/nota de crédito) — UUID fiscal of the original Ingreso CFDI it credits. Must belong to this organization and be a vigente Ingreso.
"d3bfbc57-44af-4390-a064-f0afab85e5df"
SAT forma de pago catalog code — required unless type is T (Traslado)
"01"
Default: PUE
PUE, PPD "PUE"
Default: MXN
"MXN"
Default: 1
1
SAT clave de exportación catalog code — default: 01
"01"
Existing customer ID — mutually exclusive with customer
Client-supplied key to safely retry this request without double-stamping. If an invoice was already created for this organization with the same key, that invoice is returned instead of stamping again.
"order-8421-attempt-1"
Response
PDF de vista previa del CFDI
The response is of type file.