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.
POST https://api.parcelengineering.com/api/v1/workspace/knowledge/pages/managePOST https://api.parcelengineering.com/api/v1/workspace/knowledge/pages/manage/batchOne 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.
| Command | Fields | What it does |
|---|---|---|
create | title, optional path (default root), description, body | Makes a page. 409 path_title_taken if a live page has that folder and title. |
str_replace | page, expected_revision, old_text, new_text | Replaces old_text, which must occur exactly once (409 not_unique with details.count otherwise). |
insert | page, expected_revision, text, optional after_heading | Adds text at the end of that heading’s section, or at the end of the page. |
replace | page, expected_revision, any of body, title, description | Replaces what you send. Omit a field to keep it; description: null clears it. |
move | page, expected_revision, path, optional title | Moves the page to another folder, and renames it if title is sent. |
delete | page, expected_revision | Archives the page. Its revisions stay. |
restore | page | Brings 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
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" }'const response = await fetch( 'https://api.parcelengineering.com/api/v1/workspace/knowledge/pages/manage', { method: 'POST', headers: { 'Authorization': 'Bearer pcl_your_api_key', 'Content-Type': 'application/json', }, body: JSON.stringify({ 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', }), });
const { data, metadata } = await response.json();Response
The page after the command, with its new revision. The body is not echoed; body_chars is its length.
{ "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.
{ "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
POST https://api.parcelengineering.com/api/v1/workspace/knowledge/pages/purgePOST https://api.parcelengineering.com/api/v1/workspace/knowledge/pages/purge/batchdelete 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.