GET /api/agent/credit-notes
Returns credit notes for the caller's org — the documents /api/agent/invoices and /api/agent/bills do NOT include. ?type=customer (the DEFAULT when omitted) returns AR credit notes (Xero ACCRECCREDIT, credit we owe a customer); ?type=supplier returns AP credit notes (Xero ACCPAYCREDIT, credit a supplier owes us); ?type=all returns both. Every row carries type. Use this to verify a claimed credit: its existence, holder, balance (remainingCredit), and how much has been applied (allocatedAmount). Filterable by Xero status (raw string match), contactId, and issue-date range. Reverse lookup — ?invoiceNumber= / ?invoiceExternalId= return the credit notes applied to a given invoice, so "what credited LR-4359?" is one call instead of paging every credit note and inspecting allocations client-side. Same pagination/totals/redaction semantics as /api/agent/invoices (cursor + nextCursor, ?autoPaginate=true 5,000-row cap with truncated, ?totals=true aggregate block, totalCount, and the sensitive drop with redactedItemCount — a credit note is dropped for keys without READ_SENSITIVE when its contact is sensitive OR any of its lines is coded to a sensitive account, at least as strict as invoices and bills: line accounts are always checked, not only when lines are requested, and codes are trimmed). As on invoices, totalCount and totals are computed BEFORE that drop, so they include credit notes this key cannot see. totals / grandTotal include EVERY status (AUTHORISED, PAID, VOIDED, DELETED) unless ?status= narrows them — for "how much open credit is there?" pass ?status=AUTHORISED and read remainingCredit. Coverage caveat, and it matters most for the reverse lookup: the sync only LISTS active credits (AUTHORISED with remaining > 0). When a stored credit stops appearing there (fully applied, voided or deleted in Xero), the next complete sync re-reads it once by id and records its final status, remaining credit and allocations — so stored rows do not stay stuck at AUTHORISED. But a credit that was already fully applied before the org's first sync was never stored at all. Treat an empty reverse-lookup result as "no credit recorded", not "no credit exists". GET /api/agent/invoices?credits=true reads the same normalised allocation data from the invoice side and reports it per invoice with a total.
Auth
- Required scope:
READ_INVOICES - Header:
Authorization: Bearer cr_live_<prefix>_<secret>
Query parameters
| Name | Type | Required | Notes |
|---|---|---|---|
type | string | no | Which side to return: customer (default — AR, ACCRECCREDIT), supplier (AP, ACCPAYCREDIT) or all. Case-insensitive. Any other value is a 400 (error: "invalid_type") rather than a silent fallback. All other filters, totals, the reverse lookup and pagination apply within the chosen side(s). For supplier credits the reverse lookup's invoiceNumber is the BILL number. |
status | string | no | Comma-separated raw Xero credit-note statuses (e.g. AUTHORISED). Direct string match. |
contactId | string | no | |
invoiceNumber | string | no | REVERSE LOOKUP — returns only credit notes with an allocation against this invoice number (e.g. LR-4359), answering "what credited this invoice?" in one call. Exact match, no wildcards; store invoice numbers in their full Xero form (00007717, not 7717). ANDs with the other filters and narrows totalCount / ?totals=true alongside the rows. Combine with invoiceExternalId and they compose as OR, not AND — they name the same invoice by different keys and Xero populates either, both, or neither per allocation. If you already hold the invoice, GET /api/agent/invoices?credits=true answers the same question from the other side and also gives you the total credited. |
invoiceExternalId | string | no | REVERSE LOOKUP by Xero InvoiceID (GUID) instead of invoice number — the invoice's externalId on /api/agent/invoices. See invoiceNumber; the two compose as OR. |
dateFrom | string | no | Inclusive issue-date lower bound (YYYY-MM-DD). |
dateTo | string | no | Inclusive issue-date upper bound (YYYY-MM-DD). |
cursor | string | no | |
limit | integer | no | |
autoPaginate | boolean | no | |
totals | boolean | no |
Responses
200 — Matching credit notes of the requested side(s).
Body: CreditNotesResponse
| Field | Type | Required | Notes |
|---|---|---|---|
creditNotes | array of CreditNote | yes | |
nextCursor | string | yes | |
totalCount | integer | yes | |
redactedItemCount | integer | yes | |
truncated | boolean | no | |
totals | InvoiceBillTotals | no | |
totalsTruncated | boolean | no | |
billingAlert | BillingAlert | no | |
xeroAlert | XeroAlert | no |
400 — Invalid type — must be one of customer, supplier, all (error: "invalid_type").
Body: ErrorResponse
| Field | Type | Required | Notes |
|---|---|---|---|
error | string | yes |
401 — Unauthorized
Body: ErrorResponse
| Field | Type | Required | Notes |
|---|---|---|---|
error | string | yes |
429 — Rate-limited (per-minute burst) or query credits exhausted. Credits return individually on a rolling 5h window — retry after Retry-After seconds for one more call.
Body:
any
Response headers
Every successful response carries X-CashRunway-Subscription, X-CashRunway-Plan, X-CashRunway-Quota-Remaining, and X-CashRunway-Quota-Reset. Trialing subscriptions also include X-CashRunway-Trial-Days-Remaining. See the overview for details.