List Procurements

🔒

Requires read_product access scope. More access scope

The List Procurements API retrieves a list of procurement records with optional filters such as state, creation date, or update date. This API supports pagination to manage large datasets efficiently.This API is especially useful for:

  1. Fetching procurement records based on specific criteria for management or reporting.
  2. Filtering procurement records by state or date range.
  3. Managing large procurement datasets with pagination.

Note: The operation is scoped to a specific shop, identified by its unique domain prefix (shopdomain), ensuring all queries are applied to the correct store.

Public Request Parameters

Parameter NameTypeRequiredParameter LocationParameter ValueDescription
Access-TokenStringYesHeaderBx-_5aV
eXNwl-4AB98s5xLV
yg0fNzGf

MuTpqtlBA
Used to authenticate API requests. Obtain an access token from the Access Token Guide.
Pass it in the Authorization header for every request.
Content-TypeStringYesHeaderapplication
/json
Indicates the media type of the request body. It tells the server how to parse the request and
the client how to interpret the response. For more details, visit Content-Type.

Public Response Parameters

Parameter NameTypeMandatoryParameter LocationExample ValueDescription
errorStringNoResponse Body{ "error": "store is not active" }Indicates an error encountered during the process. This field typically appears when the Access Token is missing or invalid. Example: { "error": "store is not active" }.
errorsArrayNoResponse Body{ "errors"["invalid id"] }A list of errors that occurred during the request processing. Example: { "errors": [ "No Context" ] }.
Request-IdStringYesHeaderBx-_5aV
eXNwl-4AB98s5xLV
yg0fNzGf

MuTpqtlBA
A unique identifier for each request. It helps in identifying and debugging specific requests.

Error and Errors Clarification:

Added explanation that the error and errors fields are currently dependent on the API implementation, with plans for future unification.

Request Parameters

Query Parameters

ParameterTypeRequiredExampleDescription
pageint32Yes1Page number for pagination. Must be greater than 0. Default: 1.
limitint32Yes10Number of records per page. Must be greater than 0 and less than 100. Default: 10.
idsarrayNo["928374928374982734"]Array of procurement IDs to filter by. Each ID must be a valid UUID.
stateint32No1Procurement state filter. Accepted values: 1 (waiting for stock), 2 (partial receipt), 3 (complete receipt), 4 (cancelled).
created_at_minstringNo2023-01-01T00:00:00ZFilter procurements created at or after this date (ISO-8601 format).
created_at_maxstringNo2023-01-31T23:59:59ZFilter procurements created at or before this date (ISO-8601 format).
updated_at_minstringNo2023-01-01T00:00:00ZFilter procurements updated at or after this date (ISO-8601 format).
updated_at_maxstringNo2023-01-31T23:59:59ZFilter procurements updated at or before this date (ISO-8601 format).

Response Explanation

Successful Response

FieldTypeExampleDescription
countint3215Total number of procurements matching the criteria.
procurementsarrayList of procurement objects.
procurements.idstring"928374928374982734"Unique ID of the procurement.
procurements.stateint321Current state of the procurement.
procurements.supplier_idstring"382453603865993516"ID of the supplier associated with the procurement.
procurements.notestring"Procurement of electronics"Optional note added to the procurement.
procurements.created_atstring"2024-05-20T10:00:00Z"Timestamp when the procurement was created.
procurements.updated_atstring"2024-05-21T12:00:00Z"Timestamp when the procurement was last updated.

Error Response

Error responses in the API can be represented using two different fields: errors and error. Both fields provide details about issues encountered during request processing. Below is an explanation of the fields with their respective examples and descriptions.

FieldTypeExampleDescription
errorArray"error": "store is not active"Indicates an error encountered during the process.

Request Examples

curl --request GET \
     --url https://{shopdomain}.myshoplazza.com/openapi/2022-01/procurements \
     --header 'accept: application/json' \
     --header 'access-token: <YOUR_ACCESS_TOKEN>' \
     --data-urlencode 'page=1' \
     --data-urlencode 'limit=10' \
     --data-urlencode 'state=1' \
     --data-urlencode 'created_at_min=2023-01-01T00:00:00Z' \
     --data-urlencode 'created_at_max=2023-01-31T23:59:59Z'

Success Response Example

{
  "procurements": [
    {
      "id": "454492069793111015",
      "procurement_sn": "00000002",
      "supplier_id": "454466651757222887",
      "location_id": "447078705085299687",
      "note": "1123131231321231231231231231232123123123123131231231231322123",
      "state": 4,
      "pending_quantity": 0,
      "received_quantity": 0,
      "rejected_quantity": 0,
      "transfer_quantity": 0,
      "created_by": "",
      "created_at": "2024-12-06T03:49:13Z",
      "updated_at": "2024-12-06T16:14:07Z"
    },
    {
      "id": "454492025190882279",
      "procurement_sn": "00000001",
      "supplier_id": "454466651757222887",
      "location_id": "447078705085299687",
      "note": "1",
      "state": 1,
      "pending_quantity": 0,
      "received_quantity": 0,
      "rejected_quantity": 0,
      "transfer_quantity": 0,
      "created_by": "",
      "created_at": "2024-12-06T03:49:03Z",
      "updated_at": "2024-12-06T17:54:05Z"
    }
  ],
  "count": 2
}

Error Response Example

{
  "error": "Supplier not found"}
}

Error Details

Status CodeMessagePossible ReasonExample Response
400Bad RequestInvalid input format or request structure (e.g., missing required fields or incorrect data types).Bad Request
UnauthorizedThe request is missing valid authentication credentials or the credentials provided are invalid.Unauthorized
Language
Credentials
Header
URL
Click Try It! to start a request and see the response here!