Get All CPNs
Retrieves a list of customer part numbers (CPNs) with pagination. A CPN is a company's own code for one of your products or variants. You can filter by company, search by part number and sort the results.
HTTP Request
- URL:
/cpn - Method:
GET - Headers:
accessToken: Required. Your API access token.
- Required scope:
READ_CUSTOMERPARTNUMBERorREAD_WRITE_CUSTOMERPARTNUMBER
Query Parameters
| Parameter | Type | Description |
|---|---|---|
page | Integer | Page number to retrieve. Default is 1. |
limit | Integer | Number of CPNs per page, from 1 to 200. Default is 50. |
companyId | String | Filter by company ID. |
search | String | Search by part number (partial, case-insensitive match). |
sortBy | String | Field to sort by: createdAt, updatedAt, cpn or productId. Default is createdAt. |
sortOrder | String | asc for ascending or desc for descending. Default is desc. |
cURL Example
curl --location '<BASE_URL>/cpn?companyId=683808ee2b054dc60961637c&search=ACME&sortBy=cpn&sortOrder=asc&page=1&limit=50' \
--header 'accessToken: <ACCESS_TOKEN>'
Response
- 200 OK: The list of CPNs was returned successfully.
- 400 Bad Request: The access token is missing or invalid, the token does not have the required scope, or a query parameter is invalid.
Sample JSON Response
{
"success": true,
"data": [
{
"_id": "69021dec6f3d8d4a6ebf8dba",
"companyId": "683808ee2b054dc60961637c",
"productId": "687a84a7958d6a5c0d0c7a35",
"cpn": "ACME-VLV-0042",
"createdBy": {
"id": "66a0f138a8323b0b86b0f1dc",
"name": "ERP Connector",
"type": "api"
},
"createdAt": "2025-10-29T14:02:52.118Z",
"updatedAt": "2025-10-29T14:02:52.118Z"
}
],
"pagination": {
"total": 1,
"page": 1,
"limit": 50,
"pages": 1
}
}
Response Details
CPN Data
| Field | Type | Description |
|---|---|---|
_id | String | Unique identifier of the CPN. |
companyId | String | ID of the company the CPN belongs to. |
productId | String | ID of the product or variant the CPN refers to. |
cpn | String | The customer part number. |
createdBy | Object | Who created the CPN: id, name and type (for example api or admin). |
createdAt | String | Date and time the CPN was created (ISO 8601). |
updatedAt | String | Date and time the CPN was last updated (ISO 8601). |
Pagination Details
| Field | Type | Description |
|---|---|---|
total | Integer | Total number of CPNs that match the filters. |
page | Integer | Current page number. |
limit | Integer | Number of CPNs per page. |
pages | Integer | Total number of pages. |
Notes
- Only the query parameters listed above are accepted.