Skip to main content

Documents API

Space-scoped document wiki endpoints are available under /api/v1.0/spaces/{slug}/documents. They manage document trees, drafts, reviews, revisions, comments, attachments, diagrams, embedded polls, and search indexing.

All endpoints require authentication and access to the target space.

Page Tree

MethodEndpointDescription
GET/spaces/{slug}/documents/treeList the document page tree.
POST/spaces/{slug}/documents/pagesCreate a page draft.
GET/spaces/{slug}/documents/pages/{page_id}Fetch one page.
PATCH/spaces/{slug}/documents/pages/{page_id}/treeUpdate title, parent, position, or owners.
DELETE/spaces/{slug}/documents/pages/{page_id}Delete a page and remove it from search.

Create Page

curl -X POST "https://api.qarion.com/api/v1.0/spaces/finance/documents/pages" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Monthly Close Runbook",
"content_markdown": "# Monthly Close\n\nSteps for the finance pipeline.",
"parent_id": null,
"owner_ids": []
}'

Draft Review

MethodEndpointDescription
PUT/spaces/{slug}/documents/pages/{page_id}/draftUpdate draft content and metadata.
POST/spaces/{slug}/documents/pages/{page_id}/submitSubmit a draft for review with a change summary.
POST/spaces/{slug}/documents/pages/{page_id}/publishPublish the submitted draft.
POST/spaces/{slug}/documents/pages/{page_id}/rejectReject the submitted draft with reviewer notes.
GET/spaces/{slug}/documents/pages/{page_id}/revisionsList published revisions.

Publishing queues a background document-page reindex. Updating tree metadata for a published page also queues reindexing. Deleting a page queues removal from the document search index.

Attachments and Diagrams

MethodEndpointDescription
GET/spaces/{slug}/documents/pages/{page_id}/attachmentsList page attachments.
POST/spaces/{slug}/documents/pages/{page_id}/attachmentsUpload a file attachment.
GET/spaces/{slug}/documents/pages/{page_id}/attachments/{attachment_id}/downloadDownload an attachment.
DELETE/spaces/{slug}/documents/pages/{page_id}/attachments/{attachment_id}Delete an attachment.
POST/spaces/{slug}/documents/pages/{page_id}/diagramsCreate a draw.io diagram attachment.
PUT/spaces/{slug}/documents/pages/{page_id}/diagrams/{attachment_id}Update a draw.io diagram attachment.

File uploads are multipart form uploads using the file field. The API enforces the same attachment type and size limits as the rest of the platform.

Upload Attachment

curl -X POST "https://api.qarion.com/api/v1.0/spaces/finance/documents/pages/{page_id}/attachments" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@evidence.pdf"

Create Diagram

curl -X POST "https://api.qarion.com/api/v1.0/spaces/finance/documents/pages/{page_id}/diagrams" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"file_name": "monthly-close.drawio",
"xml": "<mxfile>...</mxfile>"
}'

Comments and Mentions

MethodEndpointDescription
GET/spaces/{slug}/documents/mention-suggestions?q={query}Suggest users for mentions.
GET/spaces/{slug}/documents/pages/{page_id}/commentsList page comments.
POST/spaces/{slug}/documents/pages/{page_id}/commentsCreate a page comment.
PUT/spaces/{slug}/documents/pages/{page_id}/comments/{comment_id}Update a comment.
DELETE/spaces/{slug}/documents/pages/{page_id}/comments/{comment_id}Delete a comment.

List endpoints return pagination headers when pagination applies.

Polls

MethodEndpointDescription
POST/spaces/{slug}/documents/pages/{page_id}/pollsCreate a poll and return its embeddable ID.
GET/spaces/{slug}/documents/pages/{page_id}/polls/{poll_id}Fetch poll options, current user vote, results visibility, and permissions.
GET/spaces/{slug}/documents/pages/{page_id}/polls/{poll_id}/votersReturn option-level voter breakdowns for poll editors.
PATCH/spaces/{slug}/documents/pages/{page_id}/polls/{poll_id}Update poll metadata, options before voting, limits, and poll access grants.
POST/spaces/{slug}/documents/pages/{page_id}/polls/{poll_id}/voteSubmit or update the current user's vote.
POST/spaces/{slug}/documents/pages/{page_id}/polls/{poll_id}/closeClose an open poll manually.

Polls support single_choice and multi_choice types. Access can inherit from the page or use direct user/team grants with view, vote, or edit levels. Embed a poll in page Markdown with:

```poll
id: POLL_ID
```

Create Poll

curl -X POST "https://api.qarion.com/api/v1.0/spaces/finance/documents/pages/{page_id}/polls" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Adopt the new incident review template?",
"description": "Vote before the next governance meeting.",
"poll_type": "single_choice",
"options": [{"label": "Yes"}, {"label": "No"}],
"inherit_page_access": true
}'

Error Notes

StatusMeaning
403The user cannot review, edit, or delete the requested resource.
404The page, attachment, revision, or comment was not found in the space.
413Uploaded file exceeds the configured size limit.
422Uploaded file type is not allowed or request validation failed.