Delete Category
Permanently deletes a category together with all of its subcategories. The deleted categories are removed from every product they were assigned to.
HTTP Request
- URL:
/categories/{id} - Method:
DELETE - Headers:
accessToken: Required. Your API access token.
- Required scope:
READ_WRITE_CATEGORY
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | String | Required. The ID of the category to delete. |
cURL Example
curl --location --request DELETE '<BASE_URL>/categories/66acedf2bf8641f96544253b' \
--header 'accessToken: <ACCESS_TOKEN>'
Response
- 200 OK: The request was processed. Check
successto confirm the category was deleted. - 400 Bad Request: The access token is missing, invalid or lacks the required scope, or the category ID is not valid.
Sample JSON Response
{
"success": true,
"message": "Category Cordless Drills deleted successfully"
}
Response Details
| Field | Type | Description |
|---|---|---|
success | Boolean | true when the category was deleted. |
message | String | Confirmation message that includes the category name. |
Notes
- Deleting a category cannot be undone. To hide a category instead, set
isShowtofalsewith Update Category. - All subcategories under the category are deleted too. To keep a subcategory, move it to another parent with Update Category first.
- If no category matches the ID, the response has
success: falseand the messageCategory not exists!.