Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/floriansalvi/HEIG-VD_Ocha-api/llms.txt

Use this file to discover all available pages before exploring further.

The delete product endpoint permanently removes a product from the catalogue. This action cannot be undone. Only administrators may perform deletions. On success the server returns 204 No Content with an empty body. If the product does not exist a 404 is returned, and if the id is malformed a 400 is returned without querying the database.

Endpoint

DELETE /api/v1/products/:id
This endpoint requires an admin JWT and permanently deletes the product. There is no soft-delete or undo mechanism. Requests without a valid token or without admin privileges are rejected with 401 or 403 respectively.

Request headers

Authorization
string
required
Bearer token for authentication, e.g. Bearer <JWT>.

Path parameters

id
string
required
The MongoDB ObjectId of the product to delete (e.g. 64f1c2e9a1b2c3d4e5f12345).

Response

204 No Content The product was successfully deleted. The response body is empty.

Error codes

StatusMeaning
400Invalid ID format — the supplied id is not a valid MongoDB ObjectId.
401Unauthorized — no token or an invalid token was supplied.
403Forbidden — the authenticated user does not have admin privileges.
404Product not found — no product exists with the given id.
500Internal server error — an unexpected error occurred.

Example

Request:
curl https://api.example.com/api/v1/products/64f1c2e9a1b2c3d4e5f12345 \
  --request DELETE \
  --header "Authorization: Bearer <ADMIN_JWT>"
A successful response returns HTTP 204 with no body. 404 response:
{
  "message": "Product not found"
}
400 response (invalid ID):
{
  "message": "Invalid ID format"
}

Build docs developers (and LLMs) love