Skip to content

Documents

The Documents API provides structured storage for text artifacts — plans, specs, briefs, templates, and code snippets. Documents are organized by type and category, support tagging, and are searchable by title and content.

Base path: /api/documents

All endpoints require Authorization: Bearer <token>.


Document Types

TypeDescription
markdownMarkdown-formatted text
codeSource code (any language)
textPlain text
jsonJSON data
yamlYAML configuration
htmlHTML content
cssStylesheet

Document Categories

CategoryDescription
planningProject plans, roadmaps, timelines
specificationTechnical specs, API contracts
documentationUser-facing docs, guides
briefingAI agent briefing files
notesInformal notes and observations
researchResearch findings, competitive analysis
templateReusable document templates
configConfiguration and environment definitions
otherAnything not covered above

List Documents

GET /api/documents

Query parameters:

ParameterTypeDescription
typestringFilter by document type
categorystringFilter by category
tagsstringComma-separated tags
searchstringSearch in title and content
createdBystringFilter by author (agent name or user ID)
limitnumberDefault 20, max 100
offsetnumberDefault 0

Response:

json
{
  "success": true,
  "data": [
    {
      "id": "doc_01J...",
      "title": "API Route Refactoring Plan",
      "type": "markdown",
      "category": "planning",
      "tags": ["api", "refactoring", "hono"],
      "contentPreview": "# API Route Refactoring Plan\n\nThis document outlines...",
      "createdBy": "architect",
      "createdAt": "2026-04-01T10:00:00Z",
      "updatedAt": "2026-04-03T11:00:00Z"
    }
  ],
  "pagination": { "limit": 20, "offset": 0, "total": 27 }
}

curl:

bash
curl "https://api.cortex.acrobi.com/api/documents?category=planning&type=markdown" \
  -H "Authorization: Bearer <token>"

Create Document

POST /api/documents

Request body:

json
{
  "title": "API Route Refactoring Plan",
  "content": "# API Route Refactoring Plan\n\nThis document outlines the steps to refactor all 32 route handlers...",
  "type": "markdown",
  "category": "planning",
  "tags": ["api", "refactoring", "hono"],
  "projectId": "proj_01J..."
}
FieldTypeRequiredDescription
titlestringYesDocument title
contentstringYesFull document content
typestringYesDocument type (see table above)
categorystringNoCategory (default other)
tagsstring[]NoSearchable tags
projectIdstringNoAssociate with a project

Response: 201 Created

json
{
  "success": true,
  "data": {
    "id": "doc_01J...",
    "title": "API Route Refactoring Plan",
    "type": "markdown",
    "category": "planning",
    "createdAt": "2026-04-03T12:00:00Z"
  }
}

curl:

bash
curl -X POST "https://api.cortex.acrobi.com/api/documents" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "API Route Refactoring Plan",
    "content": "# Plan\n\nStep 1...",
    "type": "markdown",
    "category": "planning",
    "tags": ["api", "refactoring"]
  }'

Get Document

GET /api/documents/:id

Returns full document including content.

Response:

json
{
  "success": true,
  "data": {
    "id": "doc_01J...",
    "title": "API Route Refactoring Plan",
    "content": "# API Route Refactoring Plan\n\nThis document outlines...",
    "type": "markdown",
    "category": "planning",
    "tags": ["api", "refactoring", "hono"],
    "projectId": "proj_01J...",
    "createdBy": "architect",
    "createdAt": "2026-04-01T10:00:00Z",
    "updatedAt": "2026-04-03T11:00:00Z"
  }
}

Update Document

PATCH /api/documents/:id

Request body:

json
{
  "title": "API Route Refactoring Plan v2",
  "content": "# API Route Refactoring Plan v2\n\nUpdated to reflect Hono middleware approach...",
  "tags": ["api", "refactoring", "hono", "middleware"]
}

Response: 200 OK — returns updated document object.

curl:

bash
curl -X PATCH "https://api.cortex.acrobi.com/api/documents/doc_01J..." \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"title": "API Route Refactoring Plan v2"}'

Delete Document

DELETE /api/documents/:id

Permanently removes the document and its content.

Response:

json
{ "success": true }

Built by Acrobi