Light APIv1.0.0

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

  • sort string

    Sort 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.

  • filter string

    Filter 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 in and not_in operators, provide multiple values separated by the pipe character (|).

    Available fields: purchaseOrderId, vendorId, ownerId, state, erpNumber, updatedAt.

  • limit integer · int32

    Maximum number of items to return. Default is 50, maximum is 200.

  • offset integer · int64deprecated

    Number of items to skip before starting to collect the result set. Deprecated, use 'cursor' instead.

  • cursor string

    The cursor position to start returning results from. To opt-in into cursor-based pagination, provide 0 for the initial request. For subsequent requests, use nextCursor and prevCursor from the previous response to navigate. Cursor values are opaque and should not be constructed manually.

Response

  • records array of object

    List of records for the current page

    • id string · uuid

      The purchase order id.

    • companyId string · uuid

      Your company id.

    • createdBy string · uuid

      The principal that created the order.

    • companyEntityId string · uuid

      The entity the order belongs to.

    • purchaseRequestId string · uuid

      The purchase request the order was raised from, if any.

    • state string

      ⚠️ This enum is not exhaustive; new values may be added in the future.

      One of IN_DRAFT RESET_PENDING APPROVED_ACCOUNTING_ENTRY_PENDING OPEN CLOSE_PENDING CLOSED CANCEL_PENDING CANCELLED

    • erpNumber string

      The purchase order number shown to the vendor and printed on the order; assigned when the order is opened.

    • description string

      The order description.

    • currency string

      The order currency.

    • totalAmount integer · int64

      Gross total of the lines, minor units.

    • totalNetAmount integer · int64

      Total excluding tax, minor units.

    • totalTaxAmount integer · int64

      Total tax, minor units.

    • totalMatchedAmount integer · int64

      Amount of bills matched to this order so far, minor units.

    • ownerId string · uuid

      The person responsible for the order.

    • ownerName string

      Their name.

    • vendorId string · uuid

      The vendor the order is placed with.

    • vendorEmail string

      The vendor's email address.

    • vendorName string

      The vendor's name.

    • vendorAvatarUrl string

      Logo URL.

    • documentKey string

      Storage key of the order PDF. Download it through the order's document endpoint, not with this key.

    • failureContext object

      Failure context when vendor onboarding fails.

      The error of the last failed step, if any.

      • name string

        The error name

      • type string

        The error type

        ⚠️ This enum is not exhaustive; new values may be added in the future.

        One of BAD_REQUEST UNAUTHORIZED FORBIDDEN NOT_FOUND CONFLICT UNPROCESSABLE_CONTENT

      • errors array of object

        List of errors providing details about what went wrong

        • type string

          A string code identifying the error type

        • message string

          A human-readable message providing more details about the error

        • path array of string

          Optional 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

        • context object

          Optional context providing additional information about the error. This can include any relevant data that might help in understanding or resolving the error

    • purchaseOrderDate string · date

      The order date.

    • deliveryAddress string

      Where the goods or services are to be delivered.

    • deliveryDate string · date

      Expected delivery date.

    • erpSyncedAt string · date-time

    • lockedAt string · date-time

      When the order was locked against edits with the lock action; null while editable.

    • closedAt string · date-time

      When the order was closed; null while open.

    • cancelledAt string · date-time

      When the order was cancelled; null otherwise.

    • createdAt string · date-time

      When the order was created.

    • updatedAt string · date-time

      When it was last changed.

    • lines array of object

      The order lines.

      • id string · uuid

        The line id.

      • companyId string · uuid

        Your company id.

      • purchaseOrderId string · uuid

        The order the line belongs to.

      • description string

        The line description.

      • quantity integer · int64

        Quantity ordered.

      • unitPrice integer · int64

        Price per unit, minor units.

      • accountId string · uuid

        The expense account for the line.

      • accountLabel string

        Its name.

      • taxCodeId string · uuid

        The tax code on the line.

      • amount integer · int64

        Gross line amount, minor units.

      • taxAmount integer · int64

        Tax on the line, minor units.

      • netAmount integer · int64

        Line amount excluding tax, minor units.

      • taxCodeLabel string

        The tax code's name.

      • costCenterId string · uuid

        Cost center on the line.

      • costCenterName string

        Its name.

      • createdAt string · date-time

        When the line was created.

      • updatedAt string · date-time

        When it was last changed.

  • hasMore boolean

    Boolean flag indicating if there are more records available

  • total integer · int64deprecated

    Total 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.

  • nextCursor string

    Cursor for fetching the next page (only for cursor pagination)

  • prevCursor string

    Cursor for fetching the previous page (only for cursor pagination)