Skip to main content
POST
/
invoices
/
{invoiceId}
/
credit-notes
Create credit note
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    amount: 123,
    reason: '<string>',
    invoiceLineItemId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
    taxRateId: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
  })
};

fetch('https://api.dolfinai.co/invoices/{invoiceId}/credit-notes', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "currency": "<string>",
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "organisationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "invoiceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "documentNumber": "<string>",
  "amount": 123,
  "netAmount": 123,
  "taxAmount": 123,
  "taxRateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "taxRateSnapshot": {
    "code": "<string>",
    "name": "<string>",
    "source": "<string>",
    "rate": 123,
    "sourceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "snapshottedAt": "2023-11-07T05:31:56Z"
  },
  "invoiceLineItemId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "reason": "<string>",
  "issuedAt": "2023-11-07T05:31:56Z",
  "createdAt": "2023-11-07T05:31:56Z",
  "createdBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "updatedAt": "2023-11-07T05:31:56Z",
  "updatedBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}

Path Parameters

invoiceId
string<uuid>
required

Body

application/json
amount

Amount to credit, in the invoice's currency. Must be greater than zero and must not exceed the invoice's outstanding balance.

reason
null | string

Optional human-readable reason for the credit (e.g. "returned goods", "customer dispute", "goodwill").

invoiceLineItemId
null | string<uuid>

Optional id of a specific line item on the invoice this credit relates to. When supplied, that line's frozen tax rate is inherited (unless taxRateId overrides it) and recorded as provenance.

taxRateId
null | string<uuid>

Optional tax rate to apply to the credit (an id from GET /tax-rates — an org rate or a country default). Overrides the line item's rate when both are given. When omitted and no line item is supplied, the credit is treated as zero-rated.

Response

Created

currency
string
required

ISO 4217 currency code (e.g. GBP, USD, EUR) — always equal to the invoice currency

id
string<uuid>
organisationId
string<uuid>
invoiceId
string<uuid>
documentNumber
null | string
amount
netAmount

Net (ex-tax) portion of the credit. NetAmount + TaxAmount == Amount.

taxAmount

VAT/tax portion of the credit.

taxRateId
null | string<uuid>

Soft reference to the tax rate applied (an org rate or country default). Null on a zero-rated credit.

taxRateSnapshot
null | object

Frozen copy of the tax rate applied — the source of truth (code, name, rate, source). Null on a zero-rated credit.

invoiceLineItemId
null | string<uuid>

Optional id of the specific invoice line item this credit relates to.

reason
null | string
status
enum<string>
Available options:
Draft,
Issuing,
Issued
issuedAt
null | string<date-time>
createdAt
string<date-time>
createdBy
null | string<uuid>
updatedAt
string<date-time>
updatedBy
null | string<uuid>