# Send invoice

`POST /v1/invoices/{id}/send`

Sends a booked invoice or credit note to the customer: by email with its PDF attached, as an e-invoice, or both. Without a body it's emailed to the address on the invoice or contact.

An issued offer is sent the same way, by email only.

```json
{ "delivery": { "e_invoice": { "number": "5790000123456", "attn_person": "Jane Doe" } } }
```

With both channels, the e-invoice goes first, and if it fails nothing is emailed.

### Email

A `200` means the email provider accepted the message for at least one recipient. It doesn't mean the email was delivered, and other recipients may have been refused. Check `delivery_status` and `email_delivery_status`. If no recipient is accepted, you get `500`. The addresses you send to replace the address on the invoice; the contact isn't changed.

The invoice's files (`GET /v1/invoices/{id}/files`) are attached after the PDF. E-invoices don't carry them.

### E-invoices

`delivery.e_invoice` sends over Nemhandel (EAN/GLN and CVR) or PEPPOL. The company signs up once under Settings → E-faktura; without that you get `e_invoice_failed` with `failure_code: not_enrolled`. No extra scope is needed.

An accepted e-invoice is on its way, not delivered. Poll `GET /v1/invoices/{id}/delivery` until `e_invoice.status` is `delivered` or `failed`.

A `200` means the e-invoice network accepted the document; `e_invoice_status` is `sent`, or `delivered` if the customer's system already has it. A refusal returns `e_invoice_failed` with a `failure_code`, and the attempt is kept in the delivery history.

Numina retries a temporary failure (`retryable: true`) by itself after 15 minutes, then 1, 4, 12 and 24 hours; `next_retry_at` on the delivery shows the next one. For anything else, fix the cause and call this again. That is refused with `409` while an attempt is under way or after the e-invoice was delivered, so a customer never gets the same e-invoice twice.

### Errors

- `400` when a channel has nowhere to send: no email address, or no CVR or EAN number
- `400 validation_error` for `delivery.e_invoice` on an offer
- `400 e_invoice_failed` when the e-invoice was refused; `502 e_invoice_failed` when the e-invoice service failed (`failure_code: provider_error`)
- `403 forbidden` for sandbox companies, which can't send
- `409` for drafts, and for an e-invoice that is under way or delivered

### Test without sending

A sandbox company refuses every send, so use it to test everything up to this call. There is no test network: outside a sandbox every send is real. For an end-to-end test, send to a number you control, such as your own company's.

### Retries

Every successful call sends, so send an `Idempotency-Key` header to retry safely after a timeout. Be careful after a `5xx`: the failure can come after the provider accepted the message, and since it frees the key, a retry can email the customer twice. For an e-invoice, read `GET /v1/invoices/{id}/delivery` first.

Send an `Idempotency-Key` header, such as a new UUID per request, to retry safely after a timeout or network error.

- Same key and body: you get the original response, with `Idempotent-Replayed: true`.
- Same key, different body: `422`.
- Same key while the first request is still running: `409`.

Keys belong to the company and are kept for 24 hours after a successful request. A failed request (`4xx` or `5xx`) frees its key, so a retry with that key runs again.

**Scopes:** any of `invoices:book`, `write:ledger`

## Request

```bash
curl -X POST https://api.numina.app/v1/invoices/550e8400-e29b-41d4-a716-446655440000/send \
  -H "Authorization: Bearer numi_YOUR_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "delivery": {
      "email": {
        "to": "faktura@kunde.dk"
      },
      "e_invoice": {
        "number": "5790000123456",
        "scheme": "GLN",
        "attn_person": "Jane Doe",
        "save_to_contact": false
      }
    },
    "email": "faktura@kunde.dk"
  }'
```

## Path parameters

- `id` (string (uuid), required): Invoice ID

## Headers

- `Idempotency-Key` (string, optional): A unique key for this request, up to 255 characters. A retry with the same key and body returns the original response instead of running again. (max 255 chars)

## Body (`application/json`)

- `delivery` (object, optional): The channels to send on. Leave it out to email the address on the invoice or contact.
  - `email` (object, optional): Email the PDF. Send `{}` to use the address on the invoice or contact.
    - `to` (string, optional): Up to 5 addresses, separated by commas. Defaults to the address on the invoice, then the contact's invoice email. (max 500 chars)
  - `e_invoice` (object, optional): Send as an e-invoice over Nemhandel (OIOUBL) or PEPPOL, whichever the customer is registered on. Send `{}` to use the number on the invoice or contact. The company must be signed up under Settings → E-faktura.
    - `number` (string, optional): The customer's CVR number (8 digits) or EAN/GLN (13 digits). Defaults to the number on the invoice, then the contact's `e_invoice_number`, then its CVR number.
    - `scheme` (string, optional): `GLN` for an EAN number, `DK:CVR` for a CVR number. Defaults to what the length of `number` says. One of: `DK:CVR`, `GLN`.
    - `attn_person` (string, optional): The customer's reference: the person or requisition the invoice is for (att.). Public customers often refuse an e-invoice without it. Defaults to the contact's `attn_person`. (max 200 chars)
    - `save_to_contact` (boolean, optional): Save `number`, `scheme` and `attn_person` on the contact once the e-invoice network confirms the number, so the next invoice needs only `{}`. Has no effect on a draft.
- `email` (string, optional): Same as `delivery.email.to`, from before `delivery` existed. Don't send both. (max 500 chars)

## Response `200`

The invoice, after sending

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "invoice_number": 1001,
  "offer_number": 42,
  "type": "invoice",
  "credited_invoice_id": "550e8400-e29b-41d4-a716-446655440000",
  "source_offer_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "sent",
  "issue_date": "2026-01-15",
  "due_date": "2026-02-15",
  "valid_until": "2026-02-15",
  "contact_id": "550e8400-e29b-41d4-a716-446655440001",
  "contact_name": "Acme ApS",
  "currency": "DKK",
  "subtotal": 10000,
  "vat": 2500,
  "vat_rate": 25,
  "total": 12500,
  "has_mixed_vat": false,
  "outstanding_balance": 12500,
  "outstanding_balance_currency": "DKK",
  "currency_rate": 0,
  "delivery_status": "sent",
  "email_delivery_status": "string",
  "email_sent_at": "string",
  "e_invoice_status": "delivered",
  "e_invoice_sent_at": "string",
  "e_invoice_number": "5790000123456",
  "e_invoice_scheme": "GLN",
  "attn_person": "Jane Doe",
  "order_reference": "PO-2026-0042",
  "is_overdue": false,
  "payment_state": "open",
  "unmatched_payments_note": "string",
  "items": [
    {
      "unit": "string",
      "vat_account_id": "string",
      "vat_code": "string",
      "sales_account_number": 0,
      "vat_rate": 0,
      "id": "550e8400-e29b-41d4-a716-446655440002",
      "description": "Consulting services",
      "quantity": 10,
      "unit_price": 1000
    }
  ],
  "memo": "Project Q1 delivery",
  "payment_details": {
    "bank_name": "Danske Bank",
    "scheme": "dk-registration-number",
    "clearing_code": "3409",
    "account_number": "0012345678",
    "iban": "DK5030000012345678",
    "swift_bic": "DABADKKK",
    "other_details": null
  },
  "created_at": "2026-01-15T10:30:00Z"
}
```

## Errors

- `400` Bad Request - The request is invalid
- `401` Unauthorized - Missing or invalid credentials
- `403` Forbidden - Missing scope, the company is archived, or it is a sandbox company
- `404` Not Found - It doesn't exist in this company
- `409` Conflict - The invoice or offer is a draft, or a request with the same Idempotency-Key is still being processed
- `422` Unprocessable Entity - The `Idempotency-Key` was already used for a different request
- `429` Too Many Requests - You're over the rate limit
- `500` Internal Server Error - Something went wrong on our side
- `502` Bad Gateway - The e-invoice service failed

See https://developers.numina.app/errors.md for the error format.
