---
title: "CFDI and invoicing"
description: "Configure your organization's fiscal profile and read its invoice records."
sidebar:
  badge: Beta
---

Configure your organization's fiscal information and read its available invoice records. This CFDI 4.0 surface is in beta.

## Endpoints

| Method | Path | Description |
| --- | --- | --- |
| `POST` | `/v1/billing/info` | Create or update the fiscal profile |
| `GET` | `/v1/billing/info` | Read the fiscal profile |
| `GET` | `/v1/billing/invoices` | List invoice records |
| `GET` | `/v1/billing/invoices/:id` | Read an invoice record |
| `POST` | `/v1/billing/invoices/:id/request` | Request manual stamping of an invoice |

## Configure the fiscal profile

### Body parameters

| Prop | Type | Default | Description |
| - | - | - | - |
| `rfc` | `string` | - | The organization's valid Mexican tax ID. |
| `razonSocial` | `string` | - | Legal name registered with SAT. |
| `regimenFiscal` | `string` | - | Fiscal-regime code. |
| `usoCfdi` | `string` | - | CFDI-use code, such as G03. |
| `street` | `string` | - | Street in the fiscal address. |
| `exteriorNumber` | `string` | - | Exterior number. |
| `interiorNumber?` | `string` | - | Interior number, when applicable. |
| `neighborhood` | `string` | - | Neighborhood. |
| `city` | `string` | - | City or municipality. |
| `state` | `string` | - | State. |
| `postalCode` | `string` | - | Fiscal postal code. |
| `billingEmail` | `string` | - | Billing email. |
| `billingPhone?` | `string` | - | Billing phone number. |
| `requireInvoice?` | `boolean` | - | Whether the organization requires invoices. |
| `autoGenerateInvoice?` | `boolean` | - | Generate an invoice automatically when applicable. |

```bash
curl -X POST https://api.sendit.mx/v1/billing/info \
  -H "X-API-Key: sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "rfc": "XAXX010101000",
    "razonSocial": "Ejemplo Comercio SA de CV",
    "regimenFiscal": "601",
    "usoCfdi": "G03",
    "street": "Avenida Reforma",
    "exteriorNumber": "123",
    "interiorNumber": "4B",
    "neighborhood": "Juárez",
    "city": "Ciudad de México",
    "state": "CDMX",
    "postalCode": "06600",
    "billingEmail": "facturacion@example.com",
    "billingPhone": "+525512345678",
    "requireInvoice": true
  }'
```

The response uses the standard envelope and returns the saved profile. `GET /v1/billing/info` returns the same profile. If no profile exists, it returns `404 RESOURCE_NOT_FOUND`.

## List invoices

```bash
curl "https://api.sendit.mx/v1/billing/invoices?page=1&limit=20" \
  -H "X-API-Key: sk_live_..."
```

```json
{
  "success": true,
  "data": [
    {
      "id": "inv_123",
      "billingInfoId": "bi_123",
      "uuid": null,
      "folioNumber": null,
      "series": null,
      "invoiceType": "INGRESO",
      "paymentMethod": "PUE",
      "paymentForm": "03",
      "subtotal": "1000.00",
      "tax": "160.00",
      "total": "1160.00",
      "currency": "MXN",
      "status": "PENDING",
      "livemode": false,
      "cancellationReason": null,
      "xmlUrl": null,
      "pdfUrl": null,
      "issuedAt": null,
      "createdAt": "2026-04-20T12:00:00.000Z",
      "updatedAt": "2026-04-20T12:00:00.000Z"
    }
  ],
  "meta": { "total": 1, "page": 1, "limit": 20 }
}
```

`page` starts at 1. `limit` starts at 20 and accepts up to 100. If no fiscal profile exists, the list returns `200` with `data: []`. Invoices carry `livemode`: the list shows the current mode — pass `?livemode=false` for test-mode records.

## Read an invoice

```bash
curl https://api.sendit.mx/v1/billing/invoices/inv_123 \
  -H "X-API-Key: sk_live_..."
```

The response returns one invoice record for your organization with the same shape as the list.

## Request stamping

`POST /v1/billing/invoices/:id/request` requests manual stamping of an invoice record. It requires a session with the ADMIN or OWNER role and the `wallet:write` permission.

The body declares what you expect to find — it **changes** nothing:

```json
{ "paymentMethod": "PUE", "paymentForm": "03", "invoiceType": "INGRESO" }
```

`paymentMethod` and `paymentForm` are required and must **equal** what the invoice already records; `invoiceType` is optional and is compared the same way. Any mismatch returns `400`.

The honest response depends on stamping state:

- **`503 CFDI_STAMPING_BLOCKED`** — stamping is not available right now. Note: **the request was still persisted** before failing — `error.details.invoiceId` and `error.details.fiscalIntent` (`{ "id", "status": "BLOCKED" }`) identify the saved intent. Do not retry in a loop: keep those references and wait until stamping is available.
- **`200`** — the invoice already had an accepted request; the response carries the invoice with `fiscalIntent: { "id", "status" }`.
- **`400`** — the invoice is not eligible or the request conflicts with an existing one.
- **`404`** — the invoice is not in your organization.

Repeating the same request over a blocked intent returns the same blocked outcome — it does not create another.

### What each status means

| `status` | Meaning |
| --- | --- |
| `PENDING` | Record created, unstamped |
| `ISSUED` | Stamped and persisted |
| `ERROR` | A stamping attempt failed and was recorded |

`SENT` and `CANCELLED` exist in the model, but there is no delivery or cancellation workflow — do not expect an endpoint for that. In TEST a simulated stamp is possible; in LIVE stamping fails closed while no provider exists.

## Handle errors

| Code | When it happens | How to resolve it |
| --- | --- | --- |
| `400 INVALID_INPUT` | The RFC, email, or another field is invalid; or `paymentMethod`/`paymentForm` do not match the invoice | Correct the data or declare the recorded values |
| `403 FORBIDDEN` | The user cannot modify the profile | Use an ADMIN or higher member |
| `404 RESOURCE_NOT_FOUND` | The profile or invoice does not exist | Configure the profile or check the `id` |
| `503 CFDI_STAMPING_BLOCKED` | Stamping is unavailable; the request was persisted | Keep `details.invoiceId` and `details.fiscalIntent`; do not retry in a loop |

