# Spaces API

Source: https://projectfeed.app/docs/api/spaces

Spaces hold docs pages. Create, rename, archive, and delete spaces, and look up the spaceId that doc creation and moves need.

-   [Plan Pro or Enterprise](https://projectfeed.app/docs/billing)
-   [Scopes docs:read, docs:write](https://projectfeed.app/docs/api/scopes)

Native session clients use mobile:docSpaces with organizationId and optional projectId, cursor and limit. It returns readable Docs spaces as items and nextCursor. Use mobile:docPages for a space's root pages and children. Limits default to 25 and allow up to 50.

## Endpoints

### GET /api/v1/spaces

Scope

docs:read

Query parameters

-   `projectId` string
    
    Filter spaces by project ID
    
-   `includeArchived` boolean
    
    true adds archived spaces that you can administer. Defaults to false.
    

Request

curl

```
curl --request GET \
  --url 'https://projectfeed.app/api/v1/spaces' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY'
```

Response

JSON

```
{
  "spaces": [
    {
      "id": "spc_abc123",
      "projectId": null,
      "name": "Engineering",
      "slug": "engineering",
      "description": "Plans and runbooks",
      "icon": null,
      "visibility": "shared",
      "createdBy": "usr_abc123",
      "createdAt": 1779680000000,
      "updatedAt": 1779680000000,
      "archivedAt": null
    }
  ],
  "truncated": false
}
```

### POST /api/v1/spaces

Scope

docs:write

Body parameters

-   `name` string required
    
    Space name, 1 to 100 characters
    
-   `projectId` string
    
    Project that owns the space. Omit for a workspace space.
    
-   `description` string
    
    Optional description, 1,000 characters or less
    
-   `icon` string
    
    Optional icon, 100 characters or less
    
-   `visibility` string
    
    shared or private. Defaults to shared.
    

Request

curl

```
curl --request POST \
  --url 'https://projectfeed.app/api/v1/spaces' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "Engineering",
  "visibility": "shared"
}'
```

Response

JSON

```
{
  "id": "spc_abc123",
  "projectId": null,
  "name": "Engineering",
  "slug": "engineering",
  "description": "Plans and runbooks",
  "icon": null,
  "visibility": "shared",
  "createdBy": "usr_abc123",
  "createdAt": 1779680000000,
  "updatedAt": 1779680000000,
  "archivedAt": null
}
```

### GET /api/v1/spaces/:id

Scope

docs:read

Path parameters

-   `id` string required
    
    Space ID (URL path)
    

Request

curl

```
curl --request GET \
  --url 'https://projectfeed.app/api/v1/spaces/spc_abc123' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY'
```

Response

JSON

```
{
  "id": "spc_abc123",
  "projectId": null,
  "name": "Engineering",
  "slug": "engineering",
  "description": "Plans and runbooks",
  "icon": null,
  "visibility": "shared",
  "createdBy": "usr_abc123",
  "createdAt": 1779680000000,
  "updatedAt": 1779680000000,
  "archivedAt": null
}
```

### PATCH /api/v1/spaces/:id

Scope

docs:write

Path parameters

-   `id` string required
    
    Space ID (URL path)
    

Body parameters

-   `name` string
    
    New name, 1 to 100 characters
    
-   `description` string
    
    New description, 1,000 characters or less. An empty string clears it.
    
-   `icon` string
    
    New icon, 100 characters or less. An empty string clears it.
    
-   `visibility` string
    
    shared or private
    

Request

curl

```
curl --request PATCH \
  --url 'https://projectfeed.app/api/v1/spaces/spc_abc123' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "Engineering",
  "description": "Plans and runbooks"
}'
```

Response

JSON

```
{
  "id": "spc_abc123",
  "projectId": null,
  "name": "Engineering",
  "slug": "engineering",
  "description": "Plans and runbooks",
  "icon": null,
  "visibility": "shared",
  "createdBy": "usr_abc123",
  "createdAt": 1779680000000,
  "updatedAt": 1779680000000,
  "archivedAt": null
}
```

### POST /api/v1/spaces/:id/archive

Scope

docs:write

Path parameters

-   `id` string required
    
    Space ID (URL path)
    

Request

curl

```
curl --request POST \
  --url 'https://projectfeed.app/api/v1/spaces/spc_abc123/archive' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY'
```

Response

JSON

```
{ "archived": true }
```

### POST /api/v1/spaces/:id/restore

Scope

docs:write

Path parameters

-   `id` string required
    
    Space ID (URL path)
    

Request

curl

```
curl --request POST \
  --url 'https://projectfeed.app/api/v1/spaces/spc_abc123/restore' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY'
```

Response

JSON

```
{ "restored": true }
```

### DELETE /api/v1/spaces/:id

Scope

docs:write

Path parameters

-   `id` string required
    
    Space ID (URL path)
    

Request

curl

```
curl --request DELETE \
  --url 'https://projectfeed.app/api/v1/spaces/spc_abc123' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY'
```

Response

HTTP

```
HTTP/1.1 204 No Content
```

## List accessible spaces

Project-restricted credentials can list and view spaces only in their selected projects. Workspace-wide spaces stay outside that boundary, and these credentials cannot create, change, or delete spaces. Listing without a project filter searches only the selected projects, with the same 1,000-row scan limit.

The list contains only spaces the credential can see in the selected workspace. A project filter narrows the list and does not grant access to that project. Archived spaces appear only with `includeArchived=true`, and only the ones you can administer. The list reads the first 1,000 spaces in the workspace, or in the project when you pass `projectId`. When there are more, `truncated` is true; filter by project to see the rest.

Shell

```
curl "https://projectfeed.app/api/v1/spaces?projectId=prj_abc123" \
  -H "Authorization: Bearer pf_YOUR_API_KEY" \
  -H "X-Project-Feed-Workspace: studio"
```

Store a space by its `id`. Names and slugs can change, and neither replaces the ID in API writes.

## Response fields

`id`

Space ID required by doc creation, doc moves, and list filters.

`projectId`

Owning project ID, or null for a workspace-level space.

`name and slug`

Display name and URL-safe identifier.

`description and icon`

Optional presentation metadata; either can be null.

`visibility`

shared or private.

`createdBy`

User ID of the space creator.

`createdAt and updatedAt`

Unix timestamps in milliseconds.

`archivedAt`

When the space was archived, in Unix milliseconds, or null for an active space.

## Who can change a space

-   Workspace members can create spaces. Viewers cannot. A space with a projectId needs access to that project, and a project that is read-only because of the workspace plan does not accept new spaces.
-   Members can rename a workspace space they can see and change its description and icon. For a private workspace space, only its creator can. Project spaces can be changed only by workspace owners and admins.
-   Changing visibility takes a workspace owner or admin, or the creator of a workspace space.
-   Archive, restore, and delete follow the same rule as visibility. Project spaces are limited to owners and admins.

## Archive, restore, and delete

Archiving a space also archives every doc in it. The docs are archived in the background, so a list request made right after the archive can still show some of them as active. Restoring a space does not restore its docs. Restore each one with `POST /api/v1/docs/:id/restore`. Changing an archived space returns 409 until it is restored.

A space can be deleted only when it is archived and holds no docs, archived docs included. Docs inside an archived space are hidden and cannot be deleted, so empty the space while it is still active:

1.  List its docs with `GET /api/v1/docs?spaceId=spc_abc123` and again with `state=archived`. Delete each one with `DELETE /api/v1/docs/:id`, or move it to another space with `POST /api/v1/docs/:id/move`.
2.  Archive the space with `POST /api/v1/spaces/:id/archive`.
3.  Delete the space with `DELETE /api/v1/spaces/:id`. A successful delete returns 204.

If a space was archived with docs in it, restore the space, delete or move the docs, then archive and delete it.

## Access and empty results

-   Workspace spaces follow workspace membership. Private spaces are limited further by their creator and owner or admin access.
-   Project spaces also require access to the owning project. A valid project ID returns an empty spaces array when the caller cannot access that project.
-   Deleted spaces are never returned. Archived spaces are left out unless you pass includeArchived=true.
-   An empty array is an access or filter result, not proof that the workspace has no docs.

## Errors

### 400 Bad Request

Check the body. A name must be 1 to 100 characters. A PATCH needs at least one field to change, and a space cannot move to another project, so projectId is rejected.

### 403 Forbidden

Check docs:read or docs:write, token audience, workspace policy, and membership. Writes also check your role for that space and your access to its project.

### 404 Not Found

The space or project is in another workspace, you cannot see it, or the space is archived and you cannot administer it.

### 409 Conflict

The space is archived and you tried to edit it, or you tried to delete a space that is still active or still holds docs. Follow the delete steps above.

## Next steps

[Docs API](https://projectfeed.app/docs/api/docs) [API errors](https://projectfeed.app/docs/api/errors)
