Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/pvnm4/Social-Media-Backend/llms.txt

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

The DELETE /posts/{id} endpoint permanently removes a post from the database along with all of its associated votes via cascade deletion. This action is irreversible — once deleted, the post and its vote history cannot be recovered. Only the user who created the post is permitted to delete it; any other authenticated user who attempts to do so will receive a 403 Forbidden response.

Endpoint

DELETE /posts/{id}
Authentication required — include a Bearer token in the Authorization header.

Path Parameters

id
integer
required
The unique numeric identifier of the post to delete.

Response

HTTP 204 No Content — The post was successfully deleted. The response body is empty.

Error Responses

Status CodeDescription
401 UnauthorizedNo token was provided or the token is invalid/expired.
403 ForbiddenThe authenticated user is not the owner of this post.
404 Not FoundNo post with the specified id exists. Message: "Post with the id:{id} was not found".

Examples

# Delete post with ID 42
curl -X DELETE http://localhost:8000/posts/42 \
  -H "Authorization: Bearer TOKEN"

# Check the response status (expect 204)
curl -o /dev/null -s -w "%{http_code}\n" \
  -X DELETE http://localhost:8000/posts/42 \
  -H "Authorization: Bearer TOKEN"

404 Not Found Response Example

{
  "detail": "Post with the id:42 was not found"
}
Deletion is permanent and cannot be undone. All votes associated with the post are cascade-deleted along with it. Ensure you have confirmed the correct id before making this request.

Build docs developers (and LLMs) love