purchases:read scope.
Pull from KRA
POST /v1/purchases/pull asks KRA for the business’s supplier invoices and stores them, branch by branch. The body
is optional.
{ "branchId": "..." } for one. Pulling again never changes an
invoice’s review status.
The response is a report of how each branch went:
status of ok or failed. A branch that failed does not stop the others, and says why in
error.
If KRA returns nothing for every branch, so that all of them fail, the call is a 502 with the code upstream_error, and the same
per-branch report is in the error body under branches. We do this on purpose: an empty success would read as
“you have no purchases”. Try again shortly.
List supplier invoices
GET /v1/purchases lists the stored invoices, newest first, a page at a time. Call the pull first to get the
latest.
GET /v1/purchases/{id} returns one invoice. Each invoice has the supplier (name, pin),
supplierInvoiceNumber, invoiceDate, branch, totals (subtotal, vat, total), its lines, and a
confirmationError if the last attempt to confirm it to KRA failed.
Read next
- Pagination: walk through a long list
- Errors & Troubleshooting: handling a
502