Developers
API-ReferenzInvoices

Correct an invoice — also after payment

POST
/invoices/{invoice_id}/corrections

Corrects an issued invoice, paid or not. The original is cancelled by a cancellation invoice (Stornorechnung) that names it; with lines (and a new external_ref) a corrected invoice replaces it — a partial credit is a corrected invoice with less on it. Revenue and VAT are corrected in the period of the correction (§ 17 UStG).

Money paid on the original is booked again on the day of the correction: on the corrected invoice as far as it is open, the rest as the customer's credit with the VAT it contains. refund gives (part of) that credit back — the VAT goes back with it. Refunds made through Stripe arrive with the Stripe sync and need no call.

Refused with 422 invoice_not_correctable when a payment brought dunning charges or a credit beyond the invoice, or a rest (Skonto) was let go; reasons says which. Requires an Idempotency-Key. Scope partner:invoices:write.

Authorization

apiKey partner:invoices:write
headerAuthorizationBearer <ab_…>

An API key from Integrations → Connect AI assistants (MCP) → New access, bound to exactly one company. Each operation names the scope the key must carry.

Scope: partner:invoices:write

Path Parameters

invoice_id*Invoice Id

Header Parameters

Idempotency-Key*string

Your key for this request — a UUID, for example. The same key with the same body answers with the first answer; with another body it is refused.

Length1 <= length <= 255
AlphaCount-Version?string

The API version to use. Default: the current one.

Request Body

application/json
  1. body

POST /invoices/{id}/corrections (with the Idempotency-Key header).

Without lines the invoice is cancelled in full (a credit note); with lines a corrected invoice replaces it under external_ref. What was paid on the original moves to the corrected invoice, the rest becomes the customer's credit; refund gives (part of) that credit back.

external_ref?|null
lines?array<>|null
notes?|null
payment_terms_days?|null
refund?|null
send?Send
Defaultfalse
service_period?|null

Response Body

OK

application/json
  1. response
cancellation*

The cancellation invoice (Stornorechnung) of the original.

corrected*|

The corrected invoice that replaces the original; null for a full credit note.

credit*Credit

What is left as the customer's credit after the corrected invoice and the refund.

rebooked*Rebooked

Money paid on the original, booked again on the day of the correction.

refunded*Refunded

What was given back with refund.

send_error?|

Set when send was requested and a mail failed.

Example Request
curl -X POST 'https://app.alphacount.ai/api/partner/v1/invoices/string/corrections' \  -H 'Authorization: Bearer ab_...' \  -H 'Idempotency-Key: 8e0b3c5e-2f7a-4f6e-9a51-0c2d6f0e1a77' \  -H 'Content-Type: application/json' \  -d '{  "external_ref": "order-1-k1",  "lines": [    {      "description": "Schulung (halber Tag)",      "quantity": 1,      "unit_price_net": "50.00",      "vat_rate": 19    }  ],  "refund": {    "amount": "59.50",    "paid_on": "2026-11-28"  }}'
Example Response
{  "cancellation": {    "amount_paid": "0.00",    "cancelled_by": null,    "cancels_invoice": {      "external_ref": "order-1",      "id": "00000000-0000-4000-8000-000000000001",      "number": "RE-2026-0001"    },    "contract_external_ref": null,    "currency": "EUR",    "customer_external_ref": "org-17",    "due_date": "2026-11-02",    "dunning_level": null,    "external_ref": null,    "external_source": "alphalearn",    "id": "7d1b6c0e-2f4a-4c55-9a3e-5b0f2e1c9a10",    "issue_date": "2026-10-19",    "number": "ST-2026-0001",    "overdue": false,    "paid_at": null,    "sent_at": null,    "service_period": {      "end": "2026-10-31",      "start": "2026-10-01"    },    "status": "issued",    "total_gross": "-119.00",    "total_net": "-100.00",    "total_tax": "-19.00",    "type": "storno"  },  "corrected": {    "amount_paid": "59.50",    "cancelled_by": null,    "cancels_invoice": null,    "contract_external_ref": null,    "currency": "EUR",    "customer_external_ref": "org-17",    "due_date": "2026-11-02",    "dunning_level": null,    "external_ref": "order-1-k1",    "external_source": "alphalearn",    "id": "0c9e1f4b-8a2d-4f6e-b3c1-2d7a9e5f1b33",    "issue_date": "2026-10-19",    "number": "RE-2026-0043",    "overdue": false,    "paid_at": null,    "sent_at": null,    "service_period": {      "end": "2026-10-31",      "start": "2026-10-01"    },    "status": "paid",    "total_gross": "59.50",    "total_net": "50.00",    "total_tax": "9.50",    "type": "invoice"  },  "credit": "0.00",  "rebooked": "119.00",  "refunded": "59.50",  "send_error": null}