Skip to content

Doc content files and recovery

Write valid Plate JSON, replace a doc body safely, and restore an earlier version after a mistake.

Doc content files

To create a doc from plain text or Markdown, use pf docs create with --content-file notes.md --format markdown or --format plaintext. Project-restricted credentials can use these text formats to create private docs in their selected projects.

Without --format, creation reads Plate JSON, as does pf docs set-content. The top-level value must be an array of block nodes, and each text block contains a children array. Pass a file path to --content-file or use - to read JSON from stdin.

JSON
[
  {
    "type": "p",
    "children": [
      {
        "text": "Launch is scheduled for Friday."
      }
    ]
  }
]
Shell
pf docs create --space <space-id> --title "Launch notes" --content-file page.json
pf docs set-content <doc-id> --content-file page.json --change-note "Update launch plan"
pf docs set-content <id>Replace a doc's content with a Plate JSON file

Options

  • --content-filestringrequired

    Plate JSON content file, or - for stdin

  • --change-notestring

    Note describing the change

Example

Shell
pf docs set-content <doc-id> --content-file page.json --change-note "Update launch plan"
pf docs edit-blocks <id>Replace, insert, or delete blocks without closing open editors. A block that changed since you read it fails with 412.

Options

  • --operations-filestringrequired

    JSON array of block operations, or - for stdin. See Edit blocks in the Docs API.

Example

Shell
pf docs edit-blocks <doc-id> --operations-file edits.json
pf docs versions <id>List a doc's versions

Options

  • --limitnumber

    Maximum results, 1 to 200 (default 50)

  • --cursorstring

    Cursor from the previous page

Example

Shell
pf docs versions <doc-id>
pf docs restore-version <id> <version>Restore an earlier version as the current content. The restore creates a new latest version.

Options

  • --expected-versionnumber

    Fail with 412 if the doc is no longer at this version

Example

Shell
pf docs restore-version <doc-id> 3 --expected-version 7
pf docs version <id> <version>View one saved version of a doc. Content shows with --content or --markdown.

Options

  • --markdownboolean

    Return the content as Markdown

  • --contentboolean

    Include the content body

Example

Shell
pf docs version DOC-12 3
pf docs version DOC-12 3 --markdown
pf docs recentList recently edited docs, newest edit first

Options

  • --scopestring

    all (default), yours for docs you created, or edited for docs you edited

  • --in-projectstring

    Only docs in this project, by ID or slug

  • --include-workspaceboolean

    With --in-project, include workspace docs too

  • --visibilitystring

    public, private, or shared

  • --sincestring

    Only docs edited after this time, as Unix milliseconds or an ISO 8601 time

  • --limitnumber

    Maximum results, 1 to 100 (default 50)

  • --cursorstring

    Cursor from the previous page

Example

Shell
pf docs recent
pf docs recent --scope yours --in-project launch --since 2026-10-01T00:00:00Z
pf docs watchingList the docs you watch, newest edit first

Options

  • --in-projectstring

    Only docs in this project, by ID or slug

  • --include-workspaceboolean

    With --in-project, include workspace docs too

  • --visibilitystring

    public, private, or shared

  • --sincestring

    Only docs edited after this time, as Unix milliseconds or an ISO 8601 time

  • --limitnumber

    Maximum results, 1 to 100 (default 50)

  • --cursorstring

    Cursor from the previous page

Example

Shell
pf docs watching --in-project launch
pf docs awaiting-meList docs that have unresolved comments assigned to you

Options

  • --limitnumber

    Maximum results, 1 to 50 (default 50)

Example

Shell
pf docs awaiting-me --json
pf docs treeShow a space's docs as an indented tree. The command reports an incomplete result when the 500-node limit or a 500-row child scan is reached.

Options

  • --spacestringrequired

    Space ID or slug

  • --depthnumber

    Levels to show, 1 to 5 (default 3)

Example

Shell
pf docs tree --space handbook --depth 2
pf docs children <id>List a doc's direct subpages and report when a child scan leaves the result incomplete

Example

Shell
pf docs children DOC-12
pf docs backlinks <id>List the docs, posts, and tasks that link to a doc

Example

Shell
pf docs backlinks DOC-12 --json
pf docs shares <id>List who a doc is shared with. Anyone who can open the doc can run it. Emails are not shown.

Example

Shell
pf docs shares DOC-12
pf docs share <id> <userId>Share a doc with a workspace member, or change their role. Needs edit access to the doc. Only managers can grant manage.

Options

  • --rolestringrequired

    view, comment, edit, or manage

Example

Shell
pf docs share DOC-12 <user-id> --role comment
pf docs unshare <id> <userId>Stop sharing a doc with someone. Needs edit access to the doc.

Options

  • --confirmboolean

    Skip the confirmation prompt

  • --dry-runboolean

    Preview without making changes

Example

Shell
pf docs unshare DOC-12 <user-id> --confirm
pf docs templatesList the built-in and custom doc templates

Example

Shell
pf docs templates --json
pf docs template <templateId>View a doc template

Options

  • --contentboolean

    Include the template content

Example

Shell
pf docs template <template-id> --content
pf docs template-create <name>Create a custom template. Owners and admins on a Pro plan only.

Options

  • --contentstringrequired

    Template body: text, @path to read a file, or - for stdin

  • --content-formatstring

    plaintext, markdown, or platejs. Use platejs for a Plate JSON array.

  • --descriptionstring

    Description, up to 500 characters

  • --iconstring

    Template icon

  • --idempotency-keystring

    Retry key, so a repeated command does not create two templates

Example

Shell
pf docs template-create "Meeting notes" --content @meeting.md --content-format markdown
pf docs template-create "Retro" --content "# Went well" --description "Sprint retro"
pf docs template-delete <templateId>Delete a custom template. Owners and admins only. Built-in templates cannot be deleted.

Options

  • --confirmboolean

    Skip the confirmation prompt

  • --dry-runboolean

    Preview without making changes

Example

Shell
pf docs template-delete <template-id> --confirm

Replace content safely

Shell
printf '[{"type":"p","children":[{"text":"Launch is scheduled for Friday."}]}]' | pf docs set-content <doc-id> --content-file -
  1. 1.

    Check the current body

    Run pf docs view <doc-id> --content and confirm the current document and structure.

  2. 2.

    Note a restorable version

    Run pf docs versions <doc-id> and note the version you can restore.

  3. 3.

    Replace the content

    Validate that the input is JSON and that its top-level value is a Plate node array, then use set-content with a useful change note.

  4. 4.

    View it again

    If the replacement is wrong, run pf docs restore-version <doc-id> <version>.

The CLI reports invalid JSON before sending it. A server validation error usually means the JSON parsed but is not a valid Plate document, such as an object at the top level, a block without a children array, or a node type or nesting the doc editor does not support. The error names the path of the first invalid node. If an update reports that it is pending, wait for reconciliation before checking the body or restoring another version.

Fix content problems

A content replacement is pending
Wait for reconciliation, then view the doc and its versions. Do not submit another replacement or restore while the accepted generation is still settling.
Plate JSON is rejected
Validate the file as JSON, require an array at the top level, and give each block a children array. Inspect the existing body with pf docs view --content for a valid shape.
The wrong version was restored
List versions again and restore the intended version. A restore creates a new latest version, so the mistaken restore remains in history.

Next steps

Image preview
100%