# SAT tax returns

> The tax returns an issuer filed with SAT, with their PDF, filing receipt and figures: provisional ones, the company annual return and those of the former Declaraciones y pagos service.

With the issuer's e.firma you bring from SAT every return it filed: each month's **provisional or definitive** returns (since 2022), the **annual** return of companies and individuals (since 2019) and those of the former **Declaraciones y pagos** service (2021 and earlier). Each one arrives with its PDF, its filing receipt, the operation number, the payment reference (línea de captura) and its figures per tax, including the **profit coefficient** it applied. It's useful to review what was already paid, build the accounting or calculate the next provisional payment with SAT's coefficient.

It only queries: nothing is ever filed, signed or changed at SAT.

## What it costs

| What | In production | In test mode |
| --- | --- | --- |
| Query SAT (`POST /v1/sat_declarations/refresh`) | 1 timbre per query | Free |
| List, view and download what it already brought | Free | Free |

The timbre is set aside when the query is accepted (with none left, the API returns `402` `insufficient_balance` right away), used when SAT answers and given back if SAT doesn't answer or doesn't let the e.firma in. Each issuer can be queried once every 10 minutes (each query is a login to SAT with its e.firma); before that, the API returns `429` `sat_refresh_too_soon` with `Retry-After`. Fiscalisto doesn't query on its own: returns are updated when you ask.

## In test mode and in production

- **In production** SAT is entered with the e.firma the issuer stored with `keep_for_downloads: true`, the same as for [SAT downloads](https://fiscalisto.com/en/docs/api/descargas-del-sat#store-the-issuers-efirma).
- **In test mode** SAT has no test environment, so it isn't asked: the query instantly brings sample returns, always the same ones, with their PDF, their receipt and their figures under the rows SAT prints: this year's up to last month (for a company, with its ISR withheld on salaries and its IVA withheld), a complementary return of February's IVA, last year's December with a complementary return filed this year and, for a company, last year's annual return. No e.firma needed.

## Query SAT

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/sat_declarations/refresh \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "issuer": "iss_OufpKqnrvx9p" }'
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const satRefresh = await fiscalisto.satDeclarations.refresh({ issuer: "iss_OufpKqnrvx9p" });
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

sat_refresh = fiscalisto.sat_declarations.refresh({"issuer": "iss_OufpKqnrvx9p"})
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$satRefresh = $fiscalisto->satDeclarations->refresh(['issuer' => 'iss_OufpKqnrvx9p']);
```

```go tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	satRefresh, err := client.SatDeclarations.Refresh(ctx, &fiscalisto.RefreshSatDeclarationsParams{
		Issuer: fiscalisto.String("iss_OufpKqnrvx9p"),
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(satRefresh.ID)
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.model.RefreshSatDeclarationsParams;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var satRefresh = fiscalisto.satDeclarations().refresh(new RefreshSatDeclarationsParams().setIssuer("iss_OufpKqnrvx9p"));
System.out.println(satRefresh.getId());
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var satRefresh = await fiscalisto.SatDeclarations.RefreshAsync(new RefreshSatDeclarationsParams
{
    Issuer = "iss_OufpKqnrvx9p",
});
```

The first query brings every year SAT keeps; the following ones, this year and the previous one, and they request again the files SAT couldn't provide. SAT sometimes takes over a minute just to accept the e.firma, so the API doesn't wait for it: it returns `202` as soon as it accepts the query, with `status: "processing"`, and queries SAT in the background:

```json
{
  "object": "sat_refresh",
  "id": "srf_7Hq2mXc9LpR4tVb8NzK1",
  "livemode": true,
  "issuer": "iss_OufpKqnrvx9p",
  "document": "declarations",
  "status": "processing",
  "result": null,
  "error": null,
  "charged": false,
  "timbre_held": true,
  "created_at": "2026-10-26T09:12:00-06:00",
  "completed_at": null,
  "refreshed_at": "2026-10-26T09:12:00-06:00",
  "next_refresh_at": "2026-10-26T09:22:00-06:00",
  "url": "/v1/sat_declarations?issuer=iss_OufpKqnrvx9p"
}
```

In test mode the query comes back already `completed`, with what it brought in `result`.

## Know when it finished

The query finishes on its own, usually in a minute or two. To know when:

- **With webhooks**: `sat_refresh.completed` arrives when SAT answered (and the timbre was used), or `sat_refresh.failed` when it didn't, with the reason in `error` (and the timbre came back). `data.object` is the query. In test mode `sat_refresh.completed` arrives too, so you can test your webhook.
- **By asking**: `GET /v1/sat_refreshes/{id}` gives the query as it stands; every 30 seconds is enough. `GET /v1/sat_refreshes?issuer=iss_…&document=declarations` lists the issuer's, newest first.

When it finishes, `result` says how many it found (`found`) and how many files it downloaded (`downloaded`):

```json
{
  "status": "completed",
  "result": {
    "found": 58,
    "downloaded": 112,
    "pending": 0,
    "warning": null,
    "completes_at": null
  },
  "charged": true,
  "timbre_held": false,
  "completed_at": "2026-10-26T09:13:41-06:00"
}
```

If it didn't get to download everything (an RFC with many years, or a slow SAT), `pending` says how many are left, and they download on their own, without another timbre, by the time in `completes_at`. Meanwhile, `GET /v1/sat_declarations` already lists the returns it found, each with `figures_status: "pending"` and its figures empty until its PDF downloads. If part of SAT failed (for example, the annual return) and the rest arrived, `warning` carries what SAT said.

## List the returns

```bash tab="cURL"
curl -G https://api.fiscalisto.com/v1/sat_declarations \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -d issuer=iss_OufpKqnrvx9p \
  -d year=2026
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

for await (const item of fiscalisto.satDeclarations.list({ issuer: "iss_OufpKqnrvx9p", year: 2026 })) {
  console.log(item.id);
}
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

for item in fiscalisto.sat_declarations.list({"issuer": "iss_OufpKqnrvx9p", "year": 2026}):
    print(item["id"])
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

foreach ($fiscalisto->satDeclarations->list(['issuer' => 'iss_OufpKqnrvx9p', 'year' => 2026]) as $item) {
    echo $item['id'], "\n";
}
```

```go tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	for item, err := range client.SatDeclarations.ListAutoPaging(ctx, &fiscalisto.ListSatDeclarationsParams{
		Issuer: fiscalisto.String("iss_OufpKqnrvx9p"),
		Year:   fiscalisto.Int64(2026),
	}) {
		if err != nil {
			log.Fatal(err)
		}
		fmt.Println(item.ID)
	}
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.model.ListSatDeclarationsParams;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

for (var item : fiscalisto.satDeclarations().listAutoPaging(new ListSatDeclarationsParams()
        .setIssuer("iss_OufpKqnrvx9p")
        .setYear(2026))) {
    System.out.println(item.getId());
}
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

await foreach (var item in fiscalisto.SatDeclarations.ListAutoPagingAsync(new ListSatDeclarationsParams
{
    Issuer = "iss_OufpKqnrvx9p",
    Year = 2026,
}))
    Console.WriteLine(item.Id);
```

They come from the most recent fiscal year and month to the oldest, the annual return before its year's months. Filter by `year`, `month` (1 to 12), `type` (`normal` or `complementary`) and `source`: `monthly`, `annual` or `dyp`. Each return carries:

- `year`, `month` (`null` on the annual return), `period`, `type` (`normal` or `complementary`), `complementary_type`, `operation_number`, `filed_on` and `payment_line`.
- `isr_due`, `vat_due` and `total_due`, from the receipt, and `profit_coefficient` in the company ISR.
- `sections`: each tax with its rows as SAT prints them (`label` and `value`). On Declaraciones y pagos ones with two columns side by side (withholdings, for example) it's empty, because they can't be read with certainty: use the PDF. One-column ones (an individual's 2024 rental income, for example) carry their taxes like the monthly ones.
- `summary`: the same figures with fixed names, per obligation (see below).
- `receipt`: the receipt's items with what was owed and to pay, and on an individual's annual return what was left `in_favor`.
- `figures_status`: `read` once its PDF was read; `pending` when it's listed but its PDF isn't downloaded yet, so `sections`, `summary`, `receipt` and the `*_due` are empty or `null` until the time in `figures_expected_at`; `unavailable` when SAT hasn't given the PDF (it's asked for again on the next read). Read figures only from those that say `read`.
- `files`: which files it already has, and in `files_error` why one is missing, as SAT said it.

## Figures with fixed names

SAT changes the format and names of its rows from year to year, and repeats some («CANTIDAD A CARGO» appears several times). `summary` reads them for you: each obligation on the return with its figures under names that don't change, to compare one month with another or with your invoices without knowing SAT's format.

```json
{
  "obligations": [
    {
      "obligation": "vat",
      "name": "Impuesto al Valor Agregado. Personas morales",
      "read": true,
      "amount_due": 186287,
      "amount_to_pay": 186287,
      "figures": {
        "taxable_16": 13622057,
        "charged": 2179529,
        "creditable": 1993242,
        "withheld": 0,
        "balance_applied": 0,
        "due": 186287,
        "in_favor": null,
        "to_pay": 186287
      }
    }
  ],
  "total_to_pay": 186287
}
```

| `obligation` | What it is | Figures besides the common ones |
| --- | --- | --- |
| `isr` | Own ISR (provisional payment) | `income`, `invoiced_income`, `additional_income`, `income_ytd`, `deductions`, `profit_coefficient`, `taxable_profit`, `losses_applied`, `tax_base`, `tax_caused`, `prior_payments`, `withheld` |
| `vat` | IVA | `taxable_16`, `taxable_0`, `exempt`, `charged`, `charged_16`, `charged_16_invoiced`, `paid_16`, `creditable`, `withheld`, `balance_applied` |
| `isr_salaries` | ISR withheld on salaries | `workers`, `payments`, `exempt`, `withheld` |
| `isr_assimilated_salaries` | ISR withheld on salary-assimilated income | `payments`, `withheld` |
| `isr_professional_services`, `isr_rent` | ISR withheld on professional services or rent | `withheld` |
| `vat_withholdings` | IVA withheld from third parties | `withheld` |
| `ieps`, `other` | IEPS and the rest | `charged` in IEPS |

All carry `surcharges`, `inflation` (inflation adjustment), `paid_before` (what was paid before, on a complementary return), `due`, `in_favor` and `to_pay`. A figure the return doesn't carry or that couldn't be read is `null`, never `0`. If an obligation only comes in the receipt (`read: false`), it carries its `amount_due` and `amount_to_pay` amounts and its figures as `null`; two-column Declaraciones y pagos ones arrive that way.

`invoiced_income` and `additional_income` are the income with an invoice and the income declared without one. For IVA, `charged` is the total charged; `charged_16` is the 16% IVA declared and `charged_16_invoiced` what its invoices carry, per SAT's prefill: the difference is IVA charged without an invoice. `creditable` is the creditable IVA and `withheld` what was withheld from the issuer; what the issuer withheld from others goes in its own obligation (`vat_withholdings`).

### Complementary returns

A complementary return is a return of its own, with `type: "complementary"` and in `complementary_type` its type as SAT names it: «Modificación de Obligaciones», «Obligación no presentada» or «Dejar sin efecto obligación». It links to the return it corrects by `source`, `year`, `month` and `period`, even when filed in another year: December 2025's complementary return filed in March 2026 carries `year: 2025`, `month: 12`, and for each obligation the most recent by `filed_on` is the one that counts. It carries only the obligations it corrects, each one whole with its new figures, and in `paid_before` what was paid before, so its `to_pay` is only the difference (plus `inflation` and `surcharges`). The obligations it doesn't carry stay as they were in the earlier one. Filter with `type=complementary`, or with `year` and `month` to see the normal return and its complementary ones together.

## The year month by month

`GET /v1/sat_declarations/calendar?year=2026` builds the fiscal year from what your queries brought and, when there is one, the obligations on the RFC's constancia de situación fiscal (which returns SAT expects, how often and since when; without one, they're inferred from what was filed): each month with its obligations and whether they're filed (`filed`, with their returns), missing (`missing`: the deadline passed and we didn't find it) or not yet due (`due`), with the day they're due in `due_on`. What's filed every few months (such as a trust's four-monthly ISR withheld on rent, `period` «1° Enero-Abril») goes in the last month of its period. It also carries the annual return (`month: null`): for a company that declares ISR every month, due March 31; for an individual only once filed, since not every individual has to file it (due April 30). It uses no timbres.

```bash tab="cURL"
curl -G https://api.fiscalisto.com/v1/sat_declarations/calendar \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -d issuer=iss_OufpKqnrvx9p \
  -d year=2026
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const satDeclarationCalendar = await fiscalisto.satDeclarations.calendar({ issuer: "iss_OufpKqnrvx9p", year: 2026 });
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

sat_declaration_calendar = fiscalisto.sat_declarations.calendar({"issuer": "iss_OufpKqnrvx9p", "year": 2026})
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$satDeclarationCalendar = $fiscalisto->satDeclarations->calendar(['issuer' => 'iss_OufpKqnrvx9p', 'year' => 2026]);
```

```go tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	satDeclarationCalendar, err := client.SatDeclarations.Calendar(ctx, &fiscalisto.GetSatDeclarationCalendarParams{
		Issuer: fiscalisto.String("iss_OufpKqnrvx9p"),
		Year:   fiscalisto.Int64(2026),
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", *satDeclarationCalendar)
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.model.GetSatDeclarationCalendarParams;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var satDeclarationCalendar = fiscalisto.satDeclarations().calendar(new GetSatDeclarationCalendarParams()
        .setIssuer("iss_OufpKqnrvx9p")
        .setYear(2026));
System.out.println(satDeclarationCalendar);
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var satDeclarationCalendar = await fiscalisto.SatDeclarations.CalendarAsync(new GetSatDeclarationCalendarParams
{
    Issuer = "iss_OufpKqnrvx9p",
    Year = 2026,
});
```

```json
{
  "object": "sat_declaration_calendar",
  "livemode": true,
  "issuer": "iss_OufpKqnrvx9p",
  "year": 2026,
  "missing": 1,
  "months": [
    {
      "month": 8,
      "due_on": "2026-09-18",
      "obligations": [
        { "obligation": "isr", "status": "filed", "declarations": ["dcl_OufpKqnrvx9p1E"] },
        { "obligation": "vat", "status": "filed", "declarations": ["dcl_OufpKqnrvx9p1E"] },
        { "obligation": "isr_salaries", "status": "missing", "declarations": [] }
      ]
    }
  ]
}
```

SAT doesn't say what obligations an RFC has, so they're inferred from what it files: ISR and IVA every month from the first it filed, and a withholding if it filed it in 2 of the previous 3 months, or before and after the month. A withholding the issuer stopped filing (it no longer has employees) stops being expected after two months. SAT's compliance opinion is what counts; use `missing` to warn your customer, not as a ruling.

## The annual return preload

For an individual issuer, each SAT query (`POST /v1/sat_declarations/refresh`) also reads, with the same e.firma, what SAT will preload in their annual return, for the previous and the current year. `GET /v1/sat_declarations/annual_preload?year=2025` returns it in two parts. It uses no timbres.

- `payroll`, from SAT's payroll viewer: the year's salaries or asimilados and the ISR withheld according to the payroll receipts, in `concepts` (with SAT's code, such as `PIRA1` or `PISR1`), and each employer's in `employers`.
- `personal_deductions`, from the personal deductions viewer: what SAT takes (`total_taken`, by type in `taken`) and what could be deducted but SAT doesn't take (`total_possible`, in `possible`). `invoices` has each CFDI with its type (`deduction_code`, A to J, or `L` if not taken), the type it looks like (`possible_code`) and SAT's reason in `reasons`. A retirement contribution or deposit the bank reported, without a CFDI, has `retirement_deposit`.

Each part is `null` until a query reads it. A company issuer gets `parameter_invalid`. In test mode both are `null`, because SAT has no test environment.

```bash tab="cURL"
curl -G https://api.fiscalisto.com/v1/sat_declarations/annual_preload \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -d issuer=iss_OufpKqnrvx9p \
  -d year=2025
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const satAnnualPreload = await fiscalisto.satDeclarations.annualPreload({ issuer: "iss_OufpKqnrvx9p", year: 2025 });
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

sat_annual_preload = fiscalisto.sat_declarations.annual_preload({"issuer": "iss_OufpKqnrvx9p", "year": 2025})
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$satAnnualPreload = $fiscalisto->satDeclarations->annualPreload(['issuer' => 'iss_OufpKqnrvx9p', 'year' => 2025]);
```

```go tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	satAnnualPreload, err := client.SatDeclarations.AnnualPreload(ctx, &fiscalisto.GetSatAnnualPreloadParams{
		Issuer: fiscalisto.String("iss_OufpKqnrvx9p"),
		Year:   fiscalisto.Int64(2025),
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", *satAnnualPreload)
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.model.GetSatAnnualPreloadParams;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var satAnnualPreload = fiscalisto.satDeclarations().annualPreload(new GetSatAnnualPreloadParams()
        .setIssuer("iss_OufpKqnrvx9p")
        .setYear(2025));
System.out.println(satAnnualPreload);
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var satAnnualPreload = await fiscalisto.SatDeclarations.AnnualPreloadAsync(new GetSatAnnualPreloadParams
{
    Issuer = "iss_OufpKqnrvx9p",
    Year = 2025,
});
```

```json
{
  "object": "sat_annual_preload",
  "livemode": true,
  "issuer": "iss_OufpKqnrvx9p",
  "year": 2025,
  "payroll": {
    "updated_on": "2026-11-14",
    "read_at": "2026-11-17T18:40:00.000Z",
    "concepts": [
      { "code": "PIRA1", "group": "Asimilados a salarios", "title": "Total de ingresos asimilados a salarios", "amount": 231587 },
      { "code": "PISR1", "group": "Impuesto sobre la renta retenido", "title": "ISR retenido", "amount": 24035 }
    ],
    "employers": [
      {
        "tax_id": "EKU9003173C9",
        "name": "ESCUELA KEMPER URGATE",
        "concepts": [
          { "code": "PIRA1", "title": "Total de ingresos por asimilados a salarios", "amount": 231587 },
          { "code": "PISR1", "title": "Total de impuesto retenido", "amount": 24035 }
        ]
      }
    ]
  },
  "personal_deductions": {
    "updated_at": "2026-11-09T10:18:53.177Z",
    "read_at": "2026-11-17T18:40:00.000Z",
    "total_taken": 0,
    "total_possible": 62601,
    "taken": [],
    "possible": [
      { "code": "F", "description": "Primas por seguros de gastos médicos", "invoices": 1, "total": 62601 }
    ],
    "invoices": [
      {
        "uuid": "90C192CF-D3AC-94AF-0F21-DDB66CAD4A26",
        "issuer_tax_id": "EKU9003173C9",
        "issuer_name": "ESCUELA KEMPER URGATE",
        "date": "2025-06-23",
        "total": 62601,
        "payment_form": "99-Por definir",
        "payment_method": "PPD-Pago en parcialidades o diferido",
        "product_code": "84131602-Seguros de asistencia médica y hospitalización",
        "description": "PRIMA NETA SEGURO DE GASTOS MEDICOS",
        "deduction_code": "L",
        "deduction_type": "Concepto no clasificado, con posible deducción",
        "possible_code": "F",
        "reasons": ["La clave de uso del CFDI no corresponde a Primas por seguros de gastos médicos."],
        "retirement_deposit": null
      }
    ]
  }
}
```

## The payment

Each monthly return and each individual annual return has `payment`: whether SAT already has it as paid, from its **Declaraciones pagadas** query. `status` is `paid` (the bank already told SAT), `unpaid` (it has an amount to pay that SAT didn't have as paid when checked, at `checked_at`), `overdue` (the same, with the línea de captura expired), `nothing_to_pay` or `unchecked` (not known yet: its figures aren't read or its payment wasn't looked for; it comes with `checked_at` as `null`). `payments` has each payment as SAT recorded it: `bank`, `date`, `payment_line`, `channel` («Ventanilla» or «Internet»), `amount`, `bank_operation_number` and `payment_key` (the llave de pago); `paid_on`, `amount_paid` and `bank` summarize the latest. An individual's annual return is checked in SAT's annual return app, which carries its payments. Declaraciones y pagos ones are `paid` when **Declaraciones pagadas** lists them, and otherwise have `payment` as `null`, because SAT may have received the payment where that query doesn't reach. The company annual return has `payment` as `null`.

SAT's document, «Información registrada de pagos de contribuciones federales», downloads with `GET /v1/sat_declarations/{id}/payment_record` when `files.payment_record` is `true`. A complementaria brings its own línea de captura: the return it replaces (the normal one or an earlier complementaria of the same month, even one filed the same day) carries `payment` as `null` when unpaid, because the complementaria is what counts. It replaces only a return whose taxes it declares again: an «Obligación no presentada» one adds taxes and replaces none.

## Webhooks

Each query notifies your [webhooks](https://fiscalisto.com/en/docs/api/webhooks):

- `sat_declaration.created` when it finds a new return. Its files and figures may arrive a moment later.
- `sat_declaration.updated` when its PDF, its receipt, its payment record, the financial statements or its figures arrive.

In both, `data.object` is the return as it ends up.

## Download the PDF and the receipt

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/sat_declarations/dcl_OufpKqnrvx9p1F/pdf \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -o declaracion.pdf
```

```ts tab="TypeScript"
import { writeFile } from "node:fs/promises";
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

await writeFile("factura.pdf", await fiscalisto.satDeclarations.pdf("dcl_OufpKqnrvx9p1F"));
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

with open("factura.pdf", "wb") as f:
    f.write(fiscalisto.sat_declarations.pdf("dcl_OufpKqnrvx9p1F"))
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

file_put_contents('factura.pdf', $fiscalisto->satDeclarations->pdf('dcl_OufpKqnrvx9p1F'));
```

```go tab="Go"
package main

import (
	"context"
	"log"
	"os"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	pdf, err := client.SatDeclarations.PDF(ctx, "dcl_OufpKqnrvx9p1F")
	if err != nil {
		log.Fatal(err)
	}
	if err := os.WriteFile("factura.pdf", pdf, 0o644); err != nil {
		log.Fatal(err)
	}
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import java.nio.file.Files;
import java.nio.file.Path;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

Files.write(Path.of("factura.pdf"), fiscalisto.satDeclarations().pdf("dcl_OufpKqnrvx9p1F"));
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

await File.WriteAllBytesAsync("factura.pdf", await fiscalisto.SatDeclarations.PdfAsync("dcl_OufpKqnrvx9p1F"));
```

The receipt is at `GET /v1/sat_declarations/{id}/receipt`, the payment record at `GET /v1/sat_declarations/{id}/payment_record` and, on the company annual return, the financial statements Excel at `GET /v1/sat_declarations/{id}/financial_statements`. A file SAT doesn't provide yet returns `404` with its reason; it's requested again on the next query.

> **With the owner's permission.** Ask for the e.firma only with the RFC owner's permission and tell them what it's for. With it, their returns and invoices at SAT can be queried.
