Skip to content

Workspace API

Manage Knowledge Pages

Create, edit, move, archive, restore and delete knowledge pages with POST /workspace/knowledge/pages/manage, /purge and their /batch siblings.

Endpoint
POST https://api.parcelengineering.com/api/v1/workspace/knowledge/pages/manage
POST https://api.parcelengineering.com/api/v1/workspace/knowledge/pages/manage/batch

One route runs every page command, chosen by command. Each costs 0 credits and requires knowledge:write. Pass workspace_id as a query parameter when authenticating with a user JWT; API keys infer it. A write by an API key is recorded as the key, and as the member who created it.

Commands

page is a page id or its folder/Title ref. Every edit sends the expected_revision it read; a stale one is 409 revision_conflict with details.current_revision.

CommandFieldsWhat it does
createtitle, optional path (default root), description, bodyMakes a page. 409 path_title_taken if a live page has that folder and title.
str_replacepage, expected_revision, old_text, new_textReplaces old_text, which must occur exactly once (409 not_unique with details.count otherwise).
insertpage, expected_revision, text, optional after_headingAdds text at the end of that heading’s section, or at the end of the page.
replacepage, expected_revision, any of body, title, descriptionReplaces what you send. Omit a field to keep it; description: null clears it.
movepage, expected_revision, path, optional titleMoves the page to another folder, and renames it if title is sent.
deletepage, expected_revisionArchives the page. Its revisions stay.
restorepageBrings an archived page back.

Titles are at most 200 characters, descriptions 600, and bodies 1,000,000 (413 too_large past that). An archived page refuses every edit but restore with 409 page_archived.

Example

Add a line to a section
curl -X POST https://api.parcelengineering.com/api/v1/workspace/knowledge/pages/manage \
-H "Authorization: Bearer pcl_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"command": "insert",
"page": "Go-to-market/ICP",
"expected_revision": 3,
"text": "- Also: owner-operators building 20+ units a year.",
"after_heading": "Who we sell to"
}'

Response

The page after the command, with its new revision. The body is not echoed; body_chars is its length.

Response
{
"data": {
"page": {
"id": "5d3c9a1e-0001-4b7d-9e5a-000000000020",
"path": "Go-to-market",
"title": "ICP",
"ref": "Go-to-market/ICP",
"description": "Who Parcel sells to and why.",
"revision": 4,
"created_by": "5d3c9a1e-0001-4b7d-9e5a-000000000013",
"updated_by": "5d3c9a1e-0001-4b7d-9e5a-000000000013",
"updated_by_run": null,
"archived_at": null,
"created_at": "2026-10-01T12:00:00.000Z",
"updated_at": "2026-10-16T12:05:00.000Z",
"body_chars": 1893
}
},
"metadata": { "credits": 0 }
}

Batch

POST .../pages/manage/batch takes { "inputs": [...] }, 1-100 commands of any kind. Each runs on its own, in order, so a later command sees an earlier one’s revision. One failure never stops the rest. Results come back in input order; a successful item’s record is the page.

Response
{
"data": {
"results": [
{ "index": 0, "status": "ok", "record": { "id": "5d3c9a1e-0001-4b7d-9e5a-000000000022", "ref": "Personas", "revision": 1 } },
{
"index": 1,
"status": "error",
"error": { "code": "page_not_found", "message": "No knowledge page matches \"Nowhere/Page\"." }
}
]
},
"metadata": { "credits": 0, "succeeded": 1, "failed": 1 }
}

The first record is abbreviated here; each carries every page field.

Delete for good

Endpoint
POST https://api.parcelengineering.com/api/v1/workspace/knowledge/pages/purge
POST https://api.parcelengineering.com/api/v1/workspace/knowledge/pages/purge/batch

delete archives; purge removes an archived page for good, with its revisions, sections, files and their stored objects. Nothing restores it. Send { "page": "<id or folder/Title ref>" }, or { "ids": [...] } (1-100) to the batch route. A live page is refused with 409 page_live: archive it first. Spec never purges; people and API keys do. The response is the page as it was.