Model credit notes and cancellations correctly
An invoice was wrong or is being reversed, and you need the correct document type.
Steps
- 1
Pick the document type: credit_note for a credit note, correction for a corrected version.
- 2
Include the original invoice number as a reference so the recipient can match it.
- 3
State amounts positively — the document type determines the direction, not the sign.
The call
POST /api/v1/invoice/DE/xrechnung/generate
bash
1curl -X POST https://api.invoice-api.xhub.io/api/v1/invoice/DE/xrechnung/generate \2 -H "X-API-Key: $INVOICE_API_KEY" \3 -H "Content-Type: application/json" \4 -d '{5 "invoice": {6 "invoiceNumber": "GS-2025-001",7 "type": "credit_note",8 "issueDate": "2025-01-15",9 "dueDate": "2025-02-15",10 "currency": "EUR",11 "seller": {12 "name": "Muster GmbH",13 "vatId": "DE811128135",14 "street": "Musterstraße 1",15 "postalCode": "10115",16 "city": "Berlin",17 "countryCode": "DE",18 "email": "info@muster.de",19 "phone": "+49 30 12345678"20 },21 "buyer": {22 "name": "Beispiel AG",23 "vatId": "DE136695976",24 "street": "Beispielweg 42",25 "postalCode": "80331",26 "city": "München",27 "countryCode": "DE"28 },29 "items": [30 {31 "position": 1,32 "description": "Beratungsleistung",33 "quantity": 10,34 "unit": "HUR",35 "unitPrice": 150,36 "taxRate": 19,37 "netAmount": 1500,38 "taxAmount": 285,39 "grossAmount": 178540 }41 ],42 "taxSummary": [43 {44 "taxRate": 19,45 "netAmount": 1500,46 "taxAmount": 28547 }48 ],49 "subtotal": 1500,50 "total": 1785,51 "countrySpecific": {52 "countryCode": "DE",53 "leitwegId": "991-12345-67"54 }55 }56}'Where this goes wrong
Re-sending an invoice with negative amounts is not a credit note. The document type has to be right, otherwise the recipient books it twice.