canonical: https://jentic.com/apis/sieg.com/baixar-xmls

# Sieg BaixarXmls

The SIEG BaixarXmls API downloads Brazilian fiscal document XMLs in batches from a SIEG account, filtered by document type and issue date. A request sets TipoXml to pick the document type and DataEmissaoInicio and DataEmissaoFim to bound the issue-date window, then pages through the results with Take and Skip. The response returns a success flag, a message, and a data array holding the documents for that page, which makes it suited to bulk exports rather than single-document lookups.

## For AI agents

Download fiscal document XMLs from SIEG in batches: choose the document type with TipoXml, bound the issue dates, and page through results with Take and Skip.

## Scope

Does not issue invoices, fetch a document by access key, or file tax returns. Use for downloading batches of fiscal document XMLs by type and issue date only.

## Capabilities

- Download a batch of fiscal document XMLs of one type selected by TipoXml
- Restrict a batch to documents issued between DataEmissaoInicio and DataEmissaoFim
- Page through large exports with the Take and Skip fields
- Read the success flag and message to tell a completed batch from a failed request

## Use cases

### Agent-run monthly XML export through Jentic

At month end an accounting agent connected through Jentic exports the period's fiscal XMLs from SIEG. It calls the batch download with the document type in TipoXml and the month's first and last days in DataEmissaoInicio and DataEmissaoFim, and keeps raising Skip by the Take size until a page returns no documents. The SIEG JWT and access key are injected at call time, so the agent never holds them.

Example prompt: Call POST `/api/v1/baixar-xmls` with TipoXml 1, DataEmissaoInicio 2026-10-01T00:00:00, DataEmissaoFim 2026-10-31T23:59:59, Take 50, and Skip 0, then repeat with Skip 50, 100, and so on until data is empty

### Fiscal archive backup

Companies that keep a copy of their fiscal documents outside SIEG can pull them in batches by type and issue date and store each page in their own archive. Paging with Take and Skip keeps each request small, and the date window lets a backup job run day by day or month by month.

Example prompt: Call POST `/api/v1/baixar-xmls` for yesterday's DataEmissaoInicio and DataEmissaoFim with Take 100 and Skip 0, and store each document in data to the archive

### Feeding an accounting or ERP import

Accounting systems often import fiscal XMLs to book purchases and sales. A sync job fetches a batch of a given TipoXml for a date range and hands each document to the importer, which avoids requesting documents one access key at a time.

Example prompt: Call POST `/api/v1/baixar-xmls` with the TipoXml the ERP expects and the last sync window, then pass each document in data to the importer and record the next Skip value

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | `/api/v1/baixar-xmls` | Download a batch of fiscal XMLs |

## Key resources

- **XML batch** — Fiscal document XMLs of one TipoXml, filtered by issue date and paged with Take and Skip

## AI readiness

This API is usable in Jentic One now. Its AI-readiness score against Jentic's framework shows where it stands today and where improvements would make it even easier for agents to use.

- **Score:** 0 / 100
- **Maturity:** Non-Ready
- **Dimensions:**
  - Foundational Compliance: 94 / 100
  - Developer Experience & Jentic Compatibility: 56 / 100
  - AI-Readiness & Agent Experience: 43 / 100
  - Agent Usability: 94 / 100
  - Security: 58 / 100
  - AI Discoverability: 0 / 100
- **View full report:** https://jentic.com/apis/sieg.com/baixar-xmls/scorecard
- **How the score is calculated:** https://docs.jentic.com/reference/api-readiness-framework/overview/
- **More about the dimensions:** https://docs.jentic.com/reference/api-readiness-framework/specification/#dimensional-model-overview

### Score it yourself

Every API in the directory is allowlisted, so you can re-score it with no key required.

- **Score your own API:** https://jentic.com/scorecard.md
- **Scoring CLI agent skill:** https://github.com/jentic/jentic-api-scorecard/blob/main/skills/jentic-api-scorecard/SKILL.md

```sh
npx @jentic/api-scorecard-cli score <openapi-url>
```

## Why Jentic

- **Setup:** Wiring BaixarXmls by hand means obtaining a SIEG JWT, pairing it with an X-API-Key or X-OAuth-Token header on every call, and looping Take and Skip until a page comes back empty. Through Jentic you install once, import BaixarXmls from the API Directory, store the credentials once, and your agent calls it.
- **Permission scoping:** BaixarXmls carries its type and date filters inside the request body, so rules bound which operations your agent may call, not which documents it downloads. Limit the agent to the operations it needs, and leave the batch download out of the rule for agents that should only count or search documents.
- **Credential handling:** Your SIEG JWT and access key are stored once, encrypted, by your own Jentic One instance and injected at execution time. They never enter the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'download fiscal XMLs in batch' or 'export NF-e XMLs for a month', and Jentic returns the BaixarXmls operation with its input schema so the agent sends TipoXml, the date window, and paging fields correctly.

## Related APIs

- **SIEG BaixarXml** — Download one fiscal document XML by its access key
- **SIEG Contar Xmls** — Count stored XMLs by type for a date range and CNPJ filters
- **SIEG Buscar XMLs por NSU** — List documents incrementally from a starting NSU
- **NotaGuard** — List and filter NF-e, NFC-e, and NFS-e documents and download their XML or DANFE

## FAQ

### What authentication does the SIEG BaixarXmls API use?

Per its OpenAPI spec, each call needs two credentials together: a JWT sent as an HTTP bearer token, plus either an X-API-Key header or an X-OAuth-Token header carrying a SIEG OAuth 2.0 token. Through Jentic both credentials are stored encrypted by your own instance and attached at call time, so the agent never sees them.

### How do I page through a large export with BaixarXmls?

Set Take to the page size and Skip to the number of documents already fetched. Start with Skip 0, add the Take value after each call, and stop when the data array comes back empty.

### Can I download a single document by access key with BaixarXmls?

No. BaixarXmls filters by TipoXml and issue date only. To fetch one document by its access key, use the SIEG BaixarXml API, which takes ChaveXml.

### What are the rate limits for the SIEG BaixarXmls API?

The OpenAPI spec does not specify rate limits. Check your SIEG plan and the documentation at https://sieg.com for current limits.

### Is there a SIEG BaixarXmls MCP server?

You don't need an MCP server to give your agent the BaixarXmls API. Jentic connects it directly from the API Directory: import it, store your SIEG JWT and access key once, and your agent calls the batch download when it needs it, discovered on demand rather than held in its context.

### Can I limit what my agent is allowed to do with the SIEG BaixarXmls API?

Yes, at the operation level. For example, give a reporting agent a rule that includes SIEG's count operation but leaves this batch download out, so it can report volumes without pulling any document XML, and every call it makes is logged. The rule cannot narrow which dates or document types a download requests, because those filters sit in the request body.

### How do I export a month of fiscal XMLs through Jentic?

Search Jentic for 'download fiscal XMLs in batch', load the POST `/api/v1/baixar-xmls` operation, and send TipoXml with DataEmissaoInicio and DataEmissaoFim set to the month's bounds, plus Take and Skip for paging. To run it on your own infrastructure, install Jentic One from its GitHub repo.
