Skip to main content
Deletes a comment using a soft delete mechanism. Only the comment owner can delete their comment.

Endpoint

DELETE /api/posts/{id}/comment

Authentication

Required. User must be the comment owner to delete the comment.

Path Parameters

id
integer
required
The unique identifier of the post containing the comment (PostID)

Request Body

userName
string
required
The username of the authenticated user who owns the comment to delete

Behavior

  • Sets the isDeleted flag to true
  • Sets the DeletedAt timestamp
  • Only the comment owner can delete their own comment
  • Prevents deleting comments on posts from blocked accounts

Request

curl -X DELETE https://api.example.com/api/posts/12345/comment \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "userName": "johndoe"
  }'

Response

status
integer
204 No Content - Comment deleted successfully
204 No Content

Errors

404
error
Account does not exist or action cannot be completed due to a block
409
error
Comment does not exist
{
  "error": "This comment does not exist"
}

Build docs developers (and LLMs) love