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.
[
{
"type": "p",
"children": [
{
"text": "Launch is scheduled for Friday."
}
]
}
]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-filestringrequiredPlate JSON content file, or - for stdin
--change-notestringNote describing the change
Example
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-filestringrequiredJSON array of block operations, or - for stdin. See Edit blocks in the Docs API.
Example
pf docs edit-blocks <doc-id> --operations-file edits.jsonpf docs versions <id>List a doc's versions
Options
--limitnumberMaximum results, 1 to 200 (default 50)
--cursorstringCursor from the previous page
Example
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-versionnumberFail with 412 if the doc is no longer at this version
Example
pf docs restore-version <doc-id> 3 --expected-version 7pf docs version <id> <version>View one saved version of a doc. Content shows with --content or --markdown.
Options
--markdownbooleanReturn the content as Markdown
--contentbooleanInclude the content body
Example
pf docs version DOC-12 3
pf docs version DOC-12 3 --markdownpf docs recentList recently edited docs, newest edit first
Options
--scopestringall (default), yours for docs you created, or edited for docs you edited
--in-projectstringOnly docs in this project, by ID or slug
--include-workspacebooleanWith --in-project, include workspace docs too
--visibilitystringpublic, private, or shared
--sincestringOnly docs edited after this time, as Unix milliseconds or an ISO 8601 time
--limitnumberMaximum results, 1 to 100 (default 50)
--cursorstringCursor from the previous page
Example
pf docs recent
pf docs recent --scope yours --in-project launch --since 2026-10-01T00:00:00Zpf docs watchingList the docs you watch, newest edit first
Options
--in-projectstringOnly docs in this project, by ID or slug
--include-workspacebooleanWith --in-project, include workspace docs too
--visibilitystringpublic, private, or shared
--sincestringOnly docs edited after this time, as Unix milliseconds or an ISO 8601 time
--limitnumberMaximum results, 1 to 100 (default 50)
--cursorstringCursor from the previous page
Example
pf docs watching --in-project launchpf docs awaiting-meList docs that have unresolved comments assigned to you
Options
--limitnumberMaximum results, 1 to 50 (default 50)
Example
pf docs awaiting-me --jsonpf 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
--spacestringrequiredSpace ID or slug
--depthnumberLevels to show, 1 to 5 (default 3)
Example
pf docs tree --space handbook --depth 2pf docs children <id>List a doc's direct subpages and report when a child scan leaves the result incomplete
Example
pf docs children DOC-12pf docs backlinks <id>List the docs, posts, and tasks that link to a doc
Example
pf docs backlinks DOC-12 --jsonpf docs shares <id>List who a doc is shared with. Anyone who can open the doc can run it. Emails are not shown.
Example
pf docs shares DOC-12pf 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
--rolestringrequiredview, comment, edit, or manage
Example
pf docs share DOC-12 <user-id> --role commentpf docs unshare <id> <userId>Stop sharing a doc with someone. Needs edit access to the doc.
Options
--confirmbooleanSkip the confirmation prompt
--dry-runbooleanPreview without making changes
Example
pf docs unshare DOC-12 <user-id> --confirmpf docs templatesList the built-in and custom doc templates
Example
pf docs templates --jsonpf docs template <templateId>View a doc template
Options
--contentbooleanInclude the template content
Example
pf docs template <template-id> --contentpf docs template-create <name>Create a custom template. Owners and admins on a Pro plan only.
Options
--contentstringrequiredTemplate body: text, @path to read a file, or - for stdin
--content-formatstringplaintext, markdown, or platejs. Use platejs for a Plate JSON array.
--descriptionstringDescription, up to 500 characters
--iconstringTemplate icon
--idempotency-keystringRetry key, so a repeated command does not create two templates
Example
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
--confirmbooleanSkip the confirmation prompt
--dry-runbooleanPreview without making changes
Example
pf docs template-delete <template-id> --confirmReplace content safely
printf '[{"type":"p","children":[{"text":"Launch is scheduled for Friday."}]}]' | pf docs set-content <doc-id> --content-file -- 1.
Check the current body
Run
pf docs view <doc-id> --contentand confirm the current document and structure. - 2.
Note a restorable version
Run
pf docs versions <doc-id>and note the version you can restore. - 3.
Replace the content
Validate that the input is JSON and that its top-level value is a Plate node array, then use
set-contentwith a useful change note. - 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.