Skip to content

FISCALISTO / API / REFERENCE

Stamp a withholding certificate · Withholdings

Open in ChatGPTOpen in ClaudeOpen in Cursor
POST
/v1/retentions

Stamps a withholding and payment information certificate (Retenciones 2.0) with the issuer's RET1, RET2… folios. Once per Idempotency-Key; with send_email and email it's sent to the recipient when stamped.

Before you call

  • An issuer that already stamps. In production, with its digital seal (CSD) current: POST /v1/issuers/{id}/certificates. In test mode it stamps with SAT's test CSD.

  • The Idempotency-Key header, a new one for each call (for example, the order's id in your system). If the response is lost, repeat the call with the same one and it isn't done twice: Idempotency.

Authorization

bearerAuth
headerAuthorizationBearer <key>

Your secret key: fk_test_… in test mode, fk_live_… in production. Desarrolladores › Llaves.

Headers

Idempotency-Key*string

A new one per CFDI (8 to 255 characters; your order id works). If the response is lost, repeat the request with the same value: it answers the same and never stamps twice.

Length8 <= length <= 255

Request body

application/json
  1. body
issuer?string

Issuer (iss_…). If the key has a single issuer or the account has only one, it can be left out.

code*string

Withholding key (CveRetenc), c_CveRetenc: 01 professional services, 05 leasing, 14 dividends, 16 interest, 18 payments abroad… Keys 06 and 14 to 24 carry their complement, as SAT's catalog asks (share_sale with 06 and 19, dividends with 14, distributable_remainder with 15, interest, trust_lease, foreign_payment, prize, trust, retirement_plan, mortgage_interest, financial_derivatives); 01, 02, 04 and 05 carry foreign_payment when the recipient is foreign; 26 (technology platforms) carries platform, and its totals and taxes are calculated from the operations. 27 and 28 can't be issued here.

description?|

Description of the withholding (DescRetenc); required with key 25 (another type).

recipient*

Recipient of the certificate (Receptor): domestic with RFC and postal code, or foreign.

period*

Period (Periodo): start month, end month and year.

totals?

Totals (Totales).

taxes?array<>

The CFDI's taxes, by type.

Itemsitems <= 50
Default[]
platform?

Technology platform services complement (ServiciosPlataformasTecnologicas 1.0), required with code 26: one certificate per month, recipient and service type. totals and taxes are calculated from services with SAT's rates (ISR from LISR 113-A and LIF 2026 art. 25; VAT 50% or 100%; IEPS on betting); if you send them, they must match.

dividends?

Dividends complement.

interest?

Interest complement.

foreign_payment?

Payments to foreigners complement: required with code 18, and with 01, 02, 04 and 05 when the recipient is foreign.

distributable_remainder?

Dividends complement with its Remanente node (distributable remainder), required with code 15. If you don't send it, it goes without a share.

trust_lease?

Lease in trust complement (Arrendamientoenfideicomiso 1.0), required with code 17.

share_sale?

Sale of shares or securities transactions complement (EnajenaciondeAcciones 1.0), required with code 06 and 19.

prize?

Prizes complement (Premios 1.0), required with code 20. Its amounts are those of totals.

trust?

Complement for trusts that don't carry out business activities (Fideicomisonoempresarial 1.0), required with code 21.

retirement_plan?

Personal retirement plans complement (Planesderetiro 1.1), required with code 22: the previous year's figures.

mortgage_interest?

Deductible real interest on mortgage loans complement (Intereseshipotecarios 1.0), required with code 23.

financial_derivatives?

Equity derivative financial operations complement (Operacionesconderivados 1.0), required with code 24.

replaces?string

Folio fiscal (UUID) of the certificate this one corrects: current, from the same issuer and to the same recipient (issued here or in another system). It goes in CfdiRetenRelacionados (04) and, once this one is stamped, the previous one is canceled with reason 01; replaced says whether it was canceled.

Pattern^[0-9A-Fa-f]{8}(-[0-9A-Fa-f]{4}){3}-[0-9A-Fa-f]{12}$
send_email?boolean

true to send the PDF and the XML by email when stamping, with Fiscalisto's design. Not sent by default.

email?string

Email to send it to (several separated by commas). Only used if sending is requested.

Lengthlength <= 1000
metadata?

Your own data: up to 50 keys of 40 characters with text values of up to 500. They don't go into the CFDI; they come back in the object and in webhooks.

Response body

OK. Repeating the request with the same Idempotency-Key answers the same, with the same status and the idempotent-replayed: true header.

application/json
  1. response

A certificate of withholdings and payment information (withholdings CFDI 2.0).

id*string

Object identifier, with its prefix (iss_, inv_, ret_, cus_, prd_, emp_, bat_, brn_, whs_, stm_, adj_, evt_, whe_).

livemode*boolean

true in production (fk_live_ keys), false in test mode (fk_test_). Test objects aren't valid before the SAT.

object*string

What kind of object it is («invoice», «customer»…).

issuer*string

The issuer (iss_…).

status*string

processing: the PAC hasn't answered. valid: stamped. rejected: the SAT or the PAC didn't accept it (see error). canceled: canceled.

One of"processing""valid""rejected""canceled"
uuid*|

Tax folio the SAT assigns (UUID of the Timbre Fiscal Digital), in uppercase.

folio*|

The certificate's number in the issuer's series (internal_folio is the printed one, RET1…).

internal_folio*|

Internal folio (FolioInt): RET1, RET2…

date*|

Issue date (Fecha), Mexico City time.

code*string

Withholding key (CveRetenc), c_CveRetenc: 01 professional services, 05 leasing, 14 dividends, 16 interest, 18 payments abroad… Keys 06 and 14 to 24 carry their complement, as SAT's catalog asks (share_sale with 06 and 19, dividends with 14, distributable_remainder with 15, interest, trust_lease, foreign_payment, prize, trust, retirement_plan, mortgage_interest, financial_derivatives); 01, 02, 04 and 05 carry foreign_payment when the recipient is foreign; 26 (technology platforms) carries platform, and its totals and taxes are calculated from the operations. 27 and 28 can't be issued here.

description*|

Withholding description (DescRetenc).

recipient*

Recipient of the certificate (Receptor): domestic with RFC and postal code, or foreign.

period*

Period (Periodo): start month, end month and year.

totals*

Totals (Totales).

taxes*array<>

The CFDI's taxes, by type.

dividends?

Dividends complement.

interest?

Interest complement.

foreign_payment?

Payments to foreigners complement: required with code 18, and with 01, 02, 04 and 05 when the recipient is foreign.

distributable_remainder?

Dividends complement with its Remanente node (distributable remainder), required with code 15. If you don't send it, it goes without a share.

trust_lease?

Lease in trust complement (Arrendamientoenfideicomiso 1.0), required with code 17.

share_sale?

Sale of shares or securities transactions complement (EnajenaciondeAcciones 1.0), required with code 06 and 19.

prize?

Prizes complement (Premios 1.0), required with code 20. Its amounts are those of totals.

trust?

Complement for trusts that don't carry out business activities (Fideicomisonoempresarial 1.0), required with code 21.

retirement_plan?

Personal retirement plans complement (Planesderetiro 1.1), required with code 22: the previous year's figures.

mortgage_interest?

Deductible real interest on mortgage loans complement (Intereseshipotecarios 1.0), required with code 23.

financial_derivatives?

Equity derivative financial operations complement (Operacionesconderivados 1.0), required with code 24.

platform?

Technology platform services complement (ServiciosPlataformasTecnologicas 1.0), required with code 26: one certificate per month, recipient and service type. totals and taxes are calculated from services with SAT's rates (ISR from LISR 113-A and LIF 2026 art. 25; VAT 50% or 100%; IEPS on betting); if you send them, they must match.

cancellation*|

The cancellation, if requested: status, reason, replacement and when.

email*|

The email send: to whom, cc to whom and when (null if it hasn't been sent).

error*|

Why the SAT or the PAC didn't accept it: message, SAT code and original text.

created_at*|

When it was created, ISO 8601 with Mexico City time (-06:00).

metadata*

Your own data: up to 50 keys of 40 characters with text values of up to 500. They don't go into the CFDI; they come back in the object and in webhooks.

warnings?array<string>

Warnings that didn't prevent stamping (for example, the XML will be saved later).

email_error?string

Why the email couldn't be sent; the receipt was stamped.

replaced?

Only when stamping with replaces: the certificate it corrects and whether it was canceled (reason 01). If not, error says why and it is canceled with POST /v1/sat_retentions/{id}/cancel.

Errors

  • Stamping requires the Idempotency-Key header (8 to 255 characters, a new one per document), so a retry never stamps twice.

  • The issuer is archived and no longer stamps. Its documents can still be read and canceled.

  • The account has several issuers and the request doesn't say which: send issuer (iss_…).

  • The object belongs to the other mode: an fk_test_ key only sees test data and an fk_live_ key only live data.

  • The account has no live stamps left: to stamp, check RFCs against SAT's lists, look up constancias, request SAT downloads or fetch declarations, the compliance opinion or the mailbox from SAT. Buy a pack in Desarrolladores › Timbres y pagos, or turn on auto-recharge. Never happens in test mode.

  • Live, this part of the API (inventario, portal de proveedores, pedidos, comprobación de gastos) follows the empresa's plan, as in the app: it comes with Operaciones (added to any paid plan; included in Corporativo). The books (the /v1/accounting routes except DIOT, cross checks, IVA refunds and fixed assets) come with Contabilidad (added to Independiente, Emprendedor or Negocio; included in Despacho and Corporativo): without it, changing the books answers this error, and reading them works only up to the last month it had it. Add either in Ajustes › Plan y pagos; test mode has everything.

  • That issuer is an empresa of the app connected to your account: through the API it only offers its Portal de proveedores (/v1/portal_suppliers and /v1/supplier_invoices) and, once someone who may pay suppliers and change Configurar pagos turned them on, its supplier payouts (/v1/payouts and /v1/payroll_payouts). It also stops when whoever connected it (or turned its payouts on) no longer has that permission in the empresa: message_es says which. Do everything else in the app.

  • This key can't use that issuer.

  • There is no such issuer in the account (or it belongs to the other mode).

  • There's no object with that id (or it belongs to another issuer or the other mode).

  • Another request with the same Idempotency-Key is still running. Repeat it in a moment with the same key: it will answer the same.

  • The retentions certificate breaks a SAT rule. No stamp was used.

  • The PAC or the SAT didn't accept the certificate; sat_code has their code.

  • You reached today's limit of something not paid with stamps. Retry-After says how many seconds until midnight in Mexico City.

  • Too many stamps in a row for the same issuer. Wait what Retry-After says; for many invoices use POST /v1/invoice_batches, for a payroll run POST /v1/payroll_batches.

Plus those of any call (key, fields, limits): Errors. They all carry code, message and, when it's about a field, param.

curl -X POST 'https://api.fiscalisto.com/v1/retentions' \  -H 'Authorization: Bearer fk_test_…' \  -H 'Idempotency-Key: retencion-2026-09-proveedor-42' \  -H 'Content-Type: application/json' \  -d '{  "code": "01",  "recipient": {    "tax_id": "MASO451221PM4",    "legal_name": "MARIA OLIVIA MARTINEZ SAGAZ",    "zip": "80290"  },  "period": {    "year": 2026,    "month": 9  },  "totals": {    "operation": 10000  },  "taxes": [    {      "tax": "isr",      "base": 10000,      "amount": 1000    },    {      "tax": "iva",      "base": 10000,      "amount": 1066.67    }  ],  "metadata": {    "proveedor": "42"  }}'
{  "id": "ret_OufpKqnrvx9p5tENFcmUXpXJ58XxnF67kv",  "object": "retention",  "livemode": false,  "issuer": "iss_OufpKqnrvx9p",  "status": "valid",  "uuid": "9A6F6BF3-6786-4747-800A-C9964E6509AE",  "folio": 1,  "internal_folio": "RET1",  "date": "2026-10-24T10:15:42",  "code": "01",  "description": null,  "recipient": {    "foreign": false,    "tax_id": "MASO451221PM4",    "legal_name": "MARIA OLIVIA MARTINEZ SAGAZ",    "zip": "80290",    "curp": null  },  "period": {    "year": 2026,    "from_month": 9,    "to_month": 9  },  "totals": {    "operation": 10000,    "taxed": 10000,    "exempt": 0,    "withheld": 2066.67  },  "taxes": [    {      "tax": "isr",      "base": 10000,      "amount": 1000,      "payment_type": "04"    },    {      "tax": "iva",      "base": 10000,      "amount": 1066.67,      "payment_type": "01"    }  ],  "cancellation": null,  "email": null,  "error": null,  "created_at": "2026-10-24T10:15:42-06:00",  "metadata": {    "proveedor": "42"  }}

Was this page helpful?