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

# Sieg BaixarXml

The SIEG BaixarXml API downloads a single Brazilian electronic fiscal document XML, such as an NF-e, CT-e, NFC-e, or NFS-e, from a SIEG account by its access key. A request names the document with ChaveXml and its type with TipoXml (1 for NF-e, 2 for CT-e, 3 for NFS-e, among other codes), and setting BaixarEventos to true also returns the events linked to that document. Responses carry a Status, Codigo, and Mensagens list describing the result.

## For AI agents

Download one NF-e, CT-e, NFC-e, or NFS-e XML from SIEG by its access key and XML type, optionally with the document's linked events.

## Scope

Does not issue invoices, list documents in bulk, or file tax returns. Use for downloading one fiscal document XML by its access key only.

## Capabilities

- Download the XML of a single NF-e, CT-e, NFC-e, or NFS-e by its ChaveXml access key
- Select the document type with TipoXml codes such as 1 for NF-e, 2 for CT-e, and 3 for NFS-e
- Include the document's linked fiscal events in the same download by setting BaixarEventos to true
- Read the Status, Codigo, and Mensagens fields to tell a successful download from an invalid key

## Use cases

### Agent that fetches a fiscal document on request

An accounting assistant often gets asked for the XML of one specific invoice. Through Jentic the agent searches for 'download an NF-e XML', loads the baixarXml operation, and sends the 44-digit ChaveXml with TipoXml 1, while the SIEG JWT and access key are injected at call time. The agent returns the XML or the Mensagens explaining why the key was rejected.

Example prompt: Call POST `/api/v1/baixar-xml` with ChaveXml set to the 44-digit NF-e key, TipoXml 1, and BaixarEventos false, then return the XML to the user

### Document plus events for audit checks

Before booking an invoice, a finance team checks whether it was cancelled or corrected. Setting BaixarEventos to true returns the events tied to the document together with the XML, so a cancellation or correction letter is visible in the same response. This avoids a second lookup for the events of a single key.

Example prompt: Call POST `/api/v1/baixar-xml` with ChaveXml for the invoice, TipoXml 1, and BaixarEventos true, then flag the invoice if a cancellation event is present

### Freight and service document retrieval

Logistics and service companies handle CT-e transport documents and NFS-e service invoices alongside NF-e. The same operation retrieves any of these by changing TipoXml, so one integration covers goods, freight, and services documents stored in SIEG.

Example prompt: Call POST `/api/v1/baixar-xml` with the CT-e ChaveXml and TipoXml 2 and save the returned XML to the freight record

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | `/api/v1/baixar-xml` | Download one fiscal document XML by key |

## Key resources

- **Fiscal document XML** — A single NF-e, CT-e, NFC-e, NFS-e, or other document identified by ChaveXml and TipoXml, optionally with its events

## 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:** 67 / 100
- **Maturity:** AI-Aware
- **Dimensions:**
  - Foundational Compliance: 100 / 100
  - Developer Experience & Jentic Compatibility: 69 / 100
  - AI-Readiness & Agent Experience: 53 / 100
  - Agent Usability: 94 / 100
  - Security: 58 / 100
  - AI Discoverability: 50 / 100
- **View full report:** https://jentic.com/apis/sieg.com/baixar-xml/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 BaixarXml by hand means obtaining a SIEG JWT from a separate authentication endpoint and sending it with an X-API-Key or X-OAuth-Token header on every download. Through Jentic you install once, import BaixarXml from the API Directory, store the credentials once, and your agent calls it.
- **Permission scoping:** BaixarXml carries the document key inside the request body, so rules bound which operations your agent may call, not which documents. Limit the agent to the operations it needs, such as downloading a single XML, and keep other SIEG operations out unless you add them.
- **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 an NF-e XML' or 'get a CT-e by access key', and Jentic returns the matching SIEG operation with its input schema so the agent sends ChaveXml and TipoXml correctly.

## Related APIs

- **NotaGuard** — List and filter NF-e, NFC-e, and NFS-e documents and download their XML or DANFE
- **SIEG Baixar Eventos** — Download events linked to NF-e, CT-e, and NFC-e documents with CNPJ and date filters
- **SIEG Baixar XML por NSU** — Download XMLs as a ZIP by NSU sequence number

## FAQ

### What authentication does the SIEG BaixarXml 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. The JWT comes from SIEG's authentication endpoint, which is not part of this spec. Through Jentic both credentials are stored by your own instance and attached at call time, so the agent never sees them.

### Which document types can I download with BaixarXml?

TipoXml selects the type. The spec lists codes including 1 for NF-e, 2 for CT-e, and 3 for NFS-e, with further codes such as 4 through 8, 10, 99, and 100 for other document types. ChaveXml and TipoXml are required, and BaixarEventos is optional.

### What are the rate limits for the SIEG BaixarXml 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 BaixarXml MCP server?

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

### How do I download an NF-e XML through Jentic?

Search Jentic for 'download an NF-e XML by access key', load the POST `/api/v1/baixar-xml` operation, and send ChaveXml with the 44-digit key and TipoXml 1. Add BaixarEventos true if you also want the document's events. To run it on your own infrastructure, install Jentic One from its GitHub repo.

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

Yes, at the operation level. If the agent should only search and count documents through other SIEG APIs, leave this download operation out of its rule and it cannot pull document XML at all; if you include it, every call is logged. The rule cannot narrow which access keys or companies it requests, because ChaveXml is sent in the request body.
