Documents

CRUD, AI drafting, version history, and review workflow for product documents.

Overview

Documents are structured product artifacts generated from recommendations and insights. Supported types: prd (Product Requirements Document), spec (Technical Specification), memo (Decision Memo), user_story, roadmap_update, and release_notes.

Documents follow a review workflow: draft -> review -> approved -> published.


Create Document

POST /api/documents

Create a document manually. Requires: Active subscription.

Request Body

NameTypeRequiredDescription
workspace_idUUIDYesTarget workspace
document_typestringYesOne of: prd, spec, memo, user_story, roadmap_update, release_notes
titlestringYesDocument title
contentstringYesMarkdown content
related_recommendation_idUUIDNoLinked recommendation
related_insight_idsUUID[]NoLinked insight IDs

Response (201 Created)

{
  "id": "e5f6a7b8-c9d0-1234-efab-567890123456",
  "workspace_id": "550e8400-e29b-41d4-a716-446655440000",
  "document_type": "prd",
  "title": "PRD: Onboarding Wizard Redesign",
  "content": "# Onboarding Wizard Redesign\n\n## Problem Statement\n...",
  "status": "draft",
  "version": 0,
  "created_by": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "created_at": "2026-03-27T14:00:00Z"
}

List Documents

GET /api/documents

Query Parameters

NameTypeRequiredDescription
workspace_idUUIDYesWorkspace ID
document_typestringNoFilter by type
statusstringNoFilter by status: draft, review, approved, published
limitintegerNoMax results (default: 200, max: 500)
offsetintegerNoPagination offset (default: 0)

Response (200 OK)

{
  "documents": [ ... ],
  "total": 3
}

Get Document

GET /api/documents/{document_id}

Update Document

PATCH /api/documents/{document_id}

Update a document's content, title, or metadata.


Delete Document

DELETE /api/documents/{document_id}

Response (204 No Content)


Draft Document (AI)

POST /api/documents/draft

Generate a product document from a recommendation using the AI agent. The agent applies document templates, cites user research throughout, and formats as clean Markdown. Typically takes 20-45 seconds.

Requires: Active subscription.

Request Body

NameTypeRequiredDescription
workspace_idUUIDYesTarget workspace
document_typestringYesDocument type to generate
recommendation_idUUIDNoRecommendation to base the document on
user_instructionsstringNoAdditional instructions for the AI

Example Request

curl -X POST https://api.praxiomai.xyz/api/documents/draft \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "workspace_id": "550e8400-e29b-41d4-a716-446655440000",
    "document_type": "prd",
    "recommendation_id": "d4e5f6a7-b8c9-0123-defa-456789012345",
    "user_instructions": "Focus on mobile-first experience"
  }'

Response (200 OK)

Returns the generated DocumentResponse with status "draft".


Save Version

POST /api/documents/{document_id}/versions

Create a manual version checkpoint of the current document state.

Request Body

NameTypeRequiredDescription
change_summarystringNoDescription of changes

Response (201 Created)

{
  "id": "f6a7b8c9-d0e1-2345-fabc-678901234567",
  "document_id": "e5f6a7b8-c9d0-1234-efab-567890123456",
  "revision_number": 3,
  "title": "PRD: Onboarding Wizard Redesign",
  "content": "...",
  "status_at_revision": "draft",
  "change_type": "manual_save",
  "change_summary": "Updated success metrics section",
  "changed_by": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "word_count": 1250
}

List Versions

GET /api/documents/{document_id}/versions

List all revisions for a document, newest first.

Query Parameters

NameTypeRequiredDescription
limitintegerNoMax results (default: 50, max: 100)

Get Version

GET /api/documents/{document_id}/versions/{revision_id}

Get a specific revision with full content.


Diff Versions

GET /api/documents/{document_id}/diff

Compute line-level diff between two revisions.

Query Parameters

NameTypeRequiredDescription
from_revisionintegerYesOlder revision number
to_revisionintegerYesNewer revision number

Response (200 OK)

{
  "document_id": "e5f6a7b8-...",
  "from_revision": 1,
  "to_revision": 3,
  "from_content": "...",
  "to_content": "...",
  "diff_stats": {
    "additions": 15,
    "deletions": 3,
    "changes": 18
  }
}

Restore Version

POST /api/documents/{document_id}/versions/{revision_id}/restore

Restore document content from a previous revision. Creates revision snapshots before and after the rollback.

Request Body

NameTypeRequiredDescription
change_summarystringNoReason for restoring

Transition Status

POST /api/documents/{document_id}/status

Transition a document through the review workflow.

Request Body

NameTypeRequiredDescription
target_statusstringYesTarget status
change_summarystringNoOptional notes

Valid Transitions

CurrentValid Next
draftreview
reviewapproved, draft
approvedpublished, draft
published(terminal)

Document Blocks

Documents can be decomposed into typed blocks for structured editing in the PM IDE.

List Blocks

GET /api/documents/{document_id}/blocks

Returns all blocks for a document, ordered by position.

Create Block

POST /api/documents/{document_id}/blocks
NameTypeRequiredDescription
block_typestringYesOne of: problem, persona, solution, metrics, user_story, edge_case, risk, timeline, free_text
titlestringNoBlock title
contentobjectNoBlock content (JSON, structure varies by type)
positionintegerNoOrder within the document

Update Block

PATCH /api/documents/{document_id}/blocks/{block_id}

Update a block's title, content, or position.

Delete Block

DELETE /api/documents/{document_id}/blocks/{block_id}

Reorder Blocks

PATCH /api/documents/{document_id}/blocks/reorder

Bulk update block positions.

Extract Blocks from Document

POST /api/blocks/extract

Analyse a document's Markdown content and create typed blocks from its sections.

NameTypeRequiredDescription
workspace_idUUIDYesWorkspace ID
document_idUUIDYesDocument to extract blocks from

Parse Intent into Blocks

POST /api/intent/parse

Decompose raw text input into a structured block skeleton.

NameTypeRequiredDescription
raw_inputstringYesRaw text to parse
workspace_idUUIDNoWorkspace for context

Block Actions

AI-powered actions for refining individual blocks.

Expand Block

POST /api/blocks/{block_id}/expand

Flesh out a block with deeper detail using its type-specific contract.

Challenge Block

POST /api/blocks/{block_id}/challenge

Adversarial critique returning strengths, weaknesses, questions, and suggestions.

Simulate Block

POST /api/blocks/{block_id}/simulate

Explore real-world implications of a block's content.

Was this helpful?