Credit & Debit Notes
GST-compliant reversal documents. Customer credit notes offset invoices (refund / write-off scenarios). Vendor credits offset bills (purchase return / vendor refund scenarios). Both live in the same credit_notes resource — direction is set by which parent id you pass.
Credit Notes — list / get
/credit_notesList credit notes (cursor-paginated)AIBooks.creditnotes.READFilter params:
?status=DRAFT|ISSUED|APPLIED|CANCELLED?customer_id=<contact_id>— both customer + vendor?invoice_id=<id>— customer-side CNs linked to this invoice?bill_id=<id>— vendor-side CNs linked to this bill?type=customer|vendor— filter to one side
/credit_notes/{credit_note_id}Get one credit noteAIBooks.creditnotes.READCreate / update
/credit_notesCreate (auto-posts journal)AIBooks.creditnotes.CREATE/credit_notes/{credit_note_id}Update (blocked once applied)AIBooks.creditnotes.UPDATE/credit_notes/{credit_note_id}/voidVoid (posts a reversal; status → CANCELLED)AIBooks.creditnotes.UPDATECustomer-side (issued against an Invoice) and vendor-side (issued against a Bill — a purchase return) credit notes share this endpoint. The server decides stock direction (SALES_RETURN_IN vs PURCHASE_RETURN_OUT) based on the contact type and which parent id is supplied.
Create — customer-side
POST /credit_notes
{
"customer_id": "ct_acme",
"invoice_id": "inv_abc", // optional — links the CN to one invoice
"date": "2026-05-12",
"line_items": [
{ "item_id": "it_widget", "quantity": 1, "rate": 1000, "restock": true }
],
"notes": "Damaged in transit"
}Create — vendor-side (purchase return / vendor credit)
POST /credit_notes
{
"customer_id": "ct_vendor", // the vendor's contact id (legacy name)
"bill_id": "bl_xyz", // pass bill_id → vendor-side direction
"date": "2026-05-12",
"line_items": [
{ "item_id": "it_widget", "quantity": 2, "rate": 500 }
]
}Void a credit note
Voiding follows the same rule as the app: the books are corrected by a reversal, never by deleting the original entry.
- A reversal journal is posted that mirrors the credit note's entry (sales or expense, GST and the receivable or payable). The original journal stays, and the two net to zero, so the GST figures cancel as well.
- Stock the credit note moved (a sales return or a purchase return) is reversed. If that fails, the void fails and nothing changes.
- A credit note that has been applied to an invoice or bill, or refunded, is refused with
409. Reverse the application first, then void. Because only an unapplied note can be voided, the linked invoice or bill balance is never reduced by a note that is being voided. - The reversal is dated
void_date. By default that is the note's own date, so the ledger ties to the return month by month, provided the note's GST return period is not locked and the accounting period is open for that date; otherwise today. Avoid_dateearlier than the note's own date is refused with422. A date in a closed accounting period is refused with409 period.locked. - Returns already filed. A note in a GSTR-1 period recorded as filed (GSTR-3B for a vendor-side note) was reported to the government and is never voided:
409 note.gst_period_filed. Issue the counter-document instead, a debit note against the original invoice for a credit note (s.34(3)), or amend it in Table 9C. For a vendor-side note the return is GSTR-3B, filed for the note's period or any later one, and the remedy is to record the supplier's counter-note in the current period and adjust ITC in GSTR-3B Table 4. If the return is only past its due date and not recorded as filed (GSTR-1: the 11th, QRMP the 13th; GSTR-3B: the 20th, QRMP the 22nd), sendunlock: true,unlock_reason(10 or more characters) andconfirm_not_reported: true; the token's user must be an Owner or Admin, and the override is audited. Without them the answer is409 note.gst_lock_override_required. A draft was never reported, so it is cancelled without these checks. - Goods already used. If the goods the note took back into stock have since been sold or adjusted, the void is refused with
409 note.stock_consumedanddetails.blockers[](each item withreturned,on_handandshortfall). Nothing is reversed. - A note that was cancelled earlier but whose journal was never reversed is reversed once by this call.
- Voiding an already-cancelled note returns it unchanged; nothing is posted twice. One audit-log entry is written per void, with the reason.
The body is optional. Both fields are optional too.
POST /credit_notes/<cn_id>/void
{
"reason": "Raised against the wrong customer", // optional, max 500 chars
"void_date": "2026-05-20", // optional; default: the note's own date (or today if its return is locked)
"unlock": false, // optional; GST-lock override, needs the next two
"unlock_reason": "...", // 10+ characters, kept on the audit trail
"confirm_not_reported": false // confirm it was not reported in a filed GSTR-1/IFF
}Apply (knock off against the parent doc)
Creating a CN registers the credit but doesn't reduce any invoice/bill balance automatically. Use the apply endpoints to consume part or all of the credit against an open document.
/credit_notes/{credit_note_id}/apply-to-invoiceApply customer credit to an open invoiceAIBooks.creditnotes.UPDATEPOST /credit_notes/<cn_id>/apply-to-invoice
{
"invoice_id": "inv_xyz",
"amount": 5000
}
# Response — both records updated
{
"code": 0,
"message": "Credit note CN-001 applied to invoice INV-2026-0042.",
"credit_note": {
"credit_note_id": "cn_…",
"applied_amount": 5000.00,
"balance_amount": 3000.00, // remaining
"status": "ISSUED" // → APPLIED when fully consumed
},
"invoice": {
"invoice_id": "inv_xyz",
"balance": 0,
"status": "CREDIT_APPLIED",
"paid_amount": 5000.00
}
}/credit_notes/{credit_note_id}/apply-to-billApply vendor credit to an open billAIBooks.creditnotes.UPDATEPOST /credit_notes/<cn_id>/apply-to-bill
{
"bill_id": "bl_abc",
"amount": 2000
}
# Response shape is symmetric — bill balance + status updated,
# bill.vendor_credits_applied is bumped.Apply rules
- Same contact: CN and target doc must belong to the same customer / vendor. Cross-contact → 400.
- Amount caps:
amount ≤ min(cn.balance, target.balance)— over either limit returns 400 with the actual limit indetails. - Status guard:a CANCELLED CN can't be applied.
- Side mirror:partial applications update both rows'
balance/applied_amount/statusin one transaction. If the target balance hits 0, the appropriateINVOICE_PAID/BILL_PAIDwebhook fires.
Debit Notes
/debit_notesList debit notesAIBooks.debitnotes.READ/debit_notes/{debit_note_id}Get oneAIBooks.debitnotes.READ/debit_notesCreateAIBooks.debitnotes.CREATE/debit_notes/{debit_note_id}UpdateAIBooks.debitnotes.UPDATE/debit_notes/{debit_note_id}/voidVoid (posts a reversal)AIBooks.debitnotes.UPDATEVoiding a debit note
Voiding posts a mirror reversal journal: the original entry stays in the ledger and the reversal nets it, GST included, to zero. Any increase the debit note made to its linked invoice's balance is given back, and one audit entry records the reason. The note moves to CANCELLED.
The optional JSON body is { "reason": "...", "void_date": "YYYY-MM-DD" }, plus the optional GST-lock override fields unlock, unlock_reason and confirm_not_reported. void_dateis the date the reversal is posted on. It defaults to the note's own date when the note's GST return period is not locked and the accounting period is open for that date, otherwise today; a date earlier than the note's own is refused with 422.
- Applied notes are refused: a debit note with
applied_amount > 0returns 409 — reverse the application first. - Returns already filed: the same rules as for a credit note. A note in a filed GSTR-1 (GSTR-3B for a vendor-side note) is refused with
409 note.gst_period_filed: issue a credit note instead (s.34(1)) or amend it in Table 9C; for a vendor-side note, record the supplier's counter-note in the current period and adjust ITC in GSTR-3B Table 4. A due but unfiled return (GSTR-3B for a vendor-side note, due the 20th, QRMP the 22nd) needs the override, otherwise409 note.gst_lock_override_required. - Invoice balance already paid: if a receipt has consumed the balance the note added, the void is refused with
409 note.invoice_balance_insufficientanddetails.invoice_balance,details.shortfall. Unallocate the receipt, or issue a credit note. - Locked period: if
void_datefalls in a closed accounting period the void is refused with 409 and nothing is posted. Pass avoid_datein an open period. - Idempotent: voiding a note that is already cancelled and reversed returns it unchanged and posts nothing more.
Status lifecycle (both CN + DN)
DRAFT → ISSUED → APPLIED (when fully offset against AR / AP)
↓
CANCELLEDCommon patterns
Inbox-style vendor credits view
# Outstanding vendor credits for a vendor
GET /credit_notes?type=vendor&customer_id=<vendor_id>&status=ISSUEDFind vendor credits available against a bill
# Same-vendor CNs with remaining balance
GET /credit_notes?type=vendor&customer_id=<vendor_id>&status=ISSUED
# Apply each up to its balance OR the bill's outstanding
POST /credit_notes/<cn_id>/apply-to-bill { "bill_id": ..., "amount": ... }Refunding a customer in cash (instead of applying to a future invoice)
Use the internal POST /credit_notes/{id}/refund endpoint via the UI for now — public-API refunds are roadmap.