Skip to main content
POST
Preview a CFDI 4.0 invoice as an unstamped PDF
Generates a PDF preview of a CFDI 4.0 invoice without stamping it at the SAT and without persisting anything. Use this to let a user review an invoice’s data before confirming the real emission — stamping has a cost (every timbre is billed by the PAC) and can’t be easily undone (it requires a formal cancellation). Accepts the exact same request body as Create Invoice — same 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.
This endpoint never calls the PAC, never writes an invoice record, and never consumes your plan’s CFDI quota. It also ignores idempotencyKey if sent — previews have nothing to deduplicate, since nothing is persisted.
The resulting PDF is visibly marked as a preview so it can never be mistaken for a real representación impresa:
  • A red banner reading “VISTA PREVIA — NO VÁLIDO FISCALMENTE”
  • No folio fiscal (UUID)
  • No digital seals (sellos)
  • No SAT verification QR code
None of those exist until the CFDI is actually stamped, so the preview simply omits them.

Authentication

Accepts either:
  • A Supabase Bearer session (Authorization: Bearer <token>) — the authenticated user must be a member of organizationId.
  • An API key (X-API-Key: sk_...) with the write:invoices scope — the key’s own organization must match organizationId in the URL, or the request is rejected with 403 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

cURL
TypeScript SDK

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/neither customer 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 of organizationId, 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

X-API-Key
string
header
required

API Key for authentication (format: sk_...)

Path Parameters

organizationId
string
required

Body

application/json
series
string
required
Example:

"A"

folioNumber
string
required
Example:

"1"

date
string
required
Example:

"2026-07-30T22:50:00"

use
string
required

SAT uso CFDI catalog code

Example:

"G03"

items
object[]
required
type
enum<string>

Ingreso, Egreso, or Traslado (default: I)

Available options:
I,
E,
T
Example:

"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.

Example:

"d3bfbc57-44af-4390-a064-f0afab85e5df"

paymentForm
string

SAT forma de pago catalog code — required unless type is T (Traslado)

Example:

"01"

paymentMethod
enum<string>

Default: PUE

Available options:
PUE,
PPD
Example:

"PUE"

currency
string

Default: MXN

Example:

"MXN"

exchange
number

Default: 1

Example:

1

export
string

SAT clave de exportación catalog code — default: 01

Example:

"01"

customer
object
customerId
string

Existing customer ID — mutually exclusive with customer

idempotencyKey
string

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.

Example:

"order-8421-attempt-1"

Response

PDF de vista previa del CFDI

The response is of type file.