Bulk XML download
Bulk download (the SAT service that delivers the CFDIs a taxpayer issued and received) automatically retrieves three types of documents from the SAT (Mexico's tax authority, Servicio de Administración Tributaria): CFDIs (Mexico's electronic invoices), which are the complete invoices in XML; metadata, a summary of each CFDI; and withholding CFDIs (CFDI de Retenciones e Información de Pagos, the CFDIs that report taxes withheld from a payment). Use them to generate your electronic accounting (contabilidad electrónica, the accounting records Mexican taxpayers send to the SAT in XML) and journal entries; reconcile accounts payable, accounts receivable, and bank transactions; prepare audits; automate your supply chain and supplier payments; and verify the CFDIs you receive.
Legal framework
Bulk download is based on Articles 29 and 29-A of the CFF (Código Fiscal de la Federación, Mexico's Federal Tax Code), which set the obligation to issue CFDIs and their requirements. It's also based on Rule 2.7.6.4 of the Resolución Miscelánea Fiscal (RMF, the SAT's annual tax rules), which regulates the bulk download service for CFDIs and withholding CFDIs.
Requirements
Bulk download requires the taxpayer's current e.firma (the SAT advanced electronic signature that identifies a taxpayer, formerly FIEL). The e.firma and the CSD (Certificado de Sello Digital, the digital seal certificate used to sign CFDIs) each consist of a .cer file, a .key file, and a password, but they serve different purposes. The CSD only seals invoices, and the e.firma is a general-purpose electronic signature used for everything else, including bulk download.
The person (any individual or legal entity registered in your tenant) on the download rule must have a valid RFC (Mexico's taxpayer ID, Registro Federal de Contribuyentes) and a current e.firma uploaded to its profile. See tax files (the CSD and e.firma .cer and .key files you upload for a person) to upload its credentials.
Download types
Fiscalapi downloads three types of documents from the SAT. You choose the type with the satQueryTypeId field when you create a download rule.
| Type | API value | Description |
|---|---|---|
| CFDI | "CFDI" | Complete invoices in XML. Includes only active CFDIs. |
| Metadata | "Metadata" | A summary of each CFDI: UUID (folio fiscal, the unique ID the PAC assigns when it stamps a CFDI), issuer, recipient, amounts, and status. Includes active and canceled CFDIs. |
| Withholding CFDIs | "Retenciones" | CFDIs that report withholdings and payment information. Includes only active CFDIs. |
To download canceled CFDIs, issued or received, use the Metadata type ("Metadata").
Concepts
These are the bulk download concepts, from the most general to the most specific:
| Concept | What it is |
|---|---|
| Person | A taxpayer, either an individual (persona física) or a legal entity (persona moral): a company, a customer, or an organization. See issuers or recipients. |
| Download rule | A template you create once with the fixed data for a person's downloads: document type, issued or received, and status, for example active received CFDIs. Fiscalapi reuses it to create requests. |
| Download request | A specific request to the SAT, created from a rule. It inherits the rule's data, adds the period (start date and end date), and tracks its status, resilience, and retries. |
| Package | A ZIP file the SAT generates for a finished request. A request can produce one or more packages, and Fiscalapi processes them to extract their content. |
| XML | With the CFDI type, Fiscalapi reads each XML file in the packages and saves its data: issuer, recipient, line items, taxes, and complements (complementos, XML extensions the SAT defines for specific operations). You query that data from the API without processing the XML. |
| Metadata | With the Metadata type, Fiscalapi saves the summary of each CFDI (UUID, issuer and recipient RFCs, date, amount, type, and status) as a record you can query and filter from the API. |
Entity hierarchy
API responses follow this hierarchy:
Regla de descarga
└── Solicitud de descarga
└── Paquete de descarga
├── Xml[] (cuando satQueryTypeId = "CFDI")
└── MetadataItem[] (cuando satQueryTypeId = "Metadata")
A rule generates requests over time: Fiscalapi creates at least one automatic request per day, and you can create as many manual requests as you need with the API. Each request produces one or more packages, and each package contains the extracted XML files or metadata.
Test environment
The SAT doesn't offer a test environment for bulk download. That's why Fiscalapi's test environment includes its own simulator, which reproduces the complete flow. To use it, follow these three steps.
Step 1: Set up your tenant to issue CFDIs
Follow the quickstart to set up your tenant (the space in Fiscalapi that holds your issuers, recipients, credits, and data): create an issuer person, upload its test certificates, and verify that you can issue invoices.
Step 2: Issue test invoices
Issue a few test invoices by reference (invoice by reference: you send the IDs of people and products already saved in Fiscalapi), with the API or from the dashboard. The simulation takes your most recent invoices whose issuer is a person registered in your tenant, so invoices by value (invoice by value: you send every issuer, recipient, and item value in the request) don't work for this step. You can use any HTTP client or the Postman collection, and the invoice tutorial explains the process in detail.
Step 3: Simulate bulk download from the dashboard
The simulator needs invoices issued in your tenant. Once you have them, go to Descarga CFDI > Reglas de descarga (CFDI download > Download rules) in the dashboard's side menu and click Agregar (Add) in the upper-right corner.

Create a test download rule from the dashboard

Test flow result
When you complete the flow, Fiscalapi creates a test download rule with status Aprobada (Approved) and a download request with status Completada (Completed), with the downloaded CFDIs (XML) and their metadata. You can also start the simulation with the API:
POST /api/v4/download-rules/test
This endpoint and the simulator exist only in the test environment. In production, Fiscalapi downloads directly from the SAT services.
How it works in production
To use bulk download in production, follow these steps in the dashboard:
- Turn on the Bulk CFDI download add-on (an extra you add to your subscription, such as Auto CFDI invoicing) in Compras en línea > Módulos adicionales (Billing > Add-ons).
- Create a person with the RFC you want to download documents for and upload its e.firma.
- In Descarga CFDI > Reglas de descarga (CFDI download > Download rules), create a download rule and assign it to that person.
- In Descarga CFDI > Solicitudes de descarga (CFDI download > Download requests), create a download request and assign it to the rule.
Fiscalapi creates automatic download requests starting from the rule's approval date.

Table of download requests for CFDIs, metadata, or withholding CFDIs

Request types
| Type | API value | Description |
|---|---|---|
| Automatic | "Automatica" | Fiscalapi creates it every day at 1:05 a.m. central Mexico time for each approved rule. It covers the entire previous day, from 00:00:00 to 23:59:59. |
| Manual | "Manual" | You create it with the API, with downloadRequestTypeId set to "Manual" and the period you need. You can create as many as you need. |
Lifecycle
Download rules and requests go through several statuses while they're processed. Check them to track the progress of your downloads.
Download rule statuses
| ID | Status | Description |
|---|---|---|
1 | Pendiente (Pending) | The rule was created and is awaiting approval. |
2 | Aprobada (Approved) | The rule is active and generates automatic requests. |
3 | Rechazada (Rejected) | The rule was rejected and doesn't generate requests. |
4 | Suspendida (Suspended) | Fiscalapi suspended the rule because of a configuration error, such as an expired or missing e.firma. It doesn't generate requests until you fix the error and the rule is approved again. |
-1 | Abandonada (Abandoned) | The rule was canceled, deactivated, or couldn't be processed. |
Pendiente (1) --> Aprobada (2) --> Abandonada (-1)
└--> Rechazada (3)
Request statuses (Fiscalapi)
| ID | Status | Description |
|---|---|---|
1 | Esperando SAT (Waiting for SAT) | Fiscalapi sent the request to the SAT and is waiting for its response. |
2 | Esperando API (Waiting for API) | The SAT responded and Fiscalapi is processing the downloaded packages. |
3 | Completada (Completed) | Fiscalapi downloaded and processed all the packages. |
-1 | Abandonada (Abandoned) | The request was canceled, failed permanently, or the SAT reported that no documents match the criteria. |
EsperandoSat (1) --> EsperandoApi (2) --> Completada (3)
└--> Abandonada (-1)
Request statuses at the SAT
| ID | Status | Description |
|---|---|---|
0 | Desconocido (Unknown) | Initial status: Fiscalapi hasn't checked the request with the SAT yet. |
1 | Aceptada (Accepted) | The SAT accepted the request and is processing it. |
2 | En proceso (In progress) | The SAT is generating the packages. |
3 | Terminada (Finished) | The packages are ready to download. |
4 | Error | An error occurred at the SAT. |
5 | Rechazada (Rejected) | The SAT rejected the request. |
6 | Vencida (Expired) | The request expired at the SAT. |
-1 | Abandonada (Abandoned) | Fiscalapi abandons the request after a permanent error or when the SAT rejects it, for example because no documents match the criteria. |
Desconocido (0) --> Aceptada (1) --> EnProceso (2) --> Terminada (3)
└--> Error (4) --> Abandonada (-1)
└--> Rechazada (5) --> Abandonada (-1)
└--> Vencida (6) --> Abandonada (-1)
The bulk download catalogs list every status of download rules and download requests, with its description in Spanish.
Automatic processing
From a rule's approval date, and while the rule stays in the Aprobada (Approved) status, Fiscalapi runs the download without manual intervention:
| Stage | Frequency | What Fiscalapi does |
|---|---|---|
| Request generation | Every day at 1:05 a.m. central Mexico time | Creates one automatic request per rule to download the previous day's documents, from 00:00:00 to 23:59:59. |
| Verification and download | Every hour | Checks the status of pending requests with the SAT and downloads the available packages. |
| Package processing | Every two hours | Extracts the XML files or the metadata from the downloaded packages. |
| Retries | After a transient error | Retries the download or the processing until the request reaches a final status, Completada (Completed) or Abandonada (Abandoned). |
Validation rules
Download rule validations
| Field | Validation |
|---|---|
personId | Required, exactly 36 characters. |
satQueryTypeId | One of the API values of the download types. |
downloadTypeId | "Emitidos" or "Recibidos". |
satInvoiceStatusId | "Vigente" or "Cancelado". |
description | Required, up to 100 characters. |
Forbidden combinations
| Combination | Reason |
|---|---|
CFDI + Cancelado | The SAT delivers canceled CFDIs, issued or received, only as metadata. |
Retenciones + Cancelado | Withholding CFDIs only accept the Vigente status. |
Period limits
| Query type | Maximum period per request |
|---|---|
| CFDI and metadata | 31 days (1 month) |
| Withholding CFDIs | 400 days (13 months) |
Uniqueness rule
You can't have two active rules with the same RFC, query type (satQueryTypeId), issued or received (downloadTypeId), and invoice status (satInvoiceStatusId). A rule is active in any status except Abandonada (Abandoned). Uniqueness is checked by RFC, so it applies even if the RFC is registered under two people.
SAT status codes
The SAT responds to each bulk download operation with one of these codes:
| Code | Description |
|---|---|
| 0 | Desconocido (Unknown) |
| 300 | Usuario no válido (Invalid user) |
| 301 | XML mal formado (Malformed XML) |
| 302 | Sello mal formado (Malformed seal) |
| 303 | Sello no corresponde con RFC (Seal doesn't match the RFC) |
| 304 | Certificado revocado o caduco (Certificate revoked or expired) |
| 305 | Certificado inválido (Invalid certificate) |
| 404 | Error no controlado (Unhandled error) |
| 5000 | Solicitud recibida con éxito (Request received successfully) |
| 5001 | Tercero no autorizado (Unauthorized third party) |
| 5002 | Solicitudes de por vida agotadas (Lifetime request limit reached) |
| 5003 | Tope máximo de elementos (Maximum number of items reached) |
| 5004 | Información no encontrada (No information found) |
| 5005 | Solicitud duplicada (Duplicate request) |
| 5007 | Paquete no existe (Package doesn't exist) |
| 5008 | Máximo de descargas permitidas (Maximum allowed downloads reached) |
| 5011 | Límite de descargas por folio por día (Daily download limit per UUID) |
| 5012 | No permite descarga de cancelados (Downloading canceled CFDIs isn't allowed) |
Codes 300 to 305 indicate a problem with the certificate or the e.firma, codes 5001 to 5012 are SAT business errors, and code 5000 means the operation succeeded.