API / Reference / Purchase Orders
List purchase orders
GET
https://api.light.inc/v1/purchase-orders
Returns a paginated list of purchase orders
Guarded by the create permission (company-admin or AP-preparation roles), so a purchase-requester or auditor who can read a single order gets 403 on the list. List rows are a different shape from the single read: they add vendorName, ownerName, totalMatchedAmount and line labels, and lack editStatus and customProperties. No searchTerm.
Authorization
Send one of these on every request. See Authentication for how to get credentials.
- API key
Basic authentication header of the form Basic <api_key>, where <api_key> is your api key.
- Bearer token
Query parameters
-
sortstringSort string in the format
field:direction. To provide multiple sort fields, separate them with commas.Available directions:
asc,desc.Available fields:
purchaseOrderId,erpNumber,vendorName,ownerName,ownerId,companyEntityId,state,closedAt,cancelledAt,createdAt,totalAmount. -
filterstringFilter string in the format
field:operator:value. To provide multiple filters, separate them with commas.Available operators:
eq,ne,in,not_in,gt,gte,lt,lte.- For
inandnot_inoperators, provide multiple values separated by the pipe character (|).
Available fields:
purchaseOrderId,vendorId,ownerId,state,erpNumber,updatedAt. - For
-
limitinteger · int32Maximum number of items to return. Default is 50, maximum is 200.
-
offsetinteger · int64deprecatedNumber of items to skip before starting to collect the result set. Deprecated, use 'cursor' instead.
-
cursorstringThe cursor position to start returning results from. To opt-in into cursor-based pagination, provide
0for the initial request. For subsequent requests, usenextCursorandprevCursorfrom the previous response to navigate. Cursor values are opaque and should not be constructed manually.
Response
-
recordsarray of objectList of records for the current page
-
idstring · uuidThe purchase order id.
-
companyIdstring · uuidYour company id.
-
createdBystring · uuidThe principal that created the order.
-
companyEntityIdstring · uuidThe entity the order belongs to.
-
purchaseRequestIdstring · uuidThe purchase request the order was raised from, if any.
-
statestring⚠️ This enum is not exhaustive; new values may be added in the future.
One of
IN_DRAFTRESET_PENDINGAPPROVED_ACCOUNTING_ENTRY_PENDINGOPENCLOSE_PENDINGCLOSEDCANCEL_PENDINGCANCELLED -
erpNumberstringThe purchase order number shown to the vendor and printed on the order; assigned when the order is opened.
-
descriptionstringThe order description.
-
currencystringThe order currency.
-
totalAmountinteger · int64Gross total of the lines, minor units.
-
totalNetAmountinteger · int64Total excluding tax, minor units.
-
totalTaxAmountinteger · int64Total tax, minor units.
-
totalMatchedAmountinteger · int64Amount of bills matched to this order so far, minor units.
-
ownerIdstring · uuidThe person responsible for the order.
-
ownerNamestringTheir name.
-
vendorIdstring · uuidThe vendor the order is placed with.
-
vendorEmailstringThe vendor's email address.
-
vendorNamestringThe vendor's name.
-
vendorAvatarUrlstringLogo URL.
-
documentKeystringStorage key of the order PDF. Download it through the order's document endpoint, not with this key.
-
failureContextobjectFailure context when vendor onboarding fails.
The error of the last failed step, if any.
-
namestringThe error name
-
typestringThe error type
⚠️ This enum is not exhaustive; new values may be added in the future.
One of
BAD_REQUESTUNAUTHORIZEDFORBIDDENNOT_FOUNDCONFLICTUNPROCESSABLE_CONTENT -
errorsarray of objectList of errors providing details about what went wrong
-
typestringA string code identifying the error type
-
messagestringA human-readable message providing more details about the error
-
patharray of stringOptional path of the error when the error is for a specific field. Used mostly on BAD_REQUEST errors, that path will match the field name on the request object
-
contextobjectOptional context providing additional information about the error. This can include any relevant data that might help in understanding or resolving the error
-
-
-
purchaseOrderDatestring · dateThe order date.
-
deliveryAddressstringWhere the goods or services are to be delivered.
-
deliveryDatestring · dateExpected delivery date.
-
erpSyncedAtstring · date-time -
lockedAtstring · date-timeWhen the order was locked against edits with the lock action;
nullwhile editable. -
closedAtstring · date-timeWhen the order was closed;
nullwhile open. -
cancelledAtstring · date-timeWhen the order was cancelled;
nullotherwise. -
createdAtstring · date-timeWhen the order was created.
-
updatedAtstring · date-timeWhen it was last changed.
-
linesarray of objectThe order lines.
-
idstring · uuidThe line id.
-
companyIdstring · uuidYour company id.
-
purchaseOrderIdstring · uuidThe order the line belongs to.
-
descriptionstringThe line description.
-
quantityinteger · int64Quantity ordered.
-
unitPriceinteger · int64Price per unit, minor units.
-
accountIdstring · uuidThe expense account for the line.
-
accountLabelstringIts name.
-
taxCodeIdstring · uuidThe tax code on the line.
-
amountinteger · int64Gross line amount, minor units.
-
taxAmountinteger · int64Tax on the line, minor units.
-
netAmountinteger · int64Line amount excluding tax, minor units.
-
taxCodeLabelstringThe tax code's name.
-
costCenterIdstring · uuidCost center on the line.
-
costCenterNamestringIts name.
-
createdAtstring · date-timeWhen the line was created.
-
updatedAtstring · date-timeWhen it was last changed.
-
-
-
hasMorebooleanBoolean flag indicating if there are more records available
-
totalinteger · int64deprecatedTotal number of records (only for offset pagination). This field is not guaranteed to be returned and only available for offset pagination, please do not rely on it and migrate to cursor pagination.
-
nextCursorstringCursor for fetching the next page (only for cursor pagination)
-
prevCursorstringCursor for fetching the previous page (only for cursor pagination)