# Argentina e-invoicing API (ARCA / AFIP)

Issue electronic invoices, credit notes and debit notes that carry a CAE from ARCA, the Argentine tax authority (formerly AFIP), with one REST API or from an AI assistant over MCP.

## What you get

Every electronic invoice in Argentina needs an authorization code, the CAE, issued by ARCA through its web services. Talking to those services directly means managing certificates, access tickets, per-point-of-sale numbering and ARCA's error codes. YoFacturo does that part and exposes it as a plain JSON API under `https://api.yo-facturo.com/api/v1/`.

- Invoices, credit notes and debit notes with the CAE returned by ARCA.
- A PDF with the ARCA QR code for each approved invoice, plus a public link you can share by email or chat.
- A test mode that never touches ARCA, and a real ARCA homologation environment for end-to-end tests.
- Signed webhooks and an MCP server for AI assistants.
- The OpenAPI specification is public and needs no authentication, so you can generate a client in any language.

## Who it is for

This API is for developers and companies that need valid Argentine invoices: a foreign SaaS billing Argentine customers through a local entity, an e-commerce or booking platform, or an ERP integrator. The invoice issuer must be an Argentine taxpayer: it needs a CUIT (tax ID), a tax condition and an enabled point of sale, and it must delegate the electronic invoicing web service (wsfe) to the platform in ARCA's portal. The API tells you which of those steps is still open.

## How an invoice is issued

1. **Create the invoice** with `POST /bill/receipts/invoice/` and `"autorizar": false`. You get a draft with its number reserved.
2. **Authorize it** with `POST /bill/receipts/authorize/{id}/`. The call is synchronous: it returns the CAE, or ARCA's rejection reason in a 400 so your code or your agent can correct the payload.
3. **Read `data.cae`** and fetch the PDF with `GET /bill/receipts/{id}/pdf/`.

With `"autorizar": true` the authorization runs in the background and the response carries `authorization_pending: true`; poll `GET /bill/receipts/{id}/` until `cae` appears, usually within a few seconds.

The backend decides the invoice letter from the issuer's tax condition and the customer's: monotributo and exempt issuers issue C, registered taxpayers (Responsable Inscripto) issue A or B. You can pin the type with `tipo_comprobante` (1 = A, 6 = B, 11 = C). Prices in `items` are final, IVA included, and the totals come from the backend.

## Built for retries and for agents

Every create endpoint accepts an `Idempotency-Key` header. The same key with the same body returns the original response with `Idempotency-Replayed: true`; the same key with a different body returns 422. A failed request is not stored, so you can retry it.

One gotcha worth knowing: the invoice number is reserved when the draft is created, not when it is authorized. If ARCA rejects a draft, later invoices can fail with ARCA error 10016 until you run the numbering doctor, `POST /bill/receipts/doctor/` with `{"apply": true}`, which resynchronizes the sequence with ARCA.

## Sandbox and homologation

A `yf_test_*` token works on an isolated copy of your data and never calls ARCA: invoices are stored as simulated, with a synthetic CAE and `livemode: false`. For a real CAE from ARCA's homologation web services, switch the account to the testing environment and use a live key; you do not need your own certificate for that. Details are in the sandbox guide.

## Webhooks

Register an HTTPS endpoint and receive `invoice.created` and `invoice.authorized` events, plus `sale.created` and `client.created`. Each delivery is signed with HMAC-SHA256 and retried with backoff. See the webhooks guide.

## AI assistants over MCP

The MCP server at `https://api.yo-facturo.com/api/v1/mcp` lets Claude, ChatGPT or Cursor operate an account after an OAuth sign-in. It is available from the Basic plan, and the free trial includes it. See the MCP guide.

## Limits

| Scope | Limit |
| --- | --- |
| Per account, shared by all tokens | 10 per second, 100 per minute, 3,000 per hour, 20,000 per day |
| Invoice creation and authorization | 30 every 5 minutes |
| Credit notes, debit notes, cancellations | 15 every 5 minutes |

Exceeding a limit returns 429 with `Retry-After`. The invoice endpoints return `X-RateLimit-*` headers with the limit in force for your account, so read it instead of hardcoding the number. If you need more, contact support.

## Start building

Open the [quickstart](https://yo-facturo.com/en/dev/quickstart/), read the [OpenAPI specification](https://api.yo-facturo.com/api/v1/openapi.json), import the [Postman collection](https://yo-facturo.com/yofacturo-api.postman_collection.json), or create an account and a sandbox key at [YoFacturo](https://sistema.yo-facturo.com/start/). The commercial page in Spanish is [API de facturación electrónica](https://yo-facturo.com/api-facturacion/).

## Keep reading

- [Quickstart: from a sandbox key to your first CAE](https://yo-facturo.com/en/dev/quickstart/)
- [OpenAPI specification (JSON)](https://api.yo-facturo.com/api/v1/openapi.json)
- [Postman collection](https://yo-facturo.com/yofacturo-api.postman_collection.json)
- [Spanish version](https://yo-facturo.com/api-facturacion/)

Source: https://yo-facturo.com/en/argentina-e-invoicing-api/
