Overview
Discussions provide threaded commenting on stories and profiles. Comments support nested replies (up to 6 levels deep), voting, and moderation.
Discussion Features
Nested Threads
Up to 6 levels of nested replies
Voting
Upvote and downvote comments
Moderation
Hide, pin, and lock threads (contributor+ only)
Real-time
Live comment updates
GET /{locale}/stories/{slug}/_discussions
List top-level comments for a story’s discussion thread.
Sort mode: hot, newest, oldest
Number of comments per page (max 100)
Number of comments to skip
curl "http://localhost:8080/en/stories/introducing-aya/_discussions?sort=hot&limit=10"
Response:
{
"data": {
"thread": {
"id": "01ARZ3NDEKTSV4RRFFQ69G5FAV",
"story_id": "01ARZ3NDEKTSV4RRFFQ69G5FAW",
"is_locked": false,
"comment_count": 42,
"created_at": "2024-01-15T10:30:00Z"
},
"comments": [
{
"id": "01ARZ3NDEKTSV4RRFFQ69G5FAX",
"thread_id": "01ARZ3NDEKTSV4RRFFQ69G5FAV",
"parent_id": null,
"author_profile_id": "01ARZ3NDEKTSV4RRFFQ69G5FAY",
"author_profile_slug": "john-doe",
"author_profile_title": "John Doe",
"author_profile_picture_uri": "https://avatars.githubusercontent.com/u/12345",
"content": "Great article! Looking forward to trying this out.",
"depth": 0,
"vote_score": 15,
"upvote_count": 17,
"downvote_count": 2,
"reply_count": 3,
"is_pinned": false,
"is_hidden": false,
"is_edited": false,
"viewer_vote_direction": 1,
"created_at": "2024-01-15T11:00:00Z"
}
]
},
"error": null
}
Whether new comments are disabled
Total comment count (including nested)
Net vote score (upvotes - downvotes)
Current user’s vote: 1 (upvote), -1 (downvote), 0 (no vote)
Nesting depth (0 = top-level, max 6)
GET /{locale}/profiles/{slug}/_discussions
List top-level comments for a profile’s discussion thread. Same parameters and response format as story discussions.
GET /{locale}/discussions/comments/{commentId}/replies
List replies to a specific comment.
Sort mode: hot, newest, oldest
Number of replies per page
curl "http://localhost:8080/en/discussions/comments/01ARZ3NDEKTSV4RRFFQ69G5FAX/replies"
Response:
{
"data": {
"comments": [
{
"id": "01ARZ3NDEKTSV4RRFFQ69G5FAZ",
"parent_id": "01ARZ3NDEKTSV4RRFFQ69G5FAX",
"content": "Thanks! Let me know what you think.",
"depth": 1,
"vote_score": 5,
"reply_count": 0
}
]
}
}
POST /{locale}/stories/{slug}/_discussions
POST /{locale}/profiles/{slug}/_discussions
Create a new comment on a story or profile discussion.
Comment content (3-10,000 characters)
Parent comment ID for replies (omit for top-level)
curl -X POST "http://localhost:8080/en/stories/introducing-aya/_discussions" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"content": "Great article! Looking forward to trying this out."
}'
Response:
{
"data": {
"id": "01ARZ3NDEKTSV4RRFFQ69G5FAX",
"thread_id": "01ARZ3NDEKTSV4RRFFQ69G5FAV",
"parent_id": null,
"author_profile_id": "01ARZ3NDEKTSV4RRFFQ69G5FAY",
"author_profile_slug": "john-doe",
"author_profile_title": "John Doe",
"content": "Great article! Looking forward to trying this out.",
"depth": 0,
"vote_score": 0,
"upvote_count": 0,
"downvote_count": 0,
"reply_count": 0,
"viewer_vote_direction": 0,
"created_at": "2024-03-07T10:30:00Z"
}
}
Nesting LimitComments can be nested up to 6 levels deep. Attempting to reply beyond this depth will return a 400 error.
Thread LockedIf the discussion thread is locked, the API will return a 403 error. Only contributors+ can lock/unlock threads.
PUT /{locale}/discussions/comments/{commentId}
Authentication Required - Must be comment author
Edit your own comment.
New comment content (3-10,000 characters)
curl -X PUT "http://localhost:8080/en/discussions/comments/01ARZ3NDEKTSV4RRFFQ69G5FAX" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"content": "Updated comment text"}'
Response:
{
"data": {
"status": "ok"
}
}
DELETE /{locale}/discussions/comments/{commentId}
Authentication Required - Must be comment author or contributor+
Delete a comment. Authors can delete their own comments; contributors+ can delete any comment.
Profile slug (required for contributor+ deletion to verify permissions)
curl -X DELETE "http://localhost:8080/en/discussions/comments/01ARZ3NDEKTSV4RRFFQ69G5FAX?profile_slug=my-profile" \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
POST /{locale}/discussions/comments/{commentId}/vote
Upvote or downvote a comment. Voting again with the same direction removes the vote.
Vote direction: 1 (upvote) or -1 (downvote)
curl -X POST "http://localhost:8080/en/discussions/comments/01ARZ3NDEKTSV4RRFFQ69G5FAX/vote" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"direction": 1}'
Response:
{
"data": {
"vote_score": 16,
"viewer_vote_direction": 1
}
}
New net vote score (upvotes - downvotes)
Your current vote: 1, -1, or 0 (removed)
Toggle VotingVoting with the same direction again removes your vote:
- First upvote: direction = 1
- Second upvote: direction = 0 (vote removed)
POST /{locale}/discussions/comments/{commentId}/hide
Authentication Required - Requires contributor+ access
Hide or unhide a comment. Hidden comments are only visible to contributors+.
Profile slug to check permissions
curl -X POST "http://localhost:8080/en/discussions/comments/01ARZ3NDEKTSV4RRFFQ69G5FAX/hide" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"is_hidden": true, "profile_slug": "my-profile"}'
POST /{locale}/discussions/comments/{commentId}/pin
Authentication Required - Requires contributor+ access
Pin or unpin a comment to the top of the discussion.
Profile slug to check permissions
curl -X POST "http://localhost:8080/en/discussions/comments/01ARZ3NDEKTSV4RRFFQ69G5FAX/pin" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"is_pinned": true, "profile_slug": "my-profile"}'
Lock/Unlock Thread
POST /{locale}/discussions/threads/{threadId}/lock
Authentication Required - Requires contributor+ access
Lock or unlock a discussion thread. Locked threads prevent new comments.
Profile slug to check permissions
curl -X POST "http://localhost:8080/en/discussions/threads/01ARZ3NDEKTSV4RRFFQ69G5FAV/lock" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"is_locked": true, "profile_slug": "my-profile"}'
Discussion Best Practices
Moderation Guidelines
- Pin important announcements or answers
- Hide spam or off-topic comments
- Lock threads that become unproductive
- Use vote sorting to surface quality content
Performance Tips
- Paginate long discussions with limit/offset
- Load replies on-demand (don’t fetch all nested comments upfront)
- Use
sort=hot for active discussions
- Cache thread metadata separately from comments