Overview
Spaces are community areas within Campus where users can share content and organize into groups. Each space has members with different roles (owner, moderator, member) and can be public or private.
Spaces are accessed via the PocketBase REST API spaces collection. There are no custom /api/spaces endpoints - all operations use standard PocketBase collection endpoints documented below.
Space Object
A space object contains the following fields:
URL-friendly space identifier
Whether the space is publicly accessible
Array of user IDs who own the space
Array of user IDs who moderate the space
ISO 8601 timestamp of creation
ISO 8601 timestamp of last update
List Spaces
Retrieve all accessible spaces.
Request
curl -X GET "https://your-domain.com/api/collections/spaces/records?page=1&perPage=30" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN"
Page number for pagination
Number of spaces per page
Filter expression (e.g., isPublic = true)
Response
{
"page": 1,
"perPage": 30,
"totalItems": 5,
"totalPages": 1,
"items": [
{
"id": "SPACE_ID",
"collectionId": "spaces_collection_id",
"collectionName": "spaces",
"name": "Computer Science",
"slug": "computer-science",
"description": "Space for CS students and faculty",
"avatar": "avatar.png",
"isPublic": true,
"owners": ["USER_ID"],
"moderators": ["USER_ID_2"],
"created": "2026-01-01 00:00:00.000Z",
"updated": "2026-03-01 00:00:00.000Z"
}
]
}
Get Space
Retrieve a single space by ID.
Request
curl -X GET "https://your-domain.com/api/collections/spaces/records/{id}" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN"
Response
{
"id": "SPACE_ID",
"collectionId": "spaces_collection_id",
"collectionName": "spaces",
"name": "Computer Science",
"slug": "computer-science",
"description": "Space for CS students and faculty",
"avatar": "avatar.png",
"isPublic": true,
"owners": ["USER_ID"],
"moderators": ["USER_ID_2"],
"created": "2026-01-01 00:00:00.000Z",
"updated": "2026-03-01 00:00:00.000Z"
}
Create Space
Create a new space.
Request
curl -X POST "https://your-domain.com/api/collections/spaces/records" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "New Space",
"slug": "new-space",
"description": "A new space for collaboration",
"isPublic": true,
"owners": ["USER_ID"]
}'
URL-friendly identifier (must be unique)
Whether the space is publicly accessible
Array of user IDs who will own the space
Array of user IDs who will moderate the space
Response
{
"id": "SPACE_ID",
"collectionId": "spaces_collection_id",
"collectionName": "spaces",
"name": "New Space",
"slug": "new-space",
"description": "A new space for collaboration",
"avatar": "",
"isPublic": true,
"owners": ["USER_ID"],
"moderators": [],
"created": "2026-03-03 12:00:00.000Z",
"updated": "2026-03-03 12:00:00.000Z"
}
Update Space
Update an existing space. Requires owner or moderator permissions.
Request
curl -X PATCH "https://your-domain.com/api/collections/spaces/records/{id}" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"description": "Updated description"
}'
Response
{
"id": "SPACE_ID",
"collectionId": "spaces_collection_id",
"collectionName": "spaces",
"name": "New Space",
"slug": "new-space",
"description": "Updated description",
"avatar": "",
"isPublic": true,
"owners": ["USER_ID"],
"moderators": [],
"created": "2026-03-03 12:00:00.000Z",
"updated": "2026-03-03 13:00:00.000Z"
}
Delete Space
Delete a space. Requires owner permissions.
Request
curl -X DELETE "https://your-domain.com/api/collections/spaces/records/{id}" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN"
Response
HTTP 204 No Content
Space Membership
Space membership is managed through the space_members collection.
List Space Members
curl -X GET "https://your-domain.com/api/collections/space_members/records?filter=space='SPACE_ID'&expand=user" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN"
Add Space Member
curl -X POST "https://your-domain.com/api/collections/space_members/records" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"space": "SPACE_ID",
"user": "USER_ID",
"role": "member"
}'
Member role: member, moderator, or owner
Response
{
"id": "MEMBER_ID",
"collectionId": "space_members_collection_id",
"collectionName": "space_members",
"space": "SPACE_ID",
"user": "USER_ID",
"role": "member",
"created": "2026-03-03 12:00:00.000Z",
"updated": "2026-03-03 12:00:00.000Z"
}
Remove Space Member
curl -X DELETE "https://your-domain.com/api/collections/space_members/records/{id}" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN"
Permissions
- Owner: Full control including deleting space and managing all members
- Moderator: Can manage content, members (except owners)
- Member: Can view and post content in the space