Get CPN
This API endpoint retrieves the details of a specific Customer Part Number (CPN) using its unique identifier.
HTTP Request
- URL:
/api/cpn/{id} - Method:
GET - Headers:
accessToken: Required. This is your access token for authenticating the request.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | String | The unique identifier of the CPN to retrieve. |
cURL Example
Below is a sample cURL command demonstrating how to make a request to this API endpoint:
curl --location '<BASE_URL>/api/cpn/<CPN_ID>' --header 'accessToken: <ACCESS_TOKEN>'
Response
- 200 OK: The request was successful, and the server returned the CPN details.
- 400 Bad Request: The
idparameter is missing or invalid. - 404 Not Found: No CPN record exists with the specified ID.
- 5XX: Server errors indicating something went wrong on the server side.
Sample JSON Response
Below is an example of the JSON response you might receive from this endpoint:
{
"success": true,
"data": {
"_id": "69021dec6f3d8d4a6ebf8dba",
"companyId": "683808ee2b054dc60961637c",
"productId": "687a84a7958d6a5c0d0c7a35",
"cpn": "testing",
"createdBy": {
"id": "69019a38743e239a3f8f8be7",
"name": "Evangeline Schmidt",
"email": "eva@gmail.com",
"type": "store"
},
"createdAt": "2025-10-29T14:00:12.567Z",
"updatedAt": "2025-10-29T14:01:17.363Z"
}
}
Response Details
| Key | Type | Description |
|---|---|---|
success | Boolean | Indicates whether the request was successful. |
data | Object | Contains the CPN details. |
Customer Part Number (CPN) Data
| Field | Type | Description |
|---|---|---|
_id | String | The unique identifier of the CPN. |
companyId | String | The unique identifier of the company associated with the CPN. |
productId | String | The product or variant ID associated with the CPN. |
cpn | String | The Customer Part Number value. |
createdBy | Object | Information about the user who created the CPN. |
createdAt | String | Date and time when the record was created (ISO 8601 format). |
updatedAt | String | Date and time when the record was last updated (ISO 8601 format). |
createdBy Object
| Field | Type | Description |
|---|---|---|
id | String | The ID of the user who created it. |
name | String | The name of the creator. |
email | String | The email of the creator. |
type | String | The creator's user type (e.g. store). |
Notes
- Ensure the
accessTokenprovided is valid and not expired. - The
idpath parameter must be a valid MongoDB ObjectId. - If no CPN exists with the provided ID, a
404 Not Foundresponse is returned.