Skip to main content

Overview

The Docs API lets you manage rich text documents in Copera. Documents support hierarchical nesting, Markdown content, full-text search, and asynchronous content updates. Requires a Personal Access Token (cp_pat_).
The Copera Node.js SDK and CLI fully support all Docs operations. Choose your preferred tool below.

Quick Start

# Get document tree
curl -X GET https://api.copera.ai/public/v1/docs/tree \
  -H "Authorization: Bearer cp_pat_YOUR_TOKEN"

# Create a document
curl -X POST https://api.copera.ai/public/v1/docs/ \
  -H "Authorization: Bearer cp_pat_YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "title": "My Document" }'

# Get document content as Markdown
curl -X GET https://api.copera.ai/public/v1/docs/{docId}/md \
  -H "Authorization: Bearer cp_pat_YOUR_TOKEN"

# Update document content
curl -X POST https://api.copera.ai/public/v1/docs/{docId}/md \
  -H "Authorization: Bearer cp_pat_YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "operation": "replace", "content": "# New Content" }'

# Search documents
curl -X GET "https://api.copera.ai/public/v1/docs/search?q=meeting" \
  -H "Authorization: Bearer cp_pat_YOUR_TOKEN"

Available Operations

OperationDescription
Get Doc TreeBrowse the hierarchical document tree with configurable depth
Get DocRetrieve document metadata (title, icon, cover, dates)
Get Doc ContentGet the document body as Markdown
Create DocCreate a new document with optional parent and initial content
Update DocUpdate document metadata (title, icon, cover)
Update Doc ContentReplace, append, or prepend Markdown content (async, returns 202)
Delete DocSoft-delete a document (owner only)
Search DocsFull-text search with highlighted matches

Next Steps

  • How Documents Work — Understand the document model, access control, and content operations
  • Get Doc — API endpoint reference