Skip to main content

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

ParameterTypeRequiredDescription
groupIdinteger*The group ID to fetch posts for. At least one of groupId or userId is required.
userIdinteger*Fetch posts by a specific user. Non-admins can only use their own ID.
keywordstringNoFilter posts by keyword name.
pinnedstringNoSet to "true" to return only pinned posts.
fromGroupAdminsstringNoSet to "true" to filter posts from group admins only (requires groupId).
searchTermstringNoFull-text search on post title.
adminStatusstringNoFilter by admin reply status: "answered" or "unanswered".
includeScheduledstringNoSet to "true" to include future-dated posts (group admins only).
typestringNoFilter by content type (e.g. "article", "video", "live streaming").
itemsPerPageintegerNoNumber of posts per page. Default: 25.
currentPageintegerNoPage 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

FieldTypeDescription
reactionCountsarrayArray of { emoji, count } — aggregated reaction counts per emoji
myReactionsstring[]Emoji identifiers the authenticated user has reacted with
commentCountintegerNumber of top-level, non-deleted comments
adminHasRepliedbooleanWhether a platform or group admin has commented
adminLastReplystringISO timestamp of the most recent admin comment (null if none)
isLiveStreambooleanWhether 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 by adminLastReply instead.
  • 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 id as contentId in GET /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&currentPage=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"