List Suppliers
This endpoint returns a page of suppliers for the authenticated account.
Endpoint
Section titled “Endpoint”GET /v1/suppliers/suppliersAuthentication
Section titled “Authentication”Include your API key in the x-api-key header. See Authentication.
Required Scope
Section titled “Required Scope”suppliers:readQuery Parameters
Section titled “Query Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
archived | "true" | "false" | No | When "true", return only archived suppliers. Any other value returns only active suppliers. Defaults to active suppliers. |
all | "true" | "false" | No | When "true", return archived and active suppliers together. archived is then ignored. |
page | number | No | Zero-based page index. Defaults to 0. |
pageSize | number | No | Number of suppliers per page. Defaults to 25. |
sortCol | "supplierName" | "supplierDescription" | "createdAt" | "updatedAt" | No | Sort column. Must be sent with a valid sortDir. |
sortDir | "asc" | "desc" | No | Sort direction. Must be sent with a valid sortCol. |
See Pagination for paging and sorting rules.
Request Body
Section titled “Request Body”This endpoint does not accept a request body.
Example Request
Section titled “Example Request”curl "https://api.crewsum.com/v1/suppliers/suppliers?page=0&pageSize=25&sortCol=supplierName&sortDir=asc" \ -H "x-api-key: $CREWSUM_API_KEY"const response = await fetch( "https://api.crewsum.com/v1/suppliers/suppliers?page=0&pageSize=25&sortCol=supplierName&sortDir=asc", { headers: { "x-api-key": process.env.CREWSUM_API_KEY }, },);const result = await response.json();GET /v1/suppliers/suppliers?page=0&pageSize=25&sortCol=supplierName&sortDir=asc HTTP/1.1Host: api.crewsum.comx-api-key: <your-api-key>Response
Section titled “Response”On success, the API returns HTTP 200 OK.
Example Response
Section titled “Example Response”{ "message": "Successfully fetched suppliers", "data": { "suppliers": [ { "id": "supplier-stu123vwx4567890", "name": "Supplier Name", "description": "A brief description of the supplier", "isArchived": false, "createdAt": "2023-01-01T00:00:00.000Z", "updatedAt": null, "isDeleted": false } ], "count": 1 }}Behavior
Section titled “Behavior”countis the total number of matching suppliers, not the number on this page.- Deleted suppliers are never returned, even with
all=true. - If
sortColorsortDiris missing or invalid, the API ignores both and sorts byupdatedAtdescending, thencreatedAtdescending. updatedAtisnulluntil the supplier is updated for the first time.
Error Responses
Section titled “Error Responses”| Status | Meaning |
|---|---|
500 | Crewsum could not fetch suppliers. Message: Error fetching suppliers. |
Authentication and scope failures are described in Errors.
Related Webhooks
Section titled “Related Webhooks”This endpoint does not trigger a webhook.