# Request an issuer's invoices from SAT

`POST https://api.fiscalisto.com/v1/sat_downloads`

SAT's bulk download: the invoices the issuer received (or issued) in a period of up to a year, with their XML. It answers 202 right away; SAT takes from minutes to hours and when it finishes sat_download.completed (or sat_download.failed) arrives and the invoices are in GET /v1/sat_invoices. In production it needs the issuer's stored e.firma; in test mode SAT isn't asked: the download brings sample invoices instantly. In production it uses 1 stamp for every 100 CFDIs it brings (at least 1).

## Before you call

- **The issuer's stored e.firma** (in production; not needed in test mode): [`POST /v1/issuers/{id}/efirma`](https://fiscalisto.com/en/docs/api/referencia/emisores/sign-efirma) with `keep_for_downloads: true`. An RFC of your empresa uses the one stored in the app.

## Parameters

| Name | In | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | header |  | Optional (the SDKs send it on their own). If the response is lost, repeat the request with the same value within 24 hours: it answers the same, with idempotent-replayed: true, and doesn't do it twice (it doesn't create, send emails or charge). |

## Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `issuer` | string |  | The issuer (iss_…). By default, your only issuer. |
| `direction` | `received`, `issued` |  | received (the invoices issued to the issuer, the default) or issued (those it issued, even if not with Fiscalisto). (default "received") |
| `from` | string | yes | From what day (inclusive), in Mexico City time. |
| `to` | string | yes | Until what day (inclusive). At most a year after from, and not after today. |
| `type` | `I`, `E`, `P`, `T`, `N` |  | Only one CFDI type: I, E, P, T or N. By default, all of them. |
| `counterparty_tax_id` | string |  | Only those of one RFC: the issuer of the received ones, or the recipient of the issued ones. |
| `uuid` | string (uuid) |  | A single invoice, by its folio fiscal (UUID). |

Example:

```json
{
  "direction": "received",
  "from": "2026-09-01",
  "to": "2026-09-30"
}
```

## With the TypeScript SDK

```ts
import { Fiscalisto } from "fiscalisto";

// La llave viene de FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const satDownload = await fiscalisto.satDownloads.create({
  direction: "received",
  from: "2026-09-01",
  to: "2026-09-30",
}, { idempotencyKey: "pedido-A-1042" });
```

## With the Python SDK

```python
from fiscalisto import Fiscalisto

# La llave viene de FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

sat_download = fiscalisto.sat_downloads.create({
    "direction": "received",
    "from": "2026-09-01",
    "to": "2026-09-30",
}, idempotency_key="pedido-A-1042")
```

## With the PHP SDK

```php
<?php

use Fiscalisto\Fiscalisto;

// La llave viene de FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$satDownload = $fiscalisto->satDownloads->create([
    'direction' => 'received',
    'from' => '2026-09-01',
    'to' => '2026-09-30',
], ['idempotency_key' => 'pedido-A-1042']);
```

## With the .NET SDK

```csharp
using Fiscalisto;

// La llave viene de FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var satDownload = await fiscalisto.SatDownloads.CreateAsync(new CreateSatDownloadParams
{
    Direction = "received",
    From = "2026-09-01",
    To = "2026-09-30",
}, new RequestOptions { IdempotencyKey = "pedido-A-1042" });
```

## With the Go SDK

```go
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// La llave viene de FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	satDownload, err := client.SatDownloads.Create(ctx, &fiscalisto.CreateSatDownloadParams{
		Direction: fiscalisto.String("received"),
		From:      "2026-09-01",
		To:        "2026-09-30",
	}, fiscalisto.WithIdempotencyKey("pedido-A-1042"))
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(satDownload.ID)
}
```

## With the Java SDK

```java
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.RequestOptions;
import com.fiscalisto.model.CreateSatDownloadParams;

// La llave viene de FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var satDownload = fiscalisto.satDownloads().create(new CreateSatDownloadParams()
        .setDirection("received")
        .setFrom("2026-09-01")
        .setTo("2026-09-30"), RequestOptions.idempotencyKey("pedido-A-1042"));
System.out.println(satDownload.getId());
```

## Response 202

OK.

A `SatDownload` object:

| Field | Type | Always present | Description |
| --- | --- | --- | --- |
| `id` | string | yes | Object identifier, with its prefix (iss_, inv_, ret_, cus_, prd_, emp_, bat_, brn_, whs_, stm_, adj_, evt_, whe_). |
| `livemode` | boolean | yes | true in production (fk_live_ keys), false in test mode (fk_test_). Test objects aren't valid before the SAT. |
| `object` | `"sat_download"` | yes | What kind of object it is («invoice», «customer»…). |
| `issuer` | string | yes | The issuer whose invoices are requested. |
| `direction` | `received`, `issued` | yes | received (the ones made to them) or issued (the ones they issued). |
| `from` | string or null | yes | From which day (inclusive). |
| `to` | string or null | yes | Up to which day (inclusive). |
| `type` | `I`, `E`, `P`, `T`, `N` or null | yes | The receipt type requested, or null for all. |
| `counterparty_tax_id` | string or null | yes | The counterparty RFC requested, or null. |
| `uuid` | string or null | yes | The tax folio requested, or null. |
| `status` | `processing`, `completed`, `failed` | yes | processing (the SAT is preparing it: minutes to hours), completed (the invoices are now in GET /v1/sat_invoices) or failed (the reason in error). |
| `new_invoices` | integer or null | yes | How many new invoices it brought (the ones it already had don't count). null until it finishes. |
| `error` | string or null | yes | Why it failed, as the SAT said. null if it didn't fail. |
| `created_at` | string (date-time) or null | yes | When it was requested. |
| `completed_at` | string (date-time) or null | yes | When it finished, or null. |

```json
{
  "id": "sdl_OufpKqnrvx9p3n8vQd2LkW7mZr1XyT5uBc",
  "object": "sat_download",
  "livemode": false,
  "issuer": "iss_OufpKqnrvx9p",
  "direction": "received",
  "from": "2026-09-01",
  "to": "2026-09-30",
  "type": null,
  "counterparty_tax_id": null,
  "uuid": null,
  "status": "processing",
  "new_invoices": null,
  "error": null,
  "created_at": "2026-10-24T10:20:00-06:00",
  "completed_at": null
}
```

## Errors

- `daily_limit` (429): You reached today's limit of something not paid with stamps. Retry-After says how many seconds until midnight in Mexico City.
- `efirma_invalid` (400): The e.firma can't be used: it isn't an e.firma (it's a CSD), it belongs to another RFC, it expired or the password doesn't open it.
- `efirma_required` (400): To download an issuer's invoices from the SAT in live mode, keep its e.firma first: POST /v1/issuers/{id}/efirma with keep_for_downloads: true (also when the kept one expired).
- `feature_not_in_plan` (403): 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.
- `insufficient_balance` (402): 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.
- `issuer_archived` (400): The issuer is archived and no longer stamps. Its documents can still be read and canceled.
- `issuer_linked_empresa` (403): 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.
- `issuer_missing` (404): There is no such issuer in the account (or it belongs to the other mode).
- `issuer_not_allowed` (403): This key can't use that issuer.
- `issuer_required` (400): The account has several issuers and the request doesn't say which: send `issuer` (iss_…).
- `livemode_mismatch` (400): The object belongs to the other mode: an fk_test_ key only sees test data and an fk_live_ key only live data.
- `sat_request_rejected` (400): The SAT rejected the download request. `message_es` has its reason (for example, the same period and filters were requested too many times).

Plus those of any call (key, fields, limits): https://fiscalisto.com/en/docs/api/errores.md.
