Get All Groups
Authentication
Authentication is optional. If authenticated, the response includes membership status for each group.
Response
Indicates whether the request was successful
Array of community group objects
Unique identifier for the group
Display name of the group (max 60 characters)
URL-friendly identifier for the group
Brief description of the group (max 200 characters)
Emoji or icon representing the group (default: 💬)
Whether this is an official platform group
Total number of members in the group
Total number of posts in the group
Whether the authenticated user is a member (only if authenticated)
Code Example
const response = await fetch('https://api.skillrise.com/api/community/groups', {
headers: {
'Authorization': 'Bearer YOUR_TOKEN' // Optional
}
});
const data = await response.json();
console.log(data.groups);
Response Example
{
"success": true,
"groups": [
{
"_id": "64a1b2c3d4e5f6789abcdef0",
"name": "JavaScript Learners",
"slug": "javascript-learners",
"description": "A community for everyone learning JavaScript",
"icon": "🚀",
"isOfficial": true,
"memberCount": 1247,
"postCount": 856,
"isMember": true
},
{
"_id": "64a1b2c3d4e5f6789abcdef1",
"name": "Python Developers",
"slug": "python-developers",
"description": "Share Python projects, tips, and ask questions",
"icon": "🐍",
"isOfficial": false,
"memberCount": 892,
"postCount": 543,
"isMember": false
}
]
}
Create Group
Authentication
This endpoint requires user authentication.
Authorization: Bearer <user_token>
Request Body
Name of the group (1-60 characters, will be trimmed)
Description of the group (max 200 characters, will be trimmed)
Emoji or icon for the group (default: 💬)
Response
Indicates whether the group was created successfully
The newly created group object (same structure as Get Groups response)
Error message if success is false
Code Example
const response = await fetch('https://api.skillrise.com/api/community/groups', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN'
},
body: JSON.stringify({
name: 'React Enthusiasts',
description: 'Discuss React patterns, hooks, and best practices',
icon: '⚛️'
})
});
const data = await response.json();
console.log(data.group);
Response Example
{
"success": true,
"group": {
"_id": "64a1b2c3d4e5f6789abcdef2",
"name": "React Enthusiasts",
"slug": "react-enthusiasts",
"description": "Discuss React patterns, hooks, and best practices",
"icon": "⚛️",
"isOfficial": false,
"memberCount": 1,
"postCount": 0,
"isMember": true
}
}
{
"success": false,
"message": "A group with this name already exists"
}
Toggle Group Membership
Authentication
This endpoint requires user authentication.
Authorization: Bearer <user_token>
Path Parameters
The unique identifier of the group
Response
Indicates whether the operation was successful
New membership status (true if joined, false if left)
Code Example
const groupId = '64a1b2c3d4e5f6789abcdef0';
const response = await fetch(
`https://api.skillrise.com/api/community/groups/${groupId}/membership`,
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN'
}
}
);
const data = await response.json();
console.log(`Now ${data.isMember ? 'member' : 'not a member'}`);
Response Example
{
"success": true,
"isMember": true
}
{
"success": true,
"isMember": false
}
Notes
- Groups are sorted by official status first, then by member count (descending)
- The slug is automatically generated from the group name
- Group creators are automatically made members of the group
- Toggling membership is idempotent - calling it multiple times toggles between joined/left states
- Official groups can only be created by platform administrators
- Group names must be unique (case-insensitive)