# Exports

> An issuer's invoices for a month or a period in a single ZIP with their XML and PDF, or in an Excel: for your accountant, a backup or an audit.

With an export you download at once every invoice an issuer **issued** or **received** in a month: a ZIP with each one's XML (and its PDF, if you ask) or an Excel with one row per invoice. They're the same files as **Facturas › Exportar** in the app. It uses no timbres and works with a [read-only key](https://fiscalisto.com/en/docs/api/autenticacion#read-only-keys).

## Request the export

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/exports \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "month": "2026-10", "direction": "issued", "files": "xml_and_pdf" }'
```

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

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

const exportResult = await fiscalisto.exports.create({
  month: "2026-10",
  direction: "issued",
  files: "xml_and_pdf",
});
```

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

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

export = fiscalisto.exports.create({
    "month": "2026-10",
    "direction": "issued",
    "files": "xml_and_pdf",
})
```

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

use Fiscalisto\Fiscalisto;

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

$export = $fiscalisto->exports->create([
    'month' => '2026-10',
    'direction' => 'issued',
    'files' => 'xml_and_pdf',
]);
```

```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()

	export, err := client.Exports.Create(ctx, &fiscalisto.CreateExportParams{
		Month:     fiscalisto.String("2026-10"),
		Direction: fiscalisto.String("issued"),
		Files:     fiscalisto.String("xml_and_pdf"),
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(export.ID)
}
```

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

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

var export = fiscalisto.exports().create(new CreateExportParams()
        .setMonth("2026-10")
        .setDirection("issued")
        .setFiles("xml_and_pdf"));
System.out.println(export.getId());
```

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

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

var export = await fiscalisto.Exports.CreateAsync(new CreateExportParams
{
    Month = "2026-10",
    Direction = "issued",
    Files = "xml_and_pdf",
});
```

`month` is a whole month (`YYYY-MM`), by issue date in Mexico City time. For another period send `from` and `to` instead of `month`. `direction` is `issued` (the ones it issued, the default) or `received` (the ones it received). `format` is `zip` (the default) or `xlsx`, and with `zip`, `files` picks `xml` (the default), `pdf` or `xml_and_pdf`. With `type` (`I`, `E`, `P`, `T` or `N`) it carries only one document type.

It answers `202` with the export in `status: "processing"`. If no invoice matches, it answers `400` with `export_empty`; if one of the same format is already being generated in the company, `409` with `export_in_progress`.

## Wait and download

A few hundred invoices take seconds; tens of thousands, a few minutes. Poll [`GET /v1/exports/{id}`](https://fiscalisto.com/en/docs/api/referencia/exportaciones/get-export) until `status` is `completed` and download it:

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/exports/xpt_OufpKqnrvx9p0Nfbydl9jG4UNGeTYcvdrg/download \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -o facturas-octubre.zip
```

```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("facturas.zip", await fiscalisto.exports.download("xpt_OufpKqnrvx9p0Nfbydl9jG4UNGeTYcvdrg"));
```

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

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

with open("facturas.zip", "wb") as f:
    f.write(fiscalisto.exports.download("xpt_OufpKqnrvx9p0Nfbydl9jG4UNGeTYcvdrg"))
```

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

use Fiscalisto\Fiscalisto;

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

file_put_contents('facturas.zip', $fiscalisto->exports->download('xpt_OufpKqnrvx9p0Nfbydl9jG4UNGeTYcvdrg'));
```

```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()

	zip, err := client.Exports.Download(ctx, "xpt_OufpKqnrvx9p0Nfbydl9jG4UNGeTYcvdrg")
	if err != nil {
		log.Fatal(err)
	}
	if err := os.WriteFile("facturas.zip", zip, 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("facturas.zip"), fiscalisto.exports().download("xpt_OufpKqnrvx9p0Nfbydl9jG4UNGeTYcvdrg"));
```

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

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

await File.WriteAllBytesAsync("facturas.zip", await fiscalisto.Exports.DownloadAsync("xpt_OufpKqnrvx9p0Nfbydl9jG4UNGeTYcvdrg"));
```

Before it finishes it answers `409` with `export_not_ready`. The file is kept 30 days (`expires_at`); after that, `410` with `export_expired`, and you request it again. [`GET /v1/exports`](https://fiscalisto.com/en/docs/api/referencia/exportaciones/list-exports) lists the issuer's exports, newest first.

## In test mode

In test mode the export carries the test invoices the issuer stamped in that period (up to 500) and is ready at once: the response says `processing`, as in production, and the first poll already says `completed`. That way you try the whole flow without waiting.

## Every month, without asking

If what you want is a backup of everything every month, in the app you can turn on the monthly backup in «Ajustes › Datos y respaldos»: you get the link by email when it's ready.
