Skip to main content

Get Post by ID

Retrieve a single post by its ID, including inline reaction data, comment counts, and admin reply tracking.

Endpoint

GET /api/posts/:id

Authentication

Required.

Path Parameters

ParameterTypeDescription
idintegerThe post ID

Response

Success Response

Status Code: 200 OK

{
"id": 4212,
"title": "Welcome to the community!",
"description": "<p>We're excited to have you here.</p>",
"type": "article",
"visibility": "group",
"video": null,
"featuredImage": "uploads/featured-123.jpg",
"isLiveStream": false,
"publishedDate": "2024-08-09T22:36:45.000Z",
"createdAt": "2024-08-09T22:36:45.000Z",
"updatedAt": "2024-08-10T14:22:33.000Z",
"commentCount": 5,
"reactionCounts": [
{ "emoji": "heart", "count": 12 },
{ "emoji": "fire", "count": 5 }
],
"myReactions": ["heart"],
"adminHasReplied": true,
"adminLastReply": "2024-08-10T14:22:33.000Z",
"User": {
"id": 6604,
"name": "Bruce van Zyl",
"photoUrl": "1639671861952.png",
"role": "admin"
},
"ContentGroups": [
{
"GroupId": 32,
"type": "post",
"pinned": false
}
],
"Keywords": [
{ "id": 1, "title": "Announcements" }
]
}

Error Responses

Status CodeDescription
400Invalid post ID
403Not a member of the post's group
404Post not found

Example

curl -X GET "https://api.tribesocial.io/api/posts/4212" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN"