Skip to main content

Create Reply

Authentication

This endpoint requires user authentication.

Path Parameters

string
required
The unique identifier of the post to reply to

Request Body

string
required
Reply content (1-3000 characters, will be trimmed)

Response

boolean
Indicates whether the reply was created successfully
object
The newly created reply object
string
Error message if success is false

Code Examples

Response Example

Success
Post Not Found
Missing Content

Toggle Reply Upvote

Authentication

This endpoint requires user authentication.

Path Parameters

string
required
The unique identifier of the post
string
required
The unique identifier of the reply

Response

boolean
Indicates whether the operation was successful
number
Updated upvote count
boolean
New upvote status (true if upvoted, false if removed)
string
Error message if success is false

Code Examples

Response Example

Upvoted
Removed Upvote
Reply Not Found

Accept Answer

Authentication

This endpoint requires user authentication. Only the post author can accept answers.

Path Parameters

string
required
The unique identifier of the post
string
required
The unique identifier of the reply to accept

Response

boolean
Indicates whether the operation was successful
boolean
New acceptance status (true if accepted)
boolean
Whether the post is now marked as resolved
string
Error message if success is false

Code Examples

Response Example

Answer Accepted
Not Post Author
Reply Not Found

Behavior Notes

Reply Creation

  • Reply content is limited to 3000 characters and will be trimmed
  • Creating a reply increments the post’s replyCount
  • The reply author’s name and image are automatically fetched from the user profile

Upvoting Replies

  • Upvoting is a toggle action - calling the endpoint again removes the upvote
  • Users can upvote their own replies
  • The response includes the updated upvote count and the user’s new upvote status

Accepting Answers

  • Only the post author can accept answers
  • Only one reply can be accepted at a time per post
  • Accepting a reply automatically marks the post as resolved
  • Calling the endpoint on an already-accepted reply unaccepts it (toggles)
  • When a reply is accepted, all other replies on that post are automatically unaccepted
  • Accepted answers appear first when retrieving replies (sorted by isAcceptedAnswer: true first)

Reply Sorting

When fetching a post with replies (via GET /api/community/posts/:postId):
  1. Accepted answer appears first (if any)
  2. Other replies sorted by creation date (oldest first)

Permissions

Error Responses

All endpoints return consistent error formats:
Authentication Required
Not Authorized
Server Error