Skip to content

GET /api/agent/purchase-orders ​

Returns the caller's org Xero purchase orders. Filterable by raw Xero status (comma-separated string match: DRAFT/SUBMITTED/AUTHORISED/BILLED/DELETED), contactId (supplier), itemCode (single code, fully case-insensitive in both directions; ANDs with the other filters and narrows totalCount/totals too), and issue-date range. Each row carries itemCodes — the distinct item codes across the PO's lines, [] when none — so callers can see which items a PO covers without drilling it. Same pagination/totals/redaction semantics as /api/agent/invoices (cursor + nextCursor, ?autoPaginate=true 5,000-row cap with truncated, ?totals=true aggregate block grouped by raw status, totalCount, sensitive-contact drop with redactedItemCount). Each PO row carries suppressedReason (nullable): when non-null the PO has been matched to a supplier bill and is excluded from the forecast to avoid double-counting the outflow. Read-only; requires the dedicated READ_PURCHASE_ORDERS scope (NOT implied by bill/invoice access).

Auth ​

  • Required scope: READ_PURCHASE_ORDERS
  • Header: Authorization: Bearer cr_live_<prefix>_<secret>

Query parameters ​

NameTypeRequiredNotes
statusstringnoComma-separated raw Xero PO statuses (e.g. AUTHORISED,BILLED). Direct string match.
contactIdstringno
itemCodestringnoSingle Xero item code. Returns only POs whose itemCodes contain it, and narrows totalCount and ?totals=true alongside the rows. Matching is fully case-insensitive: the query and the stored code are compared in lowercase, so zc-relay, ZC-RELAY and Zc-Relay all find a PO however its code is spelled in Xero — including one stored in mixed case such as TCI-DALI Supply Fit Leads. Single value only — unlike status, a comma-separated list is NOT split and will match nothing. An empty or whitespace-only value is ignored (no filter).
dateFromstringnoInclusive issue-date lower bound (YYYY-MM-DD).
dateTostringnoInclusive issue-date upper bound (YYYY-MM-DD).
cursorstringno
limitintegerno
autoPaginatebooleanno
totalsbooleanno

Responses ​

200 — Matching purchase orders. ​

Body: PurchaseOrdersResponse

FieldTypeRequiredNotes
purchaseOrdersarray of PurchaseOrderyes
nextCursorstringyes
totalCountintegeryes
redactedItemCountintegeryes
truncatedbooleanno
totalsInvoiceBillTotalsno
totalsTruncatedbooleanno
billingAlertBillingAlertno
xeroAlertXeroAlertno

401 — Unauthorized ​

Body: ErrorResponse

FieldTypeRequiredNotes
errorstringyes

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.

Released under a proprietary license. · cashrunway.ai