Introduction
The SAT (Servicio de Administración Tributaria) provides mechanisms for bulk downloading CFDI (Comprobante Fiscal Digital por Internet) documents, both issued and received. Importing these documents into Invopop lets you convert them to GOBL format and take advantage of processing capabilities such as accounts payable workflows, PDF generation, and integrations with external systems. This guide walks you through configuring your Invopop workspace to automatically import received invoices from SAT on a recurring schedule. The process uses three apps working together:- Cron: Schedules the import workflow to run automatically at a regular interval (e.g., daily).
- SW Sapien: Downloads CFDIs in bulk from SAT through SW Sapien’s Efisco service, a trusted third-party provider that handles SAT authentication.
- SAT Mexico: Converts CFDI XML documents to GOBL format.
The SW Sapien app also supports importing issued invoices. See the SW Sapien app documentation for configuration details.
Prerequisites
Before you begin, make sure you have:- An Invopop workspace. See the quickstart guide if you need to create one.
- An SW Sapien Efisco account with API credentials. Visit sw.com.mx to create an account and obtain your API token.
- The RFC (Registro Federal de Contribuyentes) of the entity whose received invoices you want to import.
- The entity’s e.firma (FIEL) certificate. This digital certificate issued by SAT is required to authorize bulk CFDI downloads on behalf of the entity.
How it works
The import process follows three main stages:- Scheduling: The Cron app creates a job for the import workflow at each configured interval, passing the time window (
fromandupto) to process. - Downloading: Each import job runs the SW Sapien app to request CFDIs from SAT via Efisco for the given time window. Once the download is ready, it uploads each CFDI file and creates a conversion job.
- Converting: Each conversion job runs the SAT Mexico app’s import action to convert the CFDI XML into GOBL format.
Setup
Configure your Invopop workspace for receiving CFDI imports by following these steps in the Invopop Console:Connect the SAT Mexico app
Navigate to Configuration → Apps, locate SAT Mexico in the app discovery list, and click Connect.
Connect the SW Sapien app
In the same Apps section, locate SW Sapien and click Connect. The app will move to the “Enabled Apps” section.Next, click Configure and enter your SW Sapien API credentials:
- API Token: Your SW Sapien Efisco API token.
Connect the Cron app
Still in the Apps section, locate Cron and click Connect. No additional configuration is needed at this stage.
Set up the CFDI Conversion Workflow
This workflow converts individual CFDI documents to GOBL format. It will be triggered automatically for each downloaded CFDI.
- Template
- Code
- Build from scratch
Remember the name you give this workflow. You will need to select it by name when configuring the import workflow in the next step.
Set up the CFDI Import Workflow
This workflow uses the SW Sapien app to download CFDIs from SAT and dispatch conversion jobs for each one. It will be executed periodically by the Cron app.After adding the template, open the Bulk Import CFDIs via Efisco (Mexico) step and set the Import Workflow field to the CFDI Conversion Workflow created in the previous step.
- Template
- Code
- Build from scratch
SW Sapien import CFDIs workflow
Download CFDIs from SAT via SW Sapien and dispatch conversion jobs.
Remember the name you give this workflow. You will need to select it by name when configuring the subscription workflow in the next step.
Set up the Party Subscription Workflow
This workflow subscribes a party to periodic CFDI imports using the Cron app. Run it once per party you want to receive invoices for.After adding the template, open the Subscribe to Periodic Import step and set the Workflow field to the CFDI Import Workflow created in the previous step.
- Template
- Code
- Build from scratch
Subscribe party to CFDI import workflow
Subscribe a party to daily CFDI bulk imports.
Set up the Party Registration Workflow
This workflow registers a party with SW Sapien’s Efisco service by generating a link where the party’s e.firma (FIEL) certificate can be uploaded. Run it once per party before subscribing them to periodic imports.
- Template
- Code
- Build from scratch
Running
With all workflows in place, you can now register parties and start receiving invoices. For each entity whose invoices you want to import, you need to register them with SW Sapien’s Efisco service and then subscribe them to periodic imports.Register a receiving party
Create the party
In the left sidebar, go to the Parties section and click Suppliers.Click +New Supplier and enter the party’s data. At a minimum, provide:
- Name of the entity
- RFC (Registro Federal de Contribuyentes)
Run the Registration Workflow
With the party entry selected, click Select Workflow and execute the SW Sapien Register Party workflow.After it completes, the party’s state will change to
Processing and a registration link will appear in the Meta tab of the entry.Complete the eFirma upload
Open the Details window and click on Meta. You will see a Registration Link with a URL.Visit that URL to access the registration form. Fill in the entity’s RFC and upload the e.firma (FIEL) certificate files (When you click Save, the certificate details are securely sent to SW Sapien’s Efisco service, which will use them to authenticate bulk CFDI download requests from SAT on behalf of the entity.
You can access the registration link via the API by fetching the silo entry and locating the meta entry where the key is
registration-link..cer and .key) along with the private key password.This form can be shared directly with the entity if required.
You can also upload the e.firma certificate programmatically using the Upload e.firma certificate API endpoint. This is useful for automating onboarding or integrating the registration process into your own application.
Subscribe the party to imports
Once the e.firma has been uploaded, execute the Subscribe to CFDI Import workflow on the same party entry.Once the workflow completes successfully, the party’s state will change to
Registered and the Cron app will begin scheduling import jobs at the configured interval.Monitor imported invoices
Once the subscription is active, the Cron app will automatically create an import job at each configured interval (for example, daily). Here is what happens during each cycle:-
Cron creates an import job with a time window (
fromandupto) corresponding to the scheduled interval. You can see these jobs as they are created in the Workflows → History section of the Console. - The import step shifts the window 72 hours into the past. This is because SAT allows invoices to be issued with a date up to 72 hours before the current time. By shifting the window, the import ensures it only downloads consolidated data where all invoices for that period have been finalized.
For example, if Cron schedules a job on March 10 covering March 9–10, the actual download request to SAT will cover March 6–7. This three-day lag guarantees completeness.
-
The import job enters a
Queuedstate while the SW Sapien app requests the CFDIs from SAT via Efisco. This is an asynchronous process: SAT may take anywhere from a few minutes to several hours (and in exceptional cases, up to six days) to make the download available. The job remains queued until the data is ready. - Once the download completes, the import step retrieves the CFDIs and dispatches a separate conversion job for each one. These conversion jobs will also appear in Workflows → History.
-
Each conversion job runs the CFDI Conversion Workflow, which converts the CFDI XML to GOBL format, signs the envelope, and marks the document with the state
Received. The resulting silo entries will appear in the Invoices section of the Console.
Error, allowing you to identify and resolve issues through the Console or API.
Run the CFDI import manually
For testing purposes, you can trigger the CFDI Import Workflow manually instead of waiting for the Cron app to execute it on schedule.Open the workflow
Navigate to the Workflows section in the Console and locate the CFDI Import Workflow you created during setup. Click on it to open its details.
Run the workflow
Click the Run button and configure the execution:
- Document: Enter the party entry whose RFC you want to import invoices for.
- Arguments: Add the following two parameters:
from: The start of the time window in ISO 8601 format, for example2025-03-01T00:00:00Z.upto: The end of the time window in ISO 8601 format, for example2025-03-02T00:00:00Z.
The import step applies the 72-hour shift described above. For example, if you set
from and upto to cover March 9–10, the actual download request to SAT will cover March 6–7.Unsubscribe a party
To stop importing invoices for a specific party, create a workflow with the Cron Unsubscribe action and execute it on the party’s entry. This removes the subscription and no further import jobs will be scheduled.🇲🇽 Invopop resources for Mexico
🇲🇽 Invopop resources for Mexico
| Compliance | Compliance timeline |
| Apps | |
| Guides | Issuing invoices Receiving invoices |
| FAQ | Mexico FAQ |
| GOBL | |
| GitHub | gobl.cfdi |
Mexico FAQ
Find answers to frequently asked questions about invoicing in Mexico →
Participate in our community
Ask and answer questions about invoicing in Mexico →