API Reference

Credit Notes API

Issue credit notes against invoices, list them, download the PDF, email them to clients and read the credit note object via the Rebill API. Includes credit limits, error messages and webhooks.

Last updated

A credit note reduces the value of one issued invoice, in full or for chosen lines. It carries VAT line by line, gets its own number (CN-0001, CN-0002 and so on), and cannot be edited or deleted once issued. Credit notes are created and issued in a single call: there are no draft credit notes.

What a credit note does to the books: it adds a credit_note row to the client's payment ledger and settles the invoice by up to what the invoice still owes. Anything beyond that (for example when the invoice was already paid) stays on the client's account as credit, to be used on a later invoice or paid back and recorded as a refund. When credit notes cover the whole invoice its status becomes credited.

Credit note object

FieldTypeDescription
idstringUnique identifier
public_idstringShort ID used in the public credit note link
numberstringSequential credit note number, e.g. CN-0001. Its own sequence, separate from your invoice numbers
statusstringissued. The only status for now
invoice_idstringThe invoice this credit note reduces
invoice_numberstringThat invoice's number, as it was when the credit note was issued
invoice_datetimestampThat invoice's date, as it was when the credit note was issued
client_idstringID of the invoice's client
owner_user_idstringThe team member who issued it
currencystringISO 4217 code. Always the invoice's currency
vat_enabledbooleanCopied from the invoice
prices_include_vatbooleanCopied from the invoice: whether line prices include VAT
credit_datetimestampThe date printed on the credit note
reasonstringWhy the credit was issued. Printed on the credit note
itemsarrayCredited lines, in the same shape as invoice line items (see Line item object in the Invoices API)
discount_typestringfixed or percentage, or omitted. A full credit note copies the invoice's document discount as it is; a partial credit note always carries a percentage discount (the invoice's discount as an effective percentage)
discount_valueintegerCents for a fixed discount, basis points for a percentage discount
discount_amountintegerCalculated discount in cents
amountintegerTotal credited including VAT, in cents
notesstringNotes printed on the credit note
issuedtimestampWhen the credit note was issued
createdtimestampWhen the record was created
totalsobjectCalculated figures: lines, groups (base and VAT per VAT type and rate), subtotal, vat and total

Issue a credit note

POST /invoice/:id/credit_note

Issues a credit note against an invoice that has been sent. Draft, scheduled, cancelled and fully credited invoices cannot be credited.

FieldRequiredTypeDescription
reasonYesstringWhy the credit is being issued, max 500 characters. Printed on the credit note
credit_dateNodateYYYY-MM-DD. Defaults to today in your account timezone. Must fall between the invoice date and today
fullNobooleantrue credits everything still creditable, and items is then ignored. On an invoice with no credit note yet it credits every line, with the document discount. After partial credit notes it credits exactly what is left: one "Balance of invoice #N" line per VAT type and rate, priced at the amount excl. VAT left there with a vat_amount of the VAT left there (no discount), so the invoice ends fully credited, value and VAT, to the cent
itemsWhen full is falsearrayLines to credit, in the same shape as invoice line items. Each needs a positive quantity and price, and a VAT type and rate that is on the invoice
notesNostringNotes to print on the credit note
send_emailNobooleanEmail the credit note to the client once issued. A failed send does not undo the credit note
curl -X POST https://api.rebill.co.za/invoice/abc123/credit_note \
  -H "Authorization: Bearer sk_your_secret_key" \
  -H "Content-Type: application/json" \
  -d '{
    "reason": "Event cancelled by the client",
    "full": true,
    "send_email": true
  }'

To credit only part of an invoice, leave full out and list the lines:

curl -X POST https://api.rebill.co.za/invoice/abc123/credit_note \
  -H "Authorization: Bearer sk_your_secret_key" \
  -H "Content-Type: application/json" \
  -d '{
    "reason": "Two hours were not worked",
    "credit_date": "2026-10-27",
    "items": [
      {
        "type": "service",
        "name": "Consulting",
        "quantity": 2,
        "unit_price": 100000,
        "vat_type": "standard",
        "vat_rate": 1500
      }
    ]
  }'

Response (201 Created):

{
  "credit_note": {
    "id": "cn_001",
    "number": "CN-0001",
    "status": "issued",
    "invoice_id": "abc123",
    "invoice_number": "INV0001",
    "currency": "ZAR",
    "credit_date": "2026-10-27T00:00:00Z",
    "reason": "Two hours were not worked",
    "amount": 230000,
    "items": [...],
    "totals": {...}
  },
  "invoice": {
    "id": "abc123",
    "status": "paid",
    "amount": 575000,
    "amount_due": 0,
    "credited_amount": 230000,
    "credit_applied_amount": 0
  },
  "leftover_credit": 230000
}
Response fieldTypeDescription
credit_noteobjectThe issued credit note
invoiceobjectThe invoice as it is now, with its new status and credit figures
leftover_creditintegerCents of this credit note the invoice could not absorb because it was already paid. This stays on the client's account as credit. 0 when the invoice took all of it

Credit limits and errors

A credit note can never reverse more than the invoice charged. The total credited across all credit notes cannot exceed the invoice total. For each VAT type and rate, the credit notes together cannot take more than the invoice charged at that rate, in value, in the amount excl. VAT, or in VAT: a credit note never reverses more VAT than the invoice charged at each rate. Each partial credit note rounds its own VAT, so lines credited one at a time drift from the invoice by a few cents. Two cases make a partial credit note credit exactly what is left at a rate instead. First, its lines at that rate take every invoice line still open there, in full quantity and at the invoice price (lines are matched by item_id, else by name, and together must be worth at least open_lines_value less a cent per open line, before the document discount and VAT included), and its value is within close_tolerance_all_lines cents of what is left: crediting the last lines at a rate always closes it. That allowance is a few cents, larger only on invoices with a fixed discount: that discount reaches each partial credit note as a rounded percentage, and the allowance grows by exactly the difference this makes at that rate, plus a cent. Second, for any other lines, its value is within close_tolerance cents of what is left, at most 5 cents, so a typed amount is never moved by more than that. Its lines at that rate then become one line (keeping the line's name when there was one, else "Balance of invoice #N") with the amount excl. VAT and the vat_amount left. Both figures are in List credit notes for an invoice. full: true credits everything left exactly, value and VAT, and always passes these limits. If the invoice has a document discount, a first full credit note copies it, and a partial credit note applies it as an effective percentage, so a line credited at full price is credited at what the client actually paid for it.

A refused issue returns 422 Unprocessable with a message:

MessageCause
Only sent or paid invoices that aren't fully credited can be credited.The invoice is a draft, scheduled, cancelled or already fully credited
This credit is more than what's left to credit on the invoice.The credit note would take the invoice over its total
This credit is more than what's left to credit at that VAT rate.More value than is left at one VAT type and rate
This credit reverses more VAT than is left at that rate. Use Credit everything that's left instead.The value fits, but by rounding the credit takes more VAT, or more excl. VAT, than is left at one VAT type and rate. Issue with full: true to credit what is left exactly
vat_amount can't be set.A line in items has a vat_amount: only Rebill sets it
Every line must use a VAT rate that is on the invoice.A line uses a VAT type or rate the invoice does not have
The credit date must be between the invoice date and today.credit_date is before the invoice date or in the future
Add at least one line to credit.full is false and items is empty
Each line needs a positive quantity and price.A line has a zero or negative quantity or price
Add a reason for the credit.reason is blank

What a credit note changes on the invoice

The invoice's credited_amount grows by the credit note amount, and credit_applied_amount grows by the part the invoice absorbed (up to its amount_due at the time). The status is derived again:

CaseResult
Unpaid R1 000, credit R1 000credited, owes R0
Unpaid R1 000, credit R200sent, owes R800
Unpaid R1 000, credit R200, then R800 paidpaid
Paid R1 000, credit R200Stays paid; R200 becomes client credit
Paid R1 000, credit R1 000credited; R1 000 becomes client credit

Cash paid on an invoice is amount - amount_due - credit_applied_amount. A credit note is never counted as a payment received.

An invoice with a credit note cannot be cancelled, has its amounts, lines, number, client and date locked, stops accruing late fees, and its payments cannot be removed. Credit the remaining balance instead.

List credit notes for an invoice

GET /invoice/:id/credit_note

Returns the credit notes issued against one invoice, plus what is still left to credit. Use it to prefill a form for the next partial credit note.

curl https://api.rebill.co.za/invoice/abc123/credit_note \
  -H "Authorization: Bearer sk_your_secret_key"

Response:

{
  "credit_notes": [...],
  "remaining": 345000,
  "remaining_by_group": [
    {
      "vat_type": "standard",
      "vat_rate": 1500,
      "remaining": 345000,
      "remaining_base": 300000,
      "remaining_vat": 45000,
      "close_tolerance": 1,
      "close_tolerance_all_lines": 2,
      "open_lines": [
        { "name": "Consulting", "quantity": 3 }
      ],
      "open_lines_value": 345000
    }
  ],
  "remainder_lines": [...],
  "partial_discount": { "type": "", "value": 0 }
}
Response fieldTypeDescription
credit_notesarrayCredit notes on this invoice
remainingintegerCents still available to credit, including VAT
remaining_by_grouparrayremaining split by VAT type and rate: vat_type, vat_rate (basis points), remaining, and that split into remaining_base (excl. VAT) and remaining_vat. A credit with full: true credits exactly these figures. open_lines are the invoice lines at that rate not yet credited in full (item_id when set, name and the quantity left). open_lines_value is what they are worth at their invoice prices, before the document discount, VAT included. A partial credit whose lines at that rate take all of them in full, worth at least open_lines_value less a cent per open line, credits exactly what is left there when its value is within close_tolerance_all_lines cents of remaining; any other partial credit does so within close_tolerance cents (at most 5)
remainder_linesarrayLine items that prefill a credit note for everything that is left
partial_discountobjectThe document discount a partial credit note on this invoice carries, as type and value (basis points)

List credit notes

GET /credit_note

Returns your credit notes, oldest credit date first.

Query parameterTypeDescription
client_idstringOnly this client's credit notes
invoice_idstringOnly credit notes on this invoice
fromdateCredit date on or after this day (YYYY-MM-DD)
todateCredit date on or before this day (YYYY-MM-DD)
curl "https://api.rebill.co.za/credit_note?from=2026-10-01&to=2026-10-31" \
  -H "Authorization: Bearer sk_your_secret_key"

Response:

{
  "credit_notes": [...]
}

Get a credit note

GET /credit_note/:id

Returns one credit note object.

curl https://api.rebill.co.za/credit_note/cn_001 \
  -H "Authorization: Bearer sk_your_secret_key"

Download the PDF

GET /credit_note/:id/pdf

Returns the credit note as a PDF, using your invoice template, logo and colours. The document is titled TAX CREDIT NOTE when your account has a VAT number, otherwise CREDIT NOTE. It shows the credit note number and date, your details and the client's, the credited lines with VAT, the reason, and the invoice it refers to. It has no bank details, payment link or due date, because a credit note asks for no payment.

curl https://api.rebill.co.za/credit_note/cn_001/pdf \
  -H "Authorization: Bearer sk_your_secret_key" \
  -o CreditNote-CN-0001.pdf

Email a credit note

POST /credit_note/:id/send_email

Emails the credit note to the client, with a link to the online copy and, if your account attaches PDFs to emails, the PDF. Call it again to resend. Returns 422 Unprocessable with "Client has no email address" when the client has no email. Every send is recorded in the delivery log.

curl -X POST https://api.rebill.co.za/credit_note/cn_001/send_email \
  -H "Authorization: Bearer sk_your_secret_key"

List notifications for a credit note

GET /credit_note/:id/notification

Returns the delivery history of the emails sent for this credit note, in the same notifications and delivery shape as invoice notifications.

Public credit note links

GET /p/cn/:public_id
GET /p/cn/:public_id/pdf

The unauthenticated endpoints behind the link in the credit note email. They take the credit note's public_id, return a limited view with no internal IDs, and need no API key. If the client has a document password, add ?pw= with that password; without it the response is 401.

Webhooks

Issuing a credit note emits credit_note.issued (resource ID: the credit note) and invoice.updated. When the invoice reaches credited it also emits invoice.credited, and when the credit note settles the last cents of an invoice it emits invoice.paid. A credit note is not money received, so it never emits payment.received or invoice.payment_received. See Webhooks.

Was this article helpful?

Still need help?

Our support team is happy to help you get the most out of Rebill.

Contact support