Skip to content

Docs API

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.

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.

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.

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 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.

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. 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.

Next steps

  • Spaces API: create the space that holds a doc.
  • 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.
Image preview
100%