> ## Documentation Index
> Fetch the complete documentation index at: https://docs.invopop.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SW Sapien

> Bulk download and import CFDIs from Mexico's SAT using SW Sapien's Efisco service.

<Warning>
  The SW Sapien app is not available by default. Contact us if you are interested in using it.
</Warning>

<Tabs>
  <Tab title="Description">
    <Columns cols="2">
      <div class="flex flex-col grow items-center justify-center">
        <Card title="SW Sapien" icon="https://assets.invopop.com/apps/sw-sapien/icon.svg" href="/guides/mx-sat-receiving" horizontal>
          View implementation guide ›
        </Card>
      </div>

      |           |                                |
      | --------- | ------------------------------ |
      | Developer | [Invopop](https://invopop.com) |
      | Category  | Government                     |
      | Scope     | Issued, Received               |
      | Country   | [Mexico](/compliance/mexico)   |
    </Columns>

    The **SW Sapien app** connects Invopop to [SW Sapien's](https://sw.com.mx/) Efisco service to bulk download CFDI documents from the SAT (Servicio de Administración Tributaria). Instead of managing sensitive e.firma (FIEL) certificates or building brittle web-scraping solutions, this app delegates the complexity of SAT authentication and download to a trusted third-party provider.

    <Note>
      This app handles CFDI **download** only. Once downloaded, each CFDI is passed to the [SAT Mexico app](/apps/sat-mexico) for conversion to [GOBL](https://docs.gobl.org) format via a separate workflow.
    </Note>

    #### Key features

    * **Bulk CFDI download:** Request and download CFDIs for a given date range, both issued and received, through SW Sapien's Efisco API.
    * **Automatic job dispatch:** For each downloaded CFDI, the app uploads the file and creates a workflow job that triggers the conversion process.
    * **Periodic execution:** Combine with the [Cron app](/apps/cron) to schedule automatic daily (or other interval) imports.
    * **Flexible document types:** Configure whether to import received invoices, issued invoices, or both.
    * **No sensitive certificate management:** Authentication with SAT is handled entirely by SW Sapien, so e.firma (FIEL) certificates never need to be stored in Invopop.

    Check out our [Mexico: Receiving invoices guide](/guides/mx-sat-receiving) for step-by-step setup instructions. The app also supports importing issued invoices; refer to the configuration options below for details.
  </Tab>

  <Tab title="Actions">
    The following workflow actions will be available once you install and enable this app:

    <Card title="Register Efisco Party" icon="https://assets.invopop.com/apps/sw-sapien/icon.svg" horizontal>
      Initiate the registration of a party with SW Sapien's Efisco service, generating a link for uploading the e.firma (FIEL) certificate.
    </Card>

    <Card title="Import CFDIs from Efisco" icon="https://assets.invopop.com/apps/sw-sapien/icon.svg" horizontal>
      Request CFDI downloads from SW Sapien's Efisco service for a specified date range, wait for completion, and dispatch individual conversion jobs for each CFDI.
    </Card>
  </Tab>

  <Tab title="Workflows">
    The following templates help you get started quickly. Use them as is or as a base for your own flows.

    <AccordionGroup>
      <Accordion title="SW Sapien register party">
        Initiate the registration of a party with SW Sapien's Efisco service to enable CFDI downloads.

        ```json Example SW Sapien register party workflow theme={"system"}
        {
            "name": "SW Sapien register party",
            "description": "Register a party with SW Sapien Efisco to enable CFDI downloads",
            "schema": "org/party",
            "steps": [
                {
                    "id": "aaa044b0-14cc-11f1-85d2-9d77c04210bc",
                    "name": "Set state",
                    "provider": "silo.state",
                    "summary": "Set state to `processing`{.state .processing}",
                    "config": {
                        "state": "processing"
                    }
                },
                {
                    "id": "ae845cb0-14cc-11f1-85d2-9d77c04210bc",
                    "name": "Register supplier with Efisco",
                    "provider": "sw-sapien.efisco.register"
                }
            ],
            "rescue": [
                {
                    "id": "a3b4c5d0-4d5e-11f0-e004-7d8e9f0a1b2c",
                    "name": "Set state",
                    "provider": "silo.state",
                    "summary": "Set state to `error`{.state .error}",
                    "config": {
                        "state": "error"
                    }
                }
            ]
        }
        ```
      </Accordion>

      <Accordion title="SW Sapien import CFDIs">
        Download CFDIs from SAT via SW Sapien's Efisco service and dispatch a conversion job for each document. This workflow is designed to be executed periodically using the [Cron app](/apps/cron).

        ```json Example SW Sapien bulk import CFDIs workflow theme={"system"}
        {
            "name": "SW Sapien bulk import CFDIs",
            "description": "Bulk-import CFDIs from SAT via SW Sapien Efisco",
            "schema": "org/party",
            "steps": [
                {
                    "id": "28b5e810-14cc-11f1-85d2-9d77c04210bc",
                    "name": "Bulk import CFDIs from Efisco",
                    "provider": "sw-sapien.efisco.import",
                    "summary": "Received → no workflow",
                    "config": {
                        "document_type": "Recepcion",
                        "workflow_id": ""
                    }
                }
            ],
            "rescue": [
                {
                    "id": "a7b8c9d0-2b3c-11f0-c002-5b6c7d8e9f0a",
                    "name": "Set state",
                    "provider": "silo.state",
                    "summary": "Set state to `error`{.state .error}",
                    "config": {
                        "state": "error"
                    }
                }
            ]
        }
        ```
      </Accordion>

      <Accordion title="SAT convert CFDI">
        Convert an individual CFDI to [GOBL](https://docs.gobl.org) format using the [SAT Mexico app](/apps/sat-mexico).

        ```json Example SAT import CFDI workflow theme={"system"}
        {
            "name": "SAT import CFDI",
            "description": "Import a CFDI received through SAT",
            "schema": "bill/invoice",
            "steps": [
                {
                    "id": "6346e330-14cc-11f1-85d2-9d77c04210bc",
                    "name": "Import CFDI from SAT",
                    "provider": "sat-mx.import"
                },
                {
                    "id": "74f01110-14cc-11f1-85d2-9d77c04210bc",
                    "name": "Set state",
                    "provider": "silo.state",
                    "summary": "Set state to `received`{.state .received}",
                    "config": {
                        "state": "received"
                    }
                }
            ],
            "rescue": [
                {
                    "id": "e5f6a7b0-1a2b-11f0-b001-4a5b6c7d8e9f",
                    "name": "Set state",
                    "provider": "silo.state",
                    "summary": "Set state to `error`{.state .error}",
                    "config": {
                        "state": "error"
                    }
                }
            ]
        }
        ```
      </Accordion>
    </AccordionGroup>
  </Tab>
</Tabs>

***

<AccordionGroup>
  <Accordion title="🇲🇽 Invopop resources for Mexico">
    |            |                                                                                                                                                                                                                                                                                                 |
    | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | Compliance | <Icon icon="https://assets.invopop.com/flags/mx.svg" /> [Invoicing compliance in Mexico](/compliance/mexico)<br /> <Icon icon="timeline" /> [Compliance timeline](/timelines/mexico)                                                                                                            |
    | Apps       | <Icon icon="https://assets.invopop.com/apps/sat-mexico/icon.svg" /> [SAT Mexico](/apps/sat-mexico)<br /> <Icon icon="https://assets.invopop.com/apps/sw-sapien/icon.svg" /> [SW Sapien](/apps/sw-sapien)<br /> <Icon icon="https://assets.invopop.com/apps/cron/icon.svg" /> [Cron](/apps/cron) |
    | Guides     | <Icon icon="book" /> [Issuing invoices](/guides/mx-sat-issuing)<br /> <Icon icon="book" /> [Receiving invoices](/guides/mx-sat-receiving)                                                                                                                                                       |
    | FAQ        | <Icon icon="square-question" /> [Mexico FAQ](/faq/mexico)                                                                                                                                                                                                                                       |
    | GOBL       | <Icon icon="https://assets.invopop.com/icons/gobl.svg" />  [Mexico Tax Regime](https://docs.gobl.org/regimes/mx)<br /> <Icon icon="https://assets.invopop.com/icons/gobl.svg" /> [Mexican SAT CFDI Addon](https://docs.gobl.org/addons/mx-cfdi-v4)                                              |
    | GitHub     | <Icon icon="github" /> [gobl.cfdi](https://github.com/invopop/gobl.cfdi)                                                                                                                                                                                                                        |
  </Accordion>
</AccordionGroup>

<Card title="Participate in our community" icon="square-question" horizontal href="https://community.invopop.com">
  Ask and answer questions about SW Sapien App →
</Card>
