List Posts
Retrieve a paginated list of posts for a group or user. Each post includes inline reaction data, comment counts, and admin reply tracking.
Endpoint
GET /api/posts
Authentication
Required.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
groupId | integer | * | The group ID to fetch posts for. At least one of groupId or userId is required. |
userId | integer | * | Fetch posts by a specific user. Non-admins can only use their own ID. |
keyword | string | No | Filter posts by keyword name. |
pinned | string | No | Set to "true" to return only pinned posts. |
fromGroupAdmins | string | No | Set to "true" to filter posts from group admins only (requires groupId). |
searchTerm | string | No | Full-text search on post title. |
adminStatus | string | No | Filter by admin reply status: "answered" or "unanswered". |
includeScheduled | string | No | Set to "true" to include future-dated posts (group admins only). |
type | string | No | Filter by content type (e.g. "article", "video", "live streaming"). |
itemsPerPage | integer | No | Number of posts per page. Default: 25. |
currentPage | integer | No | Page number (1-based). Default: 1. |
Response
Success Response
Status Code: 200 OK
{
"items": [
{
"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 },
{ "emoji": "thumbs_up", "count": 3 }
],
"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" }
]
}
],
"totalItems": 42,
"currentPage": 1,
"itemsPerPage": 25,
"totalPages": 2
}
Key Response Fields
| Field | Type | Description |
|---|---|---|
reactionCounts | array | Array of { emoji, count } — aggregated reaction counts per emoji |
myReactions | string[] | Emoji identifiers the authenticated user has reacted with |
commentCount | integer | Number of top-level, non-deleted comments |
adminHasReplied | boolean | Whether a platform or group admin has commented |
adminLastReply | string | ISO timestamp of the most recent admin comment (null if none) |
isLiveStream | boolean | Whether this post is a live stream |
Notes
- Pinned posts always appear first in the results, followed by posts sorted by
publishedDate(newest first). - When
adminStatus=answered, results are sorted byadminLastReplyinstead. - Future-scheduled posts are hidden from regular members unless the requester is a group admin with
includeScheduled=true. - To fetch the actual comments on a post, use the post's
idascontentIdinGET /api/chat. - To see who reacted on a post (not just aggregated counts), use
GET /api/content/:id/reactions?emoji=....
Examples
List all posts in a group
curl -X GET "https://api.tribesocial.io/api/posts?groupId=32&itemsPerPage=10¤tPage=1" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN"
Filter by content type
curl -X GET "https://api.tribesocial.io/api/posts?groupId=32&type=article" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN"