> ## Documentation Index
> Fetch the complete documentation index at: https://docs.newinvoice.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Invoice API

> A Stripe-quality REST API for Mexican electronic invoicing (CFDI 4.0).

Build, stamp, cancel, validate, and bulk-download **CFDI 4.0** invoices with a developer-first,
agent-first API. Friendly JSON in — a SAT-stamped `UUID` out.

> [card] [Quickstart](https://docs.newinvoice.dev/quickstart.md)
>
> Stamp your first invoice in four requests — in test mode, no live data touched.

> [card] [API Reference](https://docs.newinvoice.dev/api-reference)
>
> Every endpoint, request, and response — generated from the OpenAPI 3.1 spec.

> [card] [Connect (multi-tenant)](https://docs.newinvoice.dev/guides/connect.md)
>
> One platform key, many tenants — Stripe Connect–style. Built for accounting apps.

> [card] [Going live](https://docs.newinvoice.dev/guides/going-live.md)
>
> Live API keys, a real CSD, the carta manifiesto, and the production checklist.

## What it does

> [card] Fiscal profiles
>
> Register an emitter RFC + CSD + FIEL, then sign the carta manifiesto to authorize stamping.
> Keys are AES-256-GCM encrypted and never returned.

> [card] Invoices
>
> JSON → CFDI 4.0 XML → local CSD sello → PAC stamp. Drafts, PDF, credit notes, complemento de pago.

> [card] Cancellation
>
> Motivos 01–04 with the SAT acuse and receptor-acceptance polling.

> [card] Validation
>
> Validate any CFDI XML — structure, arithmetic, sello, and SAT status.

> [card] Massive download
>
> SAT descarga masiva jobs by date range, issued/received, CFDI or metadata.

> [card] Webhooks
>
> HMAC-signed events with retries — including Connect webhooks across all your tenants.

## SDKs

Two first-party SDKs wrap the API — both fully typed, dependency-free, and covering every
endpoint (invoices, fiscal profiles, downloads, webhooks, events, usage, versions):

> [card] Node.js
>
> `@invoice-api/node` — ESM, fully typed, with a webhook-signature verifier.

> [card] Python
>
> `invoice_api` — stdlib-only, Python 3.9+, with the same webhook verifier.

> [!NOTE]
>
> Neither package is on a public registry yet — `npm install @invoice-api/node` and
> `pip install invoice-api` 404 today. Install from the repository (`npm pack` the `sdk/` folder,
> or `pip install ./sdk-python`); the exact commands live in the repo README's **SDKs** section.

## Built for agents

RFC 9457 `problem+json` errors carry a stable `code` and human- **and** LLM-readable
`remediation`. The API ships `llms.txt`, an OpenAPI 3.1 spec, and a full **test mode** so anything —
human or agent — can build the whole flow before going live. Dated versioning (`Invoice-Version`)
keeps old integrations stable — see the [changelog](https://docs.newinvoice.dev/concepts/versioning.md).

> [!NOTE]
>
> Test mode (`sk_test_`) stamps on the PAC's production host with `prueba=true`, which is not
> reported to the SAT; live mode (`sk_live_`) stamps for real. Data is fully isolated per mode, but
> [not every operation is sandboxed](https://docs.newinvoice.dev/guides/testing.md#what-is-and-isnt-sandboxed).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.