Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/tutosrive/fastapi-CRUD-MongoDB/llms.txt

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

The DELETE /users/{id} endpoint permanently removes a user document from the MongoDB local.user collection. The controller uses find_one_and_delete to atomically locate and delete the document matching the provided ObjectId. On success it returns an HTTP 204 No Content response with an empty body. If no document is found for the given id, the API raises HTTP 404 Not Found. DELETE /users/{id}

Path Parameters

id
string
required
MongoDB ObjectId (24-character hex string) identifying the user document to delete. Example: 64a1b2c3d4e5f6789abcdef0.

Example Request

curl -X DELETE http://localhost:5000/users/64a1b2c3d4e5f6789abcdef0

Example Response

A successful deletion returns HTTP 204 No Content with no response body.
The response body is intentionally empty on success (HTTP 204 No Content). No user object is returned — use GET /users/{id} before deletion if you need to capture the document’s data.

Error Responses

404 Not Found

Returned when no user document exists for the provided id.
{
  "detail": "User Not Found!"
}
Deletion is permanent. There is no soft-delete or recycle bin — once a document is removed from the collection it cannot be recovered through this API.

Build docs developers (and LLMs) love