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

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

    • companyId string · uuid

    • createdBy string · uuid

    • companyEntityId string · uuid

    • purchaseRequestId string · uuid

    • 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

    • description string

    • currency string

    • totalAmount integer · int64

    • totalNetAmount integer · int64

    • totalTaxAmount integer · int64

    • totalMatchedAmount integer · int64

    • ownerId string · uuid

    • ownerName string

    • vendorId string · uuid

    • vendorEmail string

    • vendorName string

    • vendorAvatarUrl string

    • documentKey string

    • failureContext object

      Failure context when vendor onboarding fails.

      • 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

    • deliveryAddress string

    • deliveryDate string · date

    • erpSyncedAt string · date-time

    • lockedAt string · date-time

    • closedAt string · date-time

    • cancelledAt string · date-time

    • createdAt string · date-time

    • updatedAt string · date-time

    • lines array of object

      • id string · uuid

      • companyId string · uuid

      • purchaseOrderId string · uuid

      • description string

      • quantity integer · int64

      • unitPrice integer · int64

      • accountId string · uuid

      • accountLabel string

      • taxCodeId string · uuid

      • amount integer · int64

      • taxAmount integer · int64

      • netAmount integer · int64

      • taxCodeLabel string

      • costCenterId string · uuid

      • costCenterName string

      • createdAt string · date-time

      • updatedAt string · date-time

  • 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)