status: where the bill is in its document lifecycle (draft, approval, approved).paymentStatus: how far the money has moved.
approved with paymentStatus: "none" (approved, not yet paid) or approved with paymentStatus: "processing" (approved, payment on its way). Check both.
Invoices the business sends to its own customers are a separate resource. See Invoices.
Document status
The usual path is
draft, then pending_approval, then approved. Depending on the business’s approval rules, a submitted bill can be approved without a person acting.
Payment status
Cleo adds values over time. Treat a value you do not know as “in progress”.
Linking the vendor
You name the vendor in one of two ways when you create a bill. Send exactly one.
Use
contactId whenever you want the bill to be paid. Find the id with GET /v1/contacts, or create the contact first with POST /v1/contacts.
From bill to payment
- Create the bill with
contactIdandsubmit: true. Or create a draft and callPOST /v1/payables/{payableId}/submitlater. - The bill enters the business’s approval flow, the same flow as a bill submitted in the Cleo web app.
- Once it is
approved, pay it withPOST /v1/paymentsandpayableId.
name, a quantity above 0 and a unitAmountCents of at least 1.
A bill that is not approved yet answers validation_error when you try to pay it. A bill with additional approvers who have not acted answers approval_required.
Approve and flag
A key withpayables:approve can act on a bill waiting for approval, without being able to pay it:
POST /v1/payables/{payableId}/approverecords the key member’s approval at the current step. Send the bill’stotalAmountCents,vendorKeyandcustomNumberas you read them, asexpectedTotalAmountCents,expectedVendorKeyandexpectedCustomNumber. A bill whose total, vendor or bill number changed since answers409 payable_changed. Approving never pays.POST /v1/payables/{payableId}/flagsputs a note on the bill saying what does not match. The bill keeps its status. Flags come back inflagsonGET /v1/payables/{payableId}, newest first, and show as Flagged in the bill’s activity in Cleo.
paymentStatus=unpaid to GET /v1/payables.
Identifiers
Amounts and dates
Timestamps
Both are ISO 8601 times and appear on every bill, in the list too.
updatedAt moves when someone, an automation or an accounting sync changes the bill’s own fields, its line items, its custom field answers, its categories, its tags or its attachments. It also moves when the bill’s status changes, and when a payment changes the amounts paid on it. To read only the bills that changed, pass it back as updatedSince on GET /v1/payables. See Sync bills and payments.
Some changes alter what the API returns for many bills without moving their updatedAt:
- renaming or archiving a category;
- renaming a tag;
- relabelling a custom field or one of its options;
- renaming a contact.
updatedAt either. Read flags from GET /v1/payables/{payableId}.
A bill’s paymentStatus comes from its payments. To follow payment progress, poll GET /v1/payments with updatedSince as well.
Category, tags and custom fields
These appear on every bill, in the list too.
The shape of
value depends on the field’s type. A dropdown answer carries the option’s optionId and the externalId you gave it, so it maps back to your own records even after a rename. See Custom fields.
POST /v1/payables does not take a category or tags. It takes custom field answers in customFields, on the bill and on each line item, and POST /v1/payables/{payableId}/submit can add or replace them before it submits. A bill created with submit: true, and every submit, must answer the business’s required bill-level fields, or the call fails with 422 validation_error. See Write answers and Required fields.
Line items
Items appear onGET /v1/payables/{payableId} and on the create and submit responses. The list endpoint adds them only when you send expand=items. See Include line items.
Files
GET /v1/payables/{payableId} and the create and submit responses list the files on the bill in attachments, oldest first. The list endpoint leaves them out.
You see a file when it is shared with both sides of the bill, or when your business attached it. A file the other party attached for its own records only is left out.
Two calls return a signed link, valid for 15 minutes, as
{ url, expiresAt }:
Both need
payables:read. Anyone who holds a link can download the file until it expires. Request a new link each time you need one.
Example
Events
Payables sendpayable.created, payable.updated, payable.approved, payable.declined, payable.cancelled, payable.payment.scheduled, payable.payment.partially_paid, payable.paid and payable.payment.failed. payable.updated is sent when one bill’s content is edited. See Webhooks.
Payable events go to the business that created the bill and, when another business pays it, to the payer too. A bill a vendor sends you reaches your endpoints.