Skip to main content

Overview

Groups are smaller communities within spaces. Each group belongs to a space and has its own members and moderators. Groups can be public or private.
Groups are accessed via the PocketBase REST API groups collection. There are no custom /api/groups endpoints - all operations use standard PocketBase collection endpoints documented below.

Group Object

A group object contains the following fields:
id
string
Unique group identifier
name
string
Group name
description
string
Group description
space
string
Parent space ID
isPublic
boolean
Whether the group is publicly accessible
moderators
array
Array of user IDs who moderate the group
created
string
ISO 8601 timestamp of creation
updated
string
ISO 8601 timestamp of last update

List Groups

Retrieve all groups, optionally filtered by space.

Request

curl -X GET "https://your-domain.com/api/collections/groups/records?filter=space='SPACE_ID'&page=1&perPage=30" \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN"
page
number
default:"1"
Page number for pagination
perPage
number
default:"30"
Number of groups per page
filter
string
Filter expression (e.g., space='SPACE_ID', isPublic=true)

Response

{
  "page": 1,
  "perPage": 30,
  "totalItems": 3,
  "totalPages": 1,
  "items": [
    {
      "id": "GROUP_ID",
      "collectionId": "groups_collection_id",
      "collectionName": "groups",
      "name": "Machine Learning Club",
      "description": "Group for ML enthusiasts",
      "space": "SPACE_ID",
      "isPublic": true,
      "moderators": ["USER_ID"],
      "created": "2026-01-15 00:00:00.000Z",
      "updated": "2026-03-01 00:00:00.000Z"
    }
  ]
}

Get Group

Retrieve a single group by ID.

Request

curl -X GET "https://your-domain.com/api/collections/groups/records/{id}" \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN"

Response

{
  "id": "GROUP_ID",
  "collectionId": "groups_collection_id",
  "collectionName": "groups",
  "name": "Machine Learning Club",
  "description": "Group for ML enthusiasts",
  "space": "SPACE_ID",
  "isPublic": true,
  "moderators": ["USER_ID"],
  "created": "2026-01-15 00:00:00.000Z",
  "updated": "2026-03-01 00:00:00.000Z"
}

Create Group

Create a new group within a space.

Request

curl -X POST "https://your-domain.com/api/collections/groups/records" \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "New Study Group",
    "description": "Group for studying together",
    "space": "SPACE_ID",
    "isPublic": true,
    "moderators": ["USER_ID"]
  }'
name
string
required
Group name
description
string
Group description
space
string
required
Parent space ID
isPublic
boolean
default:"true"
Whether the group is publicly accessible
moderators
array
Array of user IDs who will moderate the group

Response

{
  "id": "GROUP_ID",
  "collectionId": "groups_collection_id",
  "collectionName": "groups",
  "name": "New Study Group",
  "description": "Group for studying together",
  "space": "SPACE_ID",
  "isPublic": true,
  "moderators": ["USER_ID"],
  "created": "2026-03-03 12:00:00.000Z",
  "updated": "2026-03-03 12:00:00.000Z"
}

Update Group

Update an existing group. Requires space moderator or group moderator permissions.

Request

curl -X PATCH "https://your-domain.com/api/collections/groups/records/{id}" \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "Updated group description"
  }'

Response

{
  "id": "GROUP_ID",
  "collectionId": "groups_collection_id",
  "collectionName": "groups",
  "name": "New Study Group",
  "description": "Updated group description",
  "space": "SPACE_ID",
  "isPublic": true,
  "moderators": ["USER_ID"],
  "created": "2026-03-03 12:00:00.000Z",
  "updated": "2026-03-03 13:00:00.000Z"
}

Delete Group

Delete a group. Requires space moderator or group moderator permissions.

Request

curl -X DELETE "https://your-domain.com/api/collections/groups/records/{id}" \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN"

Response

HTTP 204 No Content

Group Membership

Group membership is managed through the group_members collection.

List Group Members

curl -X GET "https://your-domain.com/api/collections/group_members/records?filter=group='GROUP_ID'&expand=user" \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN"

Response

{
  "page": 1,
  "perPage": 30,
  "totalItems": 5,
  "totalPages": 1,
  "items": [
    {
      "id": "MEMBER_ID",
      "collectionId": "group_members_collection_id",
      "collectionName": "group_members",
      "group": "GROUP_ID",
      "user": "USER_ID",
      "role": "member",
      "created": "2026-02-01 00:00:00.000Z",
      "updated": "2026-02-01 00:00:00.000Z",
      "expand": {
        "user": {
          "id": "USER_ID",
          "username": "username",
          "email": "[email protected]"
        }
      }
    }
  ]
}

Add Group Member

curl -X POST "https://your-domain.com/api/collections/group_members/records" \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "group": "GROUP_ID",
    "user": "USER_ID",
    "role": "member"
  }'
group
string
required
Group ID
user
string
required
User ID to add
role
string
required
Member role: member or moderator

Response

{
  "id": "MEMBER_ID",
  "collectionId": "group_members_collection_id",
  "collectionName": "group_members",
  "group": "GROUP_ID",
  "user": "USER_ID",
  "role": "member",
  "created": "2026-03-03 12:00:00.000Z",
  "updated": "2026-03-03 12:00:00.000Z"
}

Update Member Role

curl -X PATCH "https://your-domain.com/api/collections/group_members/records/{id}" \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "role": "moderator"
  }'

Remove Group Member

curl -X DELETE "https://your-domain.com/api/collections/group_members/records/{id}" \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN"

Group Posts

To retrieve posts for a specific group, use the Posts API with group filtering:
curl -X GET "https://your-domain.com/api/posts?scope=group&group=GROUP_ID" \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN"
See the Posts API documentation for more details.

Permissions

  • Group Moderator: Can manage group content and members
  • Space Moderator: Can manage all groups within their space
  • Group Member: Can view and post content in the group

Build docs developers (and LLMs) love