Skip to main content

Delete CPN

This DELETE API allows you to remove an existing Customer Part Number (CPN) record from the system using its unique identifier.

Endpoint Details

  • URL: /api/cpn/{id}
  • Method: DELETE
  • Authentication: Bearer Token (required)

Authentication

You must provide a valid accessToken in the request headers to authenticate and access this endpoint.

Authentication Headers

HeaderTypeDescription
Content-TypestringMust be set to application/json.
accessTokenstringA valid access token is required.

Path Parameters

ParameterTypeDescription
idstringThe unique identifier of the CPN to be deleted.

cURL Example

curl --location --request DELETE '<BASE_URL>/api/cpn/<CPN_ID>' --header 'accessToken: <ACCESS_TOKEN>'

Response

Success Response

Status CodeDescription
200 OKThe CPN was deleted successfully.

Sample Success Response Body

{
"success": true,
"message": "Deleted successfully"
}

Error Responses

Status CodeDescription
400 Bad RequestMissing id parameter or company is locked.
401 UnauthorizedInvalid or missing access token.
403 ForbiddenAccess denied.
404 Not FoundThe specified CPN record does not exist.
500 Internal Server ErrorAn unexpected server error occurred.

Notes

  • The id must be a valid MongoDB ObjectId.
  • If the associated company is locked, deletion will be blocked.
  • Ensure your access token has permission to delete CPNs.
  • Upon successful deletion, the CPN will also be removed from the Elasticsearch index.