# Docs API

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

Create, edit, move, duplicate, lock, watch, archive, and delete workspace docs. Browse recent and watched docs and the doc tree, read version history, restore earlier versions, share docs, manage templates, and work with comments and comment reactions.

-   [Plan Pro or Enterprise for API keys](https://projectfeed.app/docs/billing)
-   Who Any member to read; non-viewers to write
-   [Scopes docs:read, docs:write, reactions:read, reactions:write](https://projectfeed.app/docs/api/scopes)

Native session clients can subscribe to mobile:docSpaces, mobile:docPages, mobile:doc and mobile:docComments. Lists return items and nextCursor; docPages takes spaceId and an optional parentPageId for the tree. Details return typed content blocks, plain text and a web URL. Every query takes organizationId and checks page and ancestor access.

Session tokens accept GET requests for the doc list, a doc with its content, its comments, its version list, and an individual version. Send Authorization: Bearer with X-Project-Feed-Workspace. These reads use docs:read and preserve doc, space, and project access, including for viewers. Members can also create a doc, update its title and other fields, edit blocks, restore a version, and add, edit, delete, resolve, reopen, and react to comments, with the same doc access rules. Viewers get 403 on these writes. Send If-Match on a doc update, expectedVersion on a restore and expectedUpdatedAt or If-Match on a comment edit so a newer change returns 412. Other Docs routes still require an API credential.

## Doc fields

List responses return each doc without its content. Get, create, update, move, duplicate, lock, and unlock return the doc with `content`, `contentText`, and `fullWidth` added. Timestamps are milliseconds, and user fields are user IDs. Find space IDs with the [Spaces API](https://projectfeed.app/docs/api/spaces).

`id`

Doc ID. Use it in every path on this page. identifier is a separate label such as DOC-12.

`url`

A link to the doc in the app.

`spaceId`

Space that holds the doc. parentPageId is the parent doc, or null at the top level of the space.

`title`

Doc title. slug is unique within the space, and icon is null when none is set.

`visibility`

private docs are visible to owners, admins, the creator, and people the doc is shared with. public and shared docs are visible to everyone who can see the space. Neither value publishes the doc outside the workspace.

`state`

active or archived. archivedAt is the archive time, or null.

`locked`

True when an admin has locked the doc. Only owners and admins can edit a locked doc.

`currentVersion`

Latest saved version number. The versions list uses the same numbers.

`content`

Plate JSON blocks. contentText is the same content as plain text. contentFormat is platejs, or markdown or plaintext when you asked for Markdown.

`createdBy`

User who created the doc. lastEditedBy and lastEditedAt describe the latest edit.

`wordCount`

Words in the doc. readTimeMinutes is the estimated reading time.

`permissions`

What the caller can do on this doc: canComment, canEdit, and canManage. Single-doc responses include it, and lists leave it out.

## Formatted text

Posts, comments, annotations, and Docs accept plain strings or Plate JSON block arrays in `content`. For Markdown, set `contentFormat` to `markdown`. Task descriptions use `description` and `descriptionFormat`. These options apply to both create and edit requests.

JSON

```
{
  "content": "## Review\n\n- **Ready**\n- [Details](https://example.com)",
  "contentFormat": "markdown"
}
```

Markdown supports headings, nested lists, checklists, links, tables, code blocks, and inline formatting. Footnotes become numbered superscript markers with the notes listed at the end. Structured JSON uses the editor's blocks. Each block has a `type` and `children`. Text leaves use `text` with optional marks such as `bold` or `italic`.

JSON

```
{
  "content": [
    {"type": "h2", "children": [{"text": "Review"}]},
    {"type": "p", "indent": 1, "listStyleType": "disc", "children": [{"text": "Ready", "bold": true}]}
  ]
}
```

Explicit formats are `plaintext`, `markdown`, and `platejs`. Omit the format to keep existing string behavior or infer structured JSON. Responses retain the stored formatting. Task comments return their Plate content as a JSON string.

Posts, task descriptions, and Docs can show a file inline. Write a Markdown image whose URL is `media:` followed by the file's media ID, such as `![Login screen](media:<mediaId>)`. The text in brackets becomes the caption. In Plate JSON, put the same URL on an `img`, `video`, `audio`, or `file` node. The file can be on the same post or task, on another post, task, or comment, on a canvas, or uploaded to a doc, as long as you can open it. A project-restricted key can only use files from its project. When the request also sends `uploads`, `upload:0` names its first upload. A media ID you cannot open returns 400. A doc read as Markdown writes its inline files back the same way, so they survive an edit.

JSON

```
{
  "content": "Fixed the overflow.\n\n![After the fix](upload:0)\n\n![Original report](media:<mediaId>)",
  "contentFormat": "markdown",
  "uploads": [
    {
      "uploadToken": "<uploadToken>",
      "parts": []
    }
  ]
}
```

The server derives `contentText` and `descriptionText` from the content. Character limits count visible text; request-size limits also apply. Names, titles, and other plain-text fields remain strings.

## Doc content

Content sent to create and replace is limited to 1 MB of serialized JSON. A larger body, or content that is not a string or a Plate block array, returns 400. Plate JSON must also use the node types and nesting the doc editor supports: tables hold `tr` rows of `td` or `th` cells that contain blocks, code blocks hold `code_line` nodes, links and mentions sit inside a block, and lists should be `p` blocks with `listStyleType` and `indent`. An unknown type or a misplaced node returns 400 naming its path, such as `content[0].children[1]`. Text and Markdown become blocks, one per line of text. Reads return Plate JSON blocks. Add `format=markdown` to a get or a version get to receive Markdown instead. `contentFormat` says which form came back, and it is `plaintext` when a block cannot be written as Markdown.

## Endpoints

Lists use cursors. See [pagination](https://projectfeed.app/docs/api/conventions#pagination) for how to page through them. The doc list returns `pages` and `hasMore`, the version list returns `versions` and `hasMore`, and the comment list returns `comments` with a null `nextCursor` on the last response.

### GET /api/v1/docs

Scope

docs:read

Query parameters

-   `spaceId` string
    
    Only docs in this space. A space you cannot see returns an empty list.
    
-   `fields` string
    
    Comma-separated fields to return. id is always included. See Choosing fields in Conventions.
    
-   `state` string
    
    active or archived (default active). A request with updatedSince lists both unless you name one.
    
-   `parentId` string
    
    Only children of this doc, by ID or identifier. root lists top-level docs.
    
-   `q` string
    
    Only docs with this text in the title, slug, or identifier. Up to 100 characters.
    
-   `lastEditedBy` string
    
    Only docs last edited by this user ID, or me
    
-   `locked` boolean
    
    true for locked docs only, false for unlocked docs only
    
-   `sort` string
    
    updatedAt, createdAt, or title. A sorted list reads the newest 500 visible docs and the response has truncated. Cannot be combined with updatedSince, which returns 400.
    
-   `order` string
    
    asc or desc, for use with sort
    
-   `limit` number
    
    Docs per response, 1 to 100 (default 50)
    
-   `updatedSince` number|string
    
    Only docs changed after this time, as Unix milliseconds or an ISO 8601 time with a timezone. The time is exclusive, and results come back oldest change first. To poll, send the largest updatedAt you have seen minus 5 seconds and skip docs whose id and updatedAt you already have.
    
-   `includeDeleted` boolean
    
    Include deleted docs. Each carries deletedAt, which is null for a live one. A deleted doc is reported for 30 days. A purged doc is shown only to its creator and to admins when it was private, shared page by page, or in a private space; anyone else sees it if they can still open its space and project.
    
-   `cursor` string
    
    nextCursor from the previous response. Treat it as an opaque string and pass it back unchanged. A cursor from one sort is refused with another sort, which returns 400.
    

Request

curl

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

Response

JSON

```
{
  "pages": [
    {
      "id": "doc_abc123",
      "identifier": "DOC-12",
      "spaceId": "spc_abc123",
      "parentPageId": null,
      "title": "Launch runbook",
      "slug": "launch-runbook",
      "icon": null,
      "url": "https://projectfeed.app/acme/docs/launch-runbook",
      "visibility": "shared",
      "state": "active",
      "locked": false,
      "wordCount": 2,
      "readTimeMinutes": 1,
      "currentVersion": 4,
      "createdBy": "usr_abc123",
      "createdAt": 1779600000000,
      "updatedAt": 1779680000000,
      "lastEditedBy": "usr_def456",
      "lastEditedAt": 1779680000000,
      "archivedAt": null,
      "deletedAt": null
    }
  ],
  "hasMore": true,
  "nextCursor": "1779680000000:doc_abc123"
}
```

### POST /api/v1/docs

Scope

docs:write

Body parameters

-   `spaceId` string required
    
    Space that holds the doc
    
-   `title` string
    
    Doc title, trimmed and cut to 200 characters. Defaults to Untitled.
    
-   `icon` string
    
    Doc icon
    
-   `visibility` string
    
    private, public, or shared (default public)
    
-   `content` string|array
    
    Initial content as plain text, Markdown, or Plate JSON blocks, up to 1 MB serialized. Text is split into one block per line.
    
-   `contentFormat` string
    
    plaintext, markdown, or platejs. When omitted, a Plate JSON array is read as blocks and any other string as plain text.
    
-   `templateId` string
    
    Start from this template. Send content or templateId, not both, or the request returns 400. The title defaults to the template name and the icon to the template icon.
    

Request

curl

```
curl --request POST \
  --url 'https://projectfeed.app/api/v1/docs' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "spaceId": "spc_abc123",
  "title": "Launch runbook",
  "visibility": "shared",
  "content": [
    {
      "type": "p",
      "children": [
        {
          "text": "Launch checklist"
        }
      ]
    }
  ]
}'
```

Response

JSON

```
{
  "id": "doc_abc123",
  "identifier": "DOC-12",
  "spaceId": "spc_abc123",
  "parentPageId": null,
  "title": "Launch runbook",
  "slug": "launch-runbook",
  "icon": null,
  "url": "https://projectfeed.app/acme/docs/launch-runbook",
  "content": [{ "type": "p", "children": [{ "text": "Launch checklist" }] }],
  "contentFormat": "platejs",
  "contentText": "Launch checklist",
  "visibility": "shared",
  "state": "active",
  "locked": false,
  "fullWidth": false,
  "wordCount": 2,
  "readTimeMinutes": 1,
  "currentVersion": 4,
  "createdBy": "usr_abc123",
  "createdAt": 1779600000000,
  "updatedAt": 1779680000000,
  "lastEditedBy": "usr_def456",
  "lastEditedAt": 1779680000000,
  "archivedAt": null
}
```

### GET /api/v1/docs/:id

Scope

docs:read

Path parameters

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

Query parameters

-   `format` string
    
    Set to markdown to get content as a Markdown string. contentFormat says which form came back.
    
-   `fields` string
    
    Comma-separated fields to return. id is always included. See Choosing fields in Conventions.
    

Request

curl

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

Response

JSON

```
{
  "id": "doc_abc123",
  "identifier": "DOC-12",
  "spaceId": "spc_abc123",
  "parentPageId": null,
  "title": "Launch runbook",
  "slug": "launch-runbook",
  "icon": null,
  "url": "https://projectfeed.app/acme/docs/launch-runbook",
  "content": [{ "type": "p", "children": [{ "text": "Launch checklist" }] }],
  "contentFormat": "platejs",
  "contentText": "Launch checklist",
  "visibility": "shared",
  "state": "active",
  "locked": false,
  "fullWidth": false,
  "wordCount": 2,
  "readTimeMinutes": 1,
  "currentVersion": 4,
  "createdBy": "usr_abc123",
  "createdAt": 1779600000000,
  "updatedAt": 1779680000000,
  "lastEditedBy": "usr_def456",
  "lastEditedAt": 1779680000000,
  "archivedAt": null
}
```

### PATCH /api/v1/docs/:id

Scope

docs:write

Path parameters

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

Body parameters

-   `title` string
    
    New title. It cannot be empty.
    
-   `icon` string
    
    New icon. An empty string clears it.
    
-   `fullWidth` boolean
    
    Show the doc at full width
    
-   `visibility` string
    
    private, public, or shared. Changing it needs manage access to the doc.
    

Request

curl

```
curl --request PATCH \
  --url 'https://projectfeed.app/api/v1/docs/doc_abc123' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "title": "Launch runbook",
  "fullWidth": true
}'
```

Response

JSON

```
{
  "id": "doc_abc123",
  "identifier": "DOC-12",
  "spaceId": "spc_abc123",
  "parentPageId": null,
  "title": "Launch runbook",
  "slug": "launch-runbook",
  "icon": null,
  "url": "https://projectfeed.app/acme/docs/launch-runbook",
  "content": [{ "type": "p", "children": [{ "text": "Launch checklist" }] }],
  "contentFormat": "platejs",
  "contentText": "Launch checklist",
  "visibility": "shared",
  "state": "active",
  "locked": false,
  "fullWidth": false,
  "wordCount": 2,
  "readTimeMinutes": 1,
  "currentVersion": 4,
  "createdBy": "usr_abc123",
  "createdAt": 1779600000000,
  "updatedAt": 1779680000000,
  "lastEditedBy": "usr_def456",
  "lastEditedAt": 1779680000000,
  "archivedAt": null
}
```

### PUT /api/v1/docs/:id/content

Scope

docs:write

Path parameters

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

Body parameters

-   `content` string|array required
    
    New content as plain text, Markdown, or Plate JSON blocks, up to 1 MB serialized. Text is split into one block per line.
    
-   `contentFormat` string
    
    plaintext, markdown, or platejs. When omitted, a Plate JSON array is read as blocks and any other string as plain text.
    
-   `changeNote` string
    
    Note shown on the version in the doc's history
    
-   `baseVersion` number
    
    The currentVersion you last read. If the doc is at another version, the request returns 409 and nothing is written. Without it the content is replaced whatever the doc holds.
    

Request

curl

```
curl --request PUT \
  --url 'https://projectfeed.app/api/v1/docs/doc_abc123/content' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "content": [
    {
      "type": "p",
      "children": [
        {
          "text": "Updated launch steps"
        }
      ]
    }
  ],
  "changeNote": "Added rollback steps"
}'
```

Response

JSON

```
{ "status": "completed", "generation": 7, "version": 5 }
```

### POST /api/v1/docs/:id/blocks

Scope

docs:write

Path parameters

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

Body parameters

-   `operations` array required
    
    1 to 100 operations, applied in order. See Edit blocks below for their fields.
    
-   `idempotencyKey` string
    
    Same as the Idempotency-Key header. A retry with the same key returns the first result.
    

Request

curl

```
curl --request POST \
  --url 'https://projectfeed.app/api/v1/docs/doc_abc123/blocks' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "operations": [
    {
      "op": "replace",
      "blockId": "blk_intro",
      "expected": {
        "type": "p",
        "id": "blk_intro",
        "children": [
          {
            "text": "Intro"
          }
        ]
      },
      "block": {
        "type": "p",
        "id": "blk_intro",
        "children": [
          {
            "text": "Updated intro"
          }
        ]
      }
    }
  ]
}'
```

Response

JSON

```
{
  "generation": 3,
  "blocks": [
    {
      "type": "p",
      "id": "blk_intro",
      "children": [{ "text": "Updated intro" }]
    }
  ]
}
```

### GET /api/v1/docs/:id/versions

Scope

docs:read

Path parameters

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

Query parameters

-   `limit` number
    
    Versions per response, 1 to 200 (default 50)
    
-   `cursor` number
    
    nextCursor from the previous response, a version number of 1 or more. Versions older than it are returned.
    

Request

curl

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

Response

JSON

```
{
  "hasMore": true,
  "nextCursor": 151,
  "versions": [
    {
      "id": "ver_abc123",
      "version": 200,
      "title": "Launch runbook",
      "changeNote": null,
      "isAutosave": true,
      "editedBy": "usr_def456",
      "createdAt": 1779680000000
    }
  ]
}
```

### POST /api/v1/docs/:id/versions/:version/restore

Scope

docs:write

Path parameters

-   `id` string required
    
    Doc ID (URL path)
    
-   `version` number required
    
    Version number from the versions list (URL path)
    

Body parameters

-   `expectedVersion` number
    
    The currentVersion you last read. If the doc is at another version, the request returns 412 and nothing is restored.
    
-   `idempotencyKey` string
    
    Same as the Idempotency-Key header. A retry with the same key returns the first result.
    

Request

curl

```
curl --request POST \
  --url 'https://projectfeed.app/api/v1/docs/doc_abc123/versions/4/restore' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "expectedVersion": 1
}'
```

Response

JSON

```
{
  "status": "completed",
  "generation": 3,
  "version": 12
}
```

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

Scope

docs:write

Path parameters

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

Request

curl

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

Response

JSON

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

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

Scope

docs:write

Path parameters

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

Request

curl

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

Response

JSON

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

### POST /api/v1/docs/:id/move

Scope

docs:write

Path parameters

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

Body parameters

-   `spaceId` string
    
    Target space. Omit to stay in the current space.
    
-   `parentId` string|null
    
    Parent doc in the target space. Omit it or send null to place the doc at the top level of the space.
    
-   `position` number
    
    Zero-based position among the new siblings, a whole number of 0 or more. Omit it, or use a number past the last sibling, to add the doc at the end.
    

Request

curl

```
curl --request POST \
  --url 'https://projectfeed.app/api/v1/docs/doc_abc123/move' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "spaceId": "spc_abc123",
  "parentId": "doc_def456",
  "position": 0
}'
```

Response

JSON

```
{
  "id": "doc_abc123",
  "identifier": "DOC-12",
  "spaceId": "spc_abc123",
  "parentPageId": null,
  "title": "Launch runbook",
  "slug": "launch-runbook",
  "icon": null,
  "url": "https://projectfeed.app/acme/docs/launch-runbook",
  "content": [{ "type": "p", "children": [{ "text": "Launch checklist" }] }],
  "contentFormat": "platejs",
  "contentText": "Launch checklist",
  "visibility": "shared",
  "state": "active",
  "locked": false,
  "fullWidth": false,
  "wordCount": 2,
  "readTimeMinutes": 1,
  "currentVersion": 4,
  "createdBy": "usr_abc123",
  "createdAt": 1779600000000,
  "updatedAt": 1779680000000,
  "lastEditedBy": "usr_def456",
  "lastEditedAt": 1779680000000,
  "archivedAt": null
}
```

### POST /api/v1/docs/:id/duplicate

Scope

docs:write

Path parameters

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

Request

curl

```
curl --request POST \
  --url 'https://projectfeed.app/api/v1/docs/doc_abc123/duplicate' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY'
```

Response

JSON

```
{
  "id": "doc_abc123",
  "identifier": "DOC-12",
  "spaceId": "spc_abc123",
  "parentPageId": null,
  "title": "Launch runbook",
  "slug": "launch-runbook",
  "icon": null,
  "url": "https://projectfeed.app/acme/docs/launch-runbook",
  "content": [{ "type": "p", "children": [{ "text": "Launch checklist" }] }],
  "contentFormat": "platejs",
  "contentText": "Launch checklist",
  "visibility": "shared",
  "state": "active",
  "locked": false,
  "fullWidth": false,
  "wordCount": 2,
  "readTimeMinutes": 1,
  "currentVersion": 4,
  "createdBy": "usr_abc123",
  "createdAt": 1779600000000,
  "updatedAt": 1779680000000,
  "lastEditedBy": "usr_def456",
  "lastEditedAt": 1779680000000,
  "archivedAt": null
}
```

### POST /api/v1/docs/:id/lock

Scope

docs:write

Path parameters

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

Request

curl

```
curl --request POST \
  --url 'https://projectfeed.app/api/v1/docs/doc_abc123/lock' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY'
```

Response

JSON

```
{
  "id": "doc_abc123",
  "identifier": "DOC-12",
  "spaceId": "spc_abc123",
  "parentPageId": null,
  "title": "Launch runbook",
  "slug": "launch-runbook",
  "icon": null,
  "url": "https://projectfeed.app/acme/docs/launch-runbook",
  "content": [{ "type": "p", "children": [{ "text": "Launch checklist" }] }],
  "contentFormat": "platejs",
  "contentText": "Launch checklist",
  "visibility": "shared",
  "state": "active",
  "locked": false,
  "fullWidth": false,
  "wordCount": 2,
  "readTimeMinutes": 1,
  "currentVersion": 4,
  "createdBy": "usr_abc123",
  "createdAt": 1779600000000,
  "updatedAt": 1779680000000,
  "lastEditedBy": "usr_def456",
  "lastEditedAt": 1779680000000,
  "archivedAt": null
}
```

### POST /api/v1/docs/:id/unlock

Scope

docs:write

Path parameters

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

Request

curl

```
curl --request POST \
  --url 'https://projectfeed.app/api/v1/docs/doc_abc123/unlock' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY'
```

Response

JSON

```
{
  "id": "doc_abc123",
  "identifier": "DOC-12",
  "spaceId": "spc_abc123",
  "parentPageId": null,
  "title": "Launch runbook",
  "slug": "launch-runbook",
  "icon": null,
  "url": "https://projectfeed.app/acme/docs/launch-runbook",
  "content": [{ "type": "p", "children": [{ "text": "Launch checklist" }] }],
  "contentFormat": "platejs",
  "contentText": "Launch checklist",
  "visibility": "shared",
  "state": "active",
  "locked": false,
  "fullWidth": false,
  "wordCount": 2,
  "readTimeMinutes": 1,
  "currentVersion": 4,
  "createdBy": "usr_abc123",
  "createdAt": 1779600000000,
  "updatedAt": 1779680000000,
  "lastEditedBy": "usr_def456",
  "lastEditedAt": 1779680000000,
  "archivedAt": null
}
```

### POST /api/v1/docs/:id/watch

Scope

docs:write

Path parameters

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

Request

curl

```
curl --request POST \
  --url 'https://projectfeed.app/api/v1/docs/doc_abc123/watch' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY'
```

Response

JSON

```
{ "watching": true }
```

### POST /api/v1/docs/:id/unwatch

Scope

docs:write

Path parameters

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

Request

curl

```
curl --request POST \
  --url 'https://projectfeed.app/api/v1/docs/doc_abc123/unwatch' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY'
```

Response

JSON

```
{ "watching": false }
```

### DELETE /api/v1/docs/:id

Scope

docs:write

Path parameters

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

Request

curl

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

Response

HTTP

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

### GET /api/v1/docs/:id/comments

Scope

docs:read

Path parameters

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

Query parameters

-   `limit` number
    
    Comments per response, 1 to 100 (default 50). A response can hold fewer when deleted comments are skipped.
    
-   `since` number|string
    
    Only comments created after this time, as Unix milliseconds or an ISO 8601 time with a timezone. The time is exclusive.
    
-   `resolved` boolean
    
    true for resolved threads only, false for unresolved
    
-   `authorId` string
    
    Only comments by this user ID, or me
    
-   `assigneeId` string
    
    Only comments assigned to this user ID, or me
    
-   `parent` string
    
    root for top-level comments only, or a comment ID for that comment's replies
    
-   `cursor` string
    
    nextCursor from the previous response. It is null on the last response.
    

Request

curl

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

Response

JSON

```
{
  "comments": [
    {
      "_id": "cmt_abc123",
      "pageId": "doc_abc123",
      "authorId": "usr_abc123",
      "parentId": null,
      "anchorId": null,
      "anchorExcerpt": null,
      "content": [
        {
          "type": "p",
          "children": [
            {
              "text": "Ready",
              "bold": true
            }
          ]
        }
      ],
      "contentText": "Ready",
      "resolved": false,
      "isExternal": false,
      "createdAt": 1706788800000,
      "updatedAt": 1706797800000
    }
  ],
  "nextCursor": null
}
```

### POST /api/v1/docs/:id/comments

Scope

docs:write

Path parameters

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

Body parameters

-   `content` string|array required
    
    Plain text, Markdown, or Plate JSON blocks. Up to 50,000 visible characters and 128 KB serialized. It cannot be empty.
    
-   `contentFormat` string
    
    plaintext, markdown, or platejs
    
-   `parentId` string
    
    Comment to reply to. Threads are one level deep, so a reply to a reply joins the same thread.
    
-   `anchorId` string
    
    ID for an inline comment anchor. Send it with anchorExcerpt. Replies use their thread's anchor.
    
-   `anchorExcerpt` string
    
    Text in the doc the comment is about. Longer text is cut to 200 characters.
    
-   `model` string
    
    Model doing the writing, such as claude-opus-5-5. 100 characters or less. Shown on what it writes.
    
-   `effort` string
    
    Reasoning effort the model is running at, such as high. 32 characters or less. Shown with the model.
    

Request

curl

```
curl --request POST \
  --url 'https://projectfeed.app/api/v1/docs/doc_abc123/comments' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "content": "Ready for review."
}'
```

Response

JSON

```
{
  "_id": "cmt_abc123",
  "pageId": "doc_abc123",
  "authorId": "usr_abc123",
  "parentId": null,
  "anchorId": null,
  "anchorExcerpt": null,
  "content": [
    {
      "type": "p",
      "children": [
        {
          "text": "Ready",
          "bold": true
        }
      ]
    }
  ],
  "contentText": "Ready",
  "resolved": false,
  "isExternal": false,
  "createdAt": 1706788800000,
  "updatedAt": 1706797800000
}
```

### PATCH /api/v1/docs/:id/comments/:commentId

Scope

docs:write

Path parameters

-   `id` string required
    
    Doc ID (URL path)
    
-   `commentId` string required
    
    Comment ID on that doc (URL path)
    

Body parameters

-   `content` string|array required
    
    Replacement content. Up to 50,000 visible characters and 128 KB serialized.
    
-   `contentFormat` string
    
    plaintext, markdown, or platejs
    
-   `expectedUpdatedAt` number
    
    The updatedAt you last read for this comment. If the comment has changed since, the request returns 412 and nothing is written. An If-Match header with W/"<updatedAt>" does the same.
    

Request

curl

```
curl --request PATCH \
  --url 'https://projectfeed.app/api/v1/docs/doc_abc123/comments/cmt_abc123' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "content": "Ready for review."
}'
```

Response

JSON

```
{
  "_id": "cmt_abc123",
  "pageId": "doc_abc123",
  "authorId": "usr_abc123",
  "parentId": null,
  "anchorId": null,
  "anchorExcerpt": null,
  "content": [
    {
      "type": "p",
      "children": [
        {
          "text": "Ready to ship"
        }
      ]
    }
  ],
  "contentText": "Ready to ship",
  "resolved": false,
  "isExternal": false,
  "createdAt": 1706788800000,
  "updatedAt": 1706801400000
}
```

### DELETE /api/v1/docs/:id/comments/:commentId

Scope

docs:write

Path parameters

-   `id` string required
    
    Doc ID (URL path)
    
-   `commentId` string required
    
    Comment ID on that doc (URL path)
    

Request

curl

```
curl --request DELETE \
  --url 'https://projectfeed.app/api/v1/docs/doc_abc123/comments/cmt_abc123' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY'
```

Response

HTTP

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

### POST /api/v1/docs/:id/comments/:commentId/resolve

Scope

docs:write

Path parameters

-   `id` string required
    
    Doc ID (URL path)
    
-   `commentId` string required
    
    Comment ID on that doc (URL path)
    

Request

curl

```
curl --request POST \
  --url 'https://projectfeed.app/api/v1/docs/doc_abc123/comments/cmt_abc123/resolve' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY'
```

Response

JSON

```
{
  "_id": "cmt_abc123",
  "pageId": "doc_abc123",
  "authorId": "usr_abc123",
  "parentId": null,
  "anchorId": null,
  "anchorExcerpt": null,
  "content": [
    {
      "type": "p",
      "children": [
        {
          "text": "Ready",
          "bold": true
        }
      ]
    }
  ],
  "contentText": "Ready",
  "resolved": true,
  "isExternal": false,
  "createdAt": 1706788800000,
  "updatedAt": 1706797800000
}
```

### POST /api/v1/docs/:id/comments/:commentId/reopen

Scope

docs:write

Path parameters

-   `id` string required
    
    Doc ID (URL path)
    
-   `commentId` string required
    
    Comment ID on that doc (URL path)
    

Request

curl

```
curl --request POST \
  --url 'https://projectfeed.app/api/v1/docs/doc_abc123/comments/cmt_abc123/reopen' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY'
```

Response

JSON

```
{
  "_id": "cmt_abc123",
  "pageId": "doc_abc123",
  "authorId": "usr_abc123",
  "parentId": null,
  "anchorId": null,
  "anchorExcerpt": null,
  "content": [
    {
      "type": "p",
      "children": [
        {
          "text": "Ready",
          "bold": true
        }
      ]
    }
  ],
  "contentText": "Ready",
  "resolved": false,
  "isExternal": false,
  "createdAt": 1706788800000,
  "updatedAt": 1706797800000
}
```

### GET /api/v1/docs/:id/comments/:commentId/reactions

Scopes

docs:read

reactions:read

Path parameters

-   `id` string required
    
    Doc ID (URL path)
    
-   `commentId` string required
    
    Comment ID on that doc (URL path)
    

Request

curl

```
curl --request GET \
  --url 'https://projectfeed.app/api/v1/docs/doc_abc123/comments/cmt_abc123/reactions' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY'
```

Response

JSON

```
{
  "reactions": [
    { "emoji": "👍", "count": 2 },
    {
      "emoji": "custom:shipit",
      "count": 1,
      "isCustom": true,
      "name": "shipit",
      "imageUrl": "/api/media/reactions/shipit.png"
    }
  ],
  "total": 3
}
```

### POST /api/v1/docs/:id/comments/:commentId/reactions

Scopes

docs:read

reactions:write

Path parameters

-   `id` string required
    
    Doc ID (URL path)
    
-   `commentId` string required
    
    Comment ID on that doc (URL path)
    

Body parameters

-   `emoji` string required
    
    Unicode emoji, or custom:name for a custom reaction. Up to 32 characters.
    
-   `action` string
    
    add, remove, or toggle (default). add and remove are safe to retry: a repeat changes nothing and returns 200 with changed set to false
    

Request

curl

```
curl --request POST \
  --url 'https://projectfeed.app/api/v1/docs/doc_abc123/comments/cmt_abc123/reactions' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "emoji": "👍"
}'
```

Response

JSON

```
{ "action": "added", "emoji": "👍" }
```

### GET /api/v1/docs/recent

Scope

docs:read

Query parameters

-   `scope` string
    
    all (default) for every doc you can see, yours for docs you created, or edited for docs you have edited
    
-   `projectId` string
    
    Only docs in this project's spaces, by ID or slug. Add includeWorkspace to keep workspace docs too.
    
-   `includeWorkspace` boolean
    
    With projectId, also include docs outside any project
    
-   `visibility` string
    
    public, private, or shared
    
-   `since` number|string
    
    Only docs edited after this time, as Unix milliseconds or an ISO 8601 time with a timezone. The time is exclusive.
    
-   `limit` number
    
    Docs per response, 1 to 100 (default 50)
    
-   `cursor` string
    
    nextCursor from the previous response
    

Request

curl

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

Response

JSON

```
{
  "pages": [
    {
      "id": "doc_abc123",
      "identifier": "DOC-12",
      "spaceId": "spc_abc123",
      "parentPageId": null,
      "title": "Launch runbook",
      "slug": "launch-runbook",
      "icon": null,
      "url": "https://projectfeed.app/acme/docs/launch-runbook",
      "visibility": "shared",
      "state": "active",
      "locked": false,
      "wordCount": 2,
      "readTimeMinutes": 1,
      "currentVersion": 4,
      "createdBy": "usr_abc123",
      "createdAt": 1779600000000,
      "updatedAt": 1779680000000,
      "lastEditedBy": "usr_def456",
      "lastEditedAt": 1779680000000,
      "archivedAt": null
    }
  ],
  "hasMore": false,
  "nextCursor": null
}
```

### GET /api/v1/docs/watching

Scope

docs:read

Query parameters

-   `projectId` string
    
    Only docs in this project's spaces, by ID or slug. Add includeWorkspace to keep workspace docs too.
    
-   `includeWorkspace` boolean
    
    With projectId, also include docs outside any project
    
-   `visibility` string
    
    public, private, or shared
    
-   `since` number|string
    
    Only docs edited after this time, as Unix milliseconds or an ISO 8601 time with a timezone. The time is exclusive.
    
-   `limit` number
    
    Docs per response, 1 to 100 (default 50)
    
-   `cursor` string
    
    nextCursor from the previous response
    

Request

curl

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

Response

JSON

```
{
  "pages": [
    {
      "id": "doc_abc123",
      "identifier": "DOC-12",
      "spaceId": "spc_abc123",
      "parentPageId": null,
      "title": "Launch runbook",
      "slug": "launch-runbook",
      "icon": null,
      "url": "https://projectfeed.app/acme/docs/launch-runbook",
      "visibility": "shared",
      "state": "active",
      "locked": false,
      "wordCount": 2,
      "readTimeMinutes": 1,
      "currentVersion": 4,
      "createdBy": "usr_abc123",
      "createdAt": 1779600000000,
      "updatedAt": 1779680000000,
      "lastEditedBy": "usr_def456",
      "lastEditedAt": 1779680000000,
      "archivedAt": null
    }
  ],
  "hasMore": false,
  "nextCursor": null
}
```

### GET /api/v1/docs/awaiting-me

Scope

docs:read

Query parameters

-   `limit` number
    
    Docs per response, 1 to 50 (default 50)
    

Request

curl

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

Response

JSON

```
{
  "pages": [
    {
      "id": "doc_abc123",
      "identifier": "DOC-12",
      "spaceId": "spc_abc123",
      "parentPageId": null,
      "title": "Launch runbook",
      "slug": "launch-runbook",
      "icon": null,
      "url": "https://projectfeed.app/acme/docs/launch-runbook",
      "visibility": "shared",
      "state": "active",
      "locked": false,
      "wordCount": 2,
      "readTimeMinutes": 1,
      "currentVersion": 4,
      "createdBy": "usr_abc123",
      "createdAt": 1779600000000,
      "updatedAt": 1779680000000,
      "lastEditedBy": "usr_def456",
      "lastEditedAt": 1779680000000,
      "archivedAt": null
    }
  ],
  "capped": false
}
```

### GET /api/v1/docs/tree

Scope

docs:read

Query parameters

-   `spaceId` string required
    
    Space ID or slug
    
-   `depth` number
    
    Levels to return, 1 to 5 (default 3). A node deeper than that has hasChildren set and no children.
    

Request

curl

```
curl --request GET \
  --url 'https://projectfeed.app/api/v1/docs/tree?spaceId=spc_abc123' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY'
```

Response

JSON

```
{
  "spaceId": "spc_abc123",
  "pages": [
    {
      "id": "doc_abc123",
      "identifier": "DOC-12",
      "parentPageId": null,
      "title": "Launch runbook",
      "slug": "launch-runbook",
      "icon": null,
      "visibility": "shared",
      "locked": false,
      "hasChildren": true,
      "children": [
        {
          "id": "doc_def456",
          "identifier": "DOC-13",
          "parentPageId": "doc_abc123",
          "title": "Rollback steps",
          "slug": "rollback-steps",
          "icon": null,
          "visibility": "shared",
          "locked": false,
          "hasChildren": false
        }
      ]
    }
  ],
  "truncated": false
}
```

### GET /api/v1/docs/:id/children

Scope

docs:read

Path parameters

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

Request

curl

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

Response

JSON

```
{
  "children": [
    {
      "id": "doc_abc123",
      "identifier": "DOC-12",
      "parentPageId": null,
      "title": "Launch runbook",
      "slug": "launch-runbook",
      "icon": null,
      "visibility": "shared",
      "locked": false,
      "hasChildren": true
    }
  ],
  "truncated": false
}
```

### GET /api/v1/docs/:id/backlinks

Scope

docs:read

Path parameters

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

Request

curl

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

Response

JSON

```
{
  "backlinks": [
    {
      "type": "task",
      "id": "tsk_abc123",
      "title": "Write the launch runbook",
      "subtitle": "In review",
      "identifier": "PRO-42",
      "url": "https://projectfeed.app/acme/task/PRO-42",
      "updatedAt": 1779680000000
    }
  ],
  "capped": false
}
```

### GET /api/v1/docs/:id/versions/:version

Scope

docs:read

Path parameters

-   `id` string required
    
    Doc ID (URL path)
    
-   `version` number required
    
    Version number (URL path)
    

Query parameters

-   `format` string
    
    Set to markdown to get content as a Markdown string
    

Request

curl

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

Response

JSON

```
{
  "id": "doc_abc123",
  "pageId": "doc_abc123",
  "version": 3,
  "title": "Launch runbook",
  "content": [{ "type": "p", "children": [{ "text": "Launch checklist" }] }],
  "contentFormat": "platejs",
  "contentText": "Launch checklist",
  "changeNote": "Added rollback steps",
  "isAutosave": false,
  "editedBy": "usr_def456",
  "createdAt": 1779680000000,
  "currentVersion": 4
}
```

### GET /api/v1/docs/:id/shares

Scope

docs:read

Path parameters

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

Request

curl

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

Response

JSON

```
{
  "shares": [
    {
      "userId": "usr_def456",
      "name": "Sam Rivera",
      "role": "edit",
      "createdAt": 1779600000000,
      "updatedAt": 1779680000000
    }
  ],
  "truncated": false
}
```

### PUT /api/v1/docs/:id/shares/:userId

Scope

docs:write

Path parameters

-   `id` string required
    
    Doc ID (URL path)
    
-   `userId` string required
    
    User ID of the workspace member (URL path)
    

Body parameters

-   `role` string required
    
    view, comment, edit, or manage
    

Request

curl

```
curl --request PUT \
  --url 'https://projectfeed.app/api/v1/docs/doc_abc123/shares/usr_abc123' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "role": "edit"
}'
```

Response

JSON

```
{
  "userId": "usr_def456",
  "name": "Sam Rivera",
  "role": "edit",
  "createdAt": 1779600000000,
  "updatedAt": 1779680000000
}
```

### DELETE /api/v1/docs/:id/shares/:userId

Scope

docs:write

Path parameters

-   `id` string required
    
    Doc ID (URL path)
    
-   `userId` string required
    
    User ID of the workspace member (URL path)
    

Request

curl

```
curl --request DELETE \
  --url 'https://projectfeed.app/api/v1/docs/doc_abc123/shares/usr_abc123' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY'
```

Response

HTTP

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

### GET /api/v1/docs/templates

Scope

docs:read

Query parameters

-   `limit` number
    
    Custom templates per page, 1 to 100 (default 50)
    
-   `cursor` string
    
    nextCursor from the previous response
    

Request

curl

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

Response

JSON

```
{
  "templates": [
    {
      "id": "tpl_abc123",
      "name": "Meeting notes",
      "description": "Agenda, notes, and actions",
      "icon": "📝",
      "builtIn": false,
      "createdAt": 1779600000000
    }
  ],
  "hasMore": false,
  "nextCursor": null
}
```

### GET /api/v1/docs/templates/:templateId

Scope

docs:read

Path parameters

-   `templateId` string required
    
    Template ID (URL path)
    

Request

curl

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

Response

JSON

```
{
  "id": "tpl_abc123",
  "name": "Meeting notes",
  "description": "Agenda, notes, and actions",
  "icon": "📝",
  "builtIn": false,
  "createdAt": 1779600000000,
  "content": [{ "type": "p", "children": [{ "text": "Agenda" }] }]
}
```

### POST /api/v1/docs/templates

Scope

docs:write

Body parameters

-   `name` string required
    
    Template name, up to 80 characters
    
-   `content` string|array required
    
    Template body as plain text, Markdown, or Plate JSON blocks
    
-   `contentFormat` string
    
    plaintext, markdown, or platejs. When omitted, a Plate JSON array is read as blocks and any other string as plain text.
    
-   `description` string
    
    Description, up to 500 characters
    
-   `icon` string
    
    Icon, up to 100 characters
    
-   `idempotencyKey` string
    
    Same as the Idempotency-Key header. A retry with the same key returns the first result.
    

Request

curl

```
curl --request POST \
  --url 'https://projectfeed.app/api/v1/docs/templates' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "Meeting notes",
  "content": "# Agenda",
  "contentFormat": "markdown"
}'
```

Response

JSON

```
{
  "id": "tpl_abc123",
  "name": "Meeting notes",
  "description": "Agenda, notes, and actions",
  "icon": "📝",
  "builtIn": false,
  "createdAt": 1779600000000,
  "content": [{ "type": "p", "children": [{ "text": "Agenda" }] }]
}
```

### DELETE /api/v1/docs/templates/:templateId

Scope

docs:write

Path parameters

-   `templateId` string required
    
    Template ID (URL path)
    

Request

curl

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

Response

HTTP

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

## Who can do what

Project-restricted credentials can list and view spaces in their selected projects and create private docs there. Creation accepts plain text or Markdown, without a template. Other Docs operations remain unavailable to these credentials. These restrictions apply through the API, MCP, and CLI.

A key acts as a workspace member, and the same access rules as the app apply. Viewers can read but never write.

Read, list versions, list comments

Any member who can see the doc. A private doc, or a doc in a private space, is limited to owners, admins, its creator, and people it is shared with. Docs in a project space follow project access.

Create

Owners, admins, and members who can see an active space. In a project space you also need write access to the project, and a read-only project returns 403.

Update title or icon, replace content, restore a version, move

Owners, admins, the doc's creator, and members for docs that are not private. A private doc needs an edit share. Only owners and admins can edit a locked doc, and nobody can edit an archived one.

Change visibility, archive

Owners, admins, the creator, and people with the Can manage share.

Restore from archive

Owners, admins, and the creator.

Delete

The same people who can archive. The doc can be active or archived, and it must have no subdocs.

Duplicate

Owners, admins, and members who can see the doc. In a project space you also need write access to the project.

Lock and unlock

Owners and admins.

List shares

Anyone who can open the doc.

Share and unshare

Anyone with edit access to the doc. Only managers can grant manage or change a manager's access.

List and read templates

Any member who can read docs.

Create and delete templates

Owners and admins. Creating a template also needs a Pro plan.

Watch and unwatch

Owners, admins, and members who can see the doc.

Create, resolve, reopen, and react to comments

Members who can comment on the doc. Archived docs refuse new comment activity.

Edit a comment

Its author only.

Delete a comment

Its author, owners, and admins.

## Find and browse docs

Everywhere a path takes a doc `id`, you can send an identifier such as `DOC-12` instead. These routes show only docs you can open.

-   `GET /docs/recent` lists recently edited docs, newest edit first. `scope=yours` keeps docs you created and `scope=edited` keeps docs you have edited. Narrow it with `projectId`, `includeWorkspace`, `visibility`, and `since`. Page with `nextCursor`.
-   `GET /docs/watching` lists the docs you watch with the same filters, without `scope`.
-   `GET /docs/awaiting-me` lists docs that have unresolved comments assigned to you. It has no cursor, and `capped` is true when more may exist.
-   `GET /docs/tree` returns a space as nested nodes. `depth` runs from 1 to 5 and defaults to 3. `truncated` is true when the node limit or a 500-row child scan prevents a complete result. A capped presence scan sets `hasChildren` to true because more readable children may exist. A node cut off by the depth has `hasChildren` set and no `children`.
-   `GET /docs/:id/children` returns one doc's direct subpages, so you can walk deeper than the tree went.
-   `GET /docs/:id/backlinks` returns the docs, posts, and tasks that link to the doc.

The doc list also filters by `parentId`, `q`, `lastEditedBy`, and `locked`. Sort it with `sort` and `order`. A sorted list reads the newest 500 visible docs, so check `truncated`.

## Share a doc

A share gives one workspace member a role on a doc. The roles are `view`, `comment`, `edit`, and `manage`.

-   Anyone who can open the doc can list its shares. The list has names and roles, never emails.
-   Sharing and unsharing need edit access to the doc. Only managers can grant manage or change a manager's access, and anyone else gets 403.
-   Sharing a doc with yourself returns 400. A user who is not an active workspace member returns 404.
-   Sending the role a member already has returns their share unchanged.
-   Removing a share that does not exist returns 404.

## Templates

Templates are starting points for new docs. The list holds the built-in templates and your workspace's custom ones, without their content. Get one template to read its content as Plate JSON blocks. Any member who can read docs can do both.

Creating a custom template needs a workspace owner or admin on a Pro plan, and returns 403 otherwise. Send `name` and `content`. The request accepts an `idempotencyKey`. Deleting a template is for owners and admins. Built-in templates cannot be deleted and return 400.

To create a doc from a template, send its ID as `templateId` to `POST /docs` instead of `content`. Sending both returns 400. The title defaults to the template name and the icon to the template icon.

Shell

```
curl --request POST \
  --url 'https://projectfeed.app/api/v1/docs' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{ "spaceId": "spc_abc123", "templateId": "tpl_abc123" }'
```

## Nest a doc under another doc

`POST /api/v1/docs` has no parent field and always creates a doc at the top level of the space.

1.  1.
    
    ### Create the doc
    
    Send `spaceId` and any title or content. Keep the `id` from the 201 response.
    
2.  2.
    
    ### Move it under the parent
    
    Call `POST /api/v1/docs/:id/move` with `parentId`. Leave out `spaceId` to stay in the same space. The parent must be an active doc in the target space.
    

Shell

```
curl --request POST \
  --url 'https://projectfeed.app/api/v1/docs/doc_def456/move' \
  --header 'Authorization: Bearer pf_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{ "parentId": "doc_abc123" }'
```

## Move rules

-   The doc and everything under it move together. A doc cannot move under itself or one of its own subdocs.
-   Leaving out parentId moves the doc to the top level of the target space, even when it is nested today.
-   You need edit access to the doc and to the new parent. An archived parent is refused with 409.
-   A move into or out of a private space or a project space, or into or out of a private doc's tree, changes who can see the doc. Those moves need manage access to the doc. A move into the space of a read-only project returns 403.
-   On a move to another space, the slug changes if the target space already has a doc with the same slug.

## Replace content and restore versions

A replace or restore overwrites the whole doc, including edits in an open editor, and closes open editor sessions. Send baseVersion on a replace or expectedVersion on a restore to refuse the request when the doc has moved on. Without them the last request wins. Every replace records a version, and a restore records a new one rather than rewinding history. To change part of a doc without closing editors, use Edit blocks.

`status`

completed when the version is recorded, or pending while it is still being recorded. A pending status comes with a 202 response.

`version`

Number of the version that holds the new content. It is left out while status is pending.

`generation`

A counter that goes up each time the live content of the doc is replaced. It is informational, and no request accepts it.

After a 202, fetch the doc again to confirm the new content before you build on it. If another replace is still in progress, the request fails with 400 and a message. Wait and send it again.

## Edit blocks

POST /api/v1/docs/:id/blocks changes top-level blocks in the live doc. Open editors stay connected and merge the change. Name a block by its `blockId` (the block's `id` in the doc content) or by its 0-based `index` when it has no id. Operations apply in order, so each one sees the doc the ones before it produced.

`replace`

blockId or index, expected (the block as you read it), and block (the new block). The new block keeps the old block's id.

`delete`

blockId or index, and expected.

`insert`

block with a new id, and afterBlockId, or afterIndex with afterExpected. Leave both out to insert at the top. An id already in the doc returns 412.

A 412 lists each refused operation in `conflicts` with its position, a reason (changed, missing, or duplicate_id), and the block as it is now in `current`. Nothing is written when any operation is refused. Apply your change to `current` and send it again. The response lists each written block in `blocks` as the doc stores it, with null for a delete. Use those as `expected` next time. A block must stay a single block, so send each line break as its own block. The blocks you write can total 300,000 characters of JSON per request; split a larger edit into several requests. The doc's saved versions and contentText catch up a few seconds later.

If a request times out, read the doc before you retry. An edit that already landed returns 412 on a retry, because its blocks no longer match expected, and an insert finds its id in place.

## Comments

Comment responses carry these fields, and you can rely on them: `_id`, `pageId` (the doc ID), `authorId`, `parentId`, `anchorId`, `anchorExcerpt`, `content`, `contentText`, `resolved`, `isExternal`, `createdAt`, and `updatedAt`. Responses also include other fields, such as `organizationId`, `audience`, `attachments`, and `reactions`. They are not part of the contract and can change.

-   Replies have a parentId. Every comment and reply is a separate item in the list.
-   A comment from someone outside the workspace has isExternal set to true and may have no authorId.
-   A deleted comment stays in the list with empty content, so its replies keep their place.
-   The comment ID must belong to the doc in the path, or the request returns 404.
-   Anchoring a comment with anchorId and anchorExcerpt does not change the doc in the same request. The highlight is added to the doc after the comment is saved.

Comment reactions need a docs scope and a reactions scope together: `docs:read` with `reactions:read` to list them, and `docs:read` with `reactions:write` to add or remove one. Sending the same emoji again removes your reaction. A comment holds at most 20 different emoji and 1,000 reactions, and going past either returns 409.

## Errors

Error bodies follow the [error format](https://projectfeed.app/docs/api/errors). Read the `detail` message, because the same cause can return different statuses depending on the endpoint.

-   400: invalid body or ID, content over 1 MB, an empty title or comment, a replace that is still syncing, content sent together with templateId, sharing a doc with yourself, deleting a built-in template, sort combined with updatedSince, or an action your access does not allow on that endpoint.
-   403: the key lacks a scope, the project is read-only, you are not allowed to edit or delete that comment, you cannot grant manage on a share, or you are not an owner or admin on a Pro plan creating a template.
-   404: the doc, space, version, comment, share, template, or workspace member does not exist or you cannot see it.
-   409: a delete of a doc that has subdocs, a move under an archived parent, or a reaction limit.
-   429: the rate limit. See [rate limits](https://projectfeed.app/docs/api/rate-limits).

## Next steps

-   [Spaces API](https://projectfeed.app/docs/api/spaces): create the space that holds a doc.
-   [Webhooks](https://projectfeed.app/docs/api/webhooks): get `docs.created`, `docs.updated`, `docs.renamed`, `docs.archived`, `docs.restored`, `docs.moved`, and `docs.deleted` events, plus doc comment events such as `docs.comment_created`.
