Bills
Vendor bills (the AP side of invoices). Same shape, same auto-fill, line rates default to item.purchase_price instead of selling price.
Resource shape
{
"bill_id": "bl_xyz",
"bill_number": "BILL-2026-0017",
"vendor_id": "ct_vendor",
"vendor_name": "ACME Supplies",
"date": "2026-05-12T00:00:00",
"due_date": "2026-05-26T00:00:00",
"reference_number": "Invoice #5523",
"place_of_supply": "IN-MH",
"currency_code": "INR",
"exchange_rate": 1.0,
"line_items": [ /* same shape as invoice line_items */ ],
"sub_total": 700,
"tax_total": 126,
"total": 826,
"payment_made": 0,
"balance": 826,
"status": "DRAFT", // DRAFT | OPEN | PARTIALLY_PAID | PAID | OVERDUE
"notes": null,
"created_time": "...",
"last_modified_time": "..."
}/billsList billsAIBooks.bills.READSame query params as GET /invoices but with vendor_id instead of customer_id.
/bills/{bill_id}Get one billAIBooks.bills.READ/billsCreate a bill (DRAFT)AIBooks.bills.CREATERequired: vendor_id, date, place_of_supply, at least one line_items[]. Pass auto_approve: true to post the journal in the same call (status → OPEN).
POST /bills
Authorization: Bearer aibk_pat_…
Content-Type: application/json
{
"vendor_id": "ct_vendor",
"date": "2026-05-12T00:00:00",
"place_of_supply": "IN-MH",
"line_items": [{ "item_id": "it_widget", "quantity": 10 }],
"reference_number": "Invoice #5523",
"auto_approve": true
}/bills/{bill_id}Update header (DRAFT only)AIBooks.bills.UPDATE/bills/{bill_id}/approveApprove (DRAFT → OPEN)AIBooks.bills.UPDATE/bills/{bill_id}Delete (unposted bills only)AIBooks.bills.DELETEOnly a bill that has not been posted can be deleted: status DRAFT, REVIEW or PENDING_APPROVAL. A CANCELLED bill is refused: a cancelled bill is kept on record and cannot be deleted. Stock the bill received is reversed (on-hand returns to what it was before the bill) and the deletion is recorded in the audit log. Pass the optional reason query parameter to store why. Success returns { "code": 0, "message": "The bill has been deleted." }.
A refusal is 409 with code: bill.delete_refused and details.reason set to one of:
posted— the bill is posted (OPEN, PARTIALLY_PAID, PAID, OVERDUE, VOID). Void it, or correct it with a debit note.cancelled— a cancelled bill is kept on record and cannot be deleted.has_payments— the bill has recorded payments. Unallocate or void the payment first.asset_linked— a fixed asset booked this bill. Change it from the asset instead.stock_consumed— stock from this purchase has already been sold or adjusted.details.blockers[]lists each item withitem_id,location,purchased,on_handandshortfall.
Anti-duplicate guard
Creates with the same (vendor_id, date, total) as an existing posted bill are refused with code: validation.invalid_value. Use Idempotency-Key for retry-safety; pass a distinct reference_number to legitimately register multiple bills with the same vendor on the same day.