Skip to main content

Update CPN

Changes the part number of an existing customer part number (CPN).

HTTP Request​

  • URL: /cpn/{id}
  • Method: PUT
  • Headers:
    • accessToken: Required. Your API access token.
    • Content-Type: application/json
  • Required scope: READ_CUSTOMERPARTNUMBER or READ_WRITE_CUSTOMERPARTNUMBER

Path Parameters​

ParameterTypeDescription
idStringRequired. The ID of the CPN to update.

Request Body​

The request body is a JSON object with the following field:

FieldTypeRequiredDescription
cpnStringYesThe new customer part number.

cURL Example​

curl --location --request PUT '<BASE_URL>/cpn/69021dec6f3d8d4a6ebf8dba' \
--header 'accessToken: <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"cpn": "ACME-VLV-0042-B"
}'

Response​

  • 200 OK: The CPN was updated successfully.
  • 400 Bad Request: The access token is missing or invalid, the token does not have the required scope, cpn is missing, or the ID is not valid.
  • 404 Not Found: No CPN matches the ID.

Sample JSON Response​

{
"success": true,
"message": "Updated successfully",
"data": {
"_id": "69021dec6f3d8d4a6ebf8dba",
"companyId": "683808ee2b054dc60961637c",
"productId": "687a84a7958d6a5c0d0c7a35",
"cpn": "ACME-VLV-0042-B",
"createdBy": {
"id": "66a0f138a8323b0b86b0f1dc",
"name": "ERP Connector",
"type": "api"
},
"createdAt": "2025-10-29T14:02:52.118Z",
"updatedAt": "2025-11-03T09:47:10.552Z"
}
}

Response Details​

FieldTypeDescription
successBooleanWhether the CPN was updated.
messageStringResult message.
dataObjectThe updated CPN. The fields are the same as in Get All CPNs.

Notes​

  • The company and product of a CPN cannot be changed. To move a part number to another product, delete the CPN and create a new one.