Skip to main content
POST
/
api
/
reply_to_post
Reply to Post
curl --request POST \
  --url https://api.example.com/api/reply_to_post \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "post_id": 123,
  "content": "<string>"
}
'
{
  "message": "<string>"
}

Endpoint

POST /api/reply_to_post
Creates a reply to an existing post. The reply content cannot exceed 512 characters. When a reply is created, the user’s post count in their profile is incremented.

Headers

Authorization
string
required
Authentication token for the user

Request Body

post_id
integer
required
The ID of the post to reply to
content
string
required
The content of the reply. Must not be empty and cannot exceed 512 characters.

Response

message
string
Success message confirming the reply was created

Success Response

Status Code: 201 Created
{
  "message": "reply created"
}

Error Responses

Status Code: 400 Bad Request
{
  "error": "missing post_id or content"
}
Returned when post_id or content is missing from the request body.
{
  "error": "reply content cannot exceed 512 characters"
}
Returned when the content length exceeds 512 characters. Status Code: 401 Unauthorized
{
  "error": "invalid token, please re-login"
}
Returned when the Authorization header is missing.
{
  "error": "unauthorized"
}
Returned when the provided token is invalid or not found. Status Code: 404 Not Found
{
  "error": "post not found"
}
Returned when the specified post does not exist.

Example Request

curl -X POST https://api.example.com/api/reply_to_post \
  -H "Authorization: your-auth-token" \
  -H "Content-Type: application/json" \
  -d '{
    "post_id": 123,
    "content": "Great post! I totally agree with this."
  }'

Example Response

{
  "message": "reply created"
}

Behavior Notes

  • Replies increment the user’s post count in their profile statistics
  • The reply is stored in a separate replies table linked to the original post via post_id

Build docs developers (and LLMs) love