Outcome
Create a new workspace document from supplied text and metadata without calling a model. Compose saves its initial created version and returns the document identifier.
Before you start
- Verify the authenticated identity, environment and pinned organization before preparing an action.
- The published application permission is workspace:write. Discover and select a granted Compose workspace separately from action input. A supplied identifier does not grant access.
- A read_write workspace grant is required, including model suggestion previews that do not persist document text.
- Authorize the documented effects or private-data export before CLI --confirm or MCP confirm:true. HTTP method alone does not establish a read-only operation.
Discover the target
topolo whoami --json
topolo actions get app_topolo_compose.documents.create --detail --json
topolo resources topolo-compose --json
topolo workspaces list topolo-compose --json
- Select the granted workspace id as COMPOSE_WORKSPACE_ID. Use document and version ids returned by accessible reads; fixture ids confer no live access.
Request
POST /api/documents
Save action input as payload.json. Inspect the plan for the exact path, query and body. Set COMPOSE_WORKSPACE_ID from granted resource discovery.
Inspect and test this action in the signed action console, then perform the verification below.
Input fields
| Field | Required | Type | Constraints |
|---|---|---|---|
title | Optional | string | {"minLength":1} |
bodyMarkdown | Optional | string | {} |
markdown | Optional | string | {} |
documentType | Optional | string | {"enum":["contract","scientific_paper","maths_paper","letterhead","proposal","report","policy","general"]} |
type | Optional | string | {"enum":["contract","scientific_paper","maths_paper","letterhead","proposal","report","policy","general"]} |
stylePreset | Optional | See exact schema | {} |
style | Optional | string | {"enum":["executive","legal","academic","technical","brand"]} |
audience | Optional | string | {} |
sourceMaterial | Optional | string | {} |
provider | Optional | string | {} |
model | Optional | string | {} |
generationContract | Optional | See exact schema | {} |
approvalStatus | Optional | string | {"enum":["draft","in_review","approved","rejected"]} |
approvalOwner | Optional | string | {} |
approvalDueAt | Optional | string | {} |
approvalNotes | Optional | string | {} |
Exact input schema:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"title": {
"type": "string",
"minLength": 1
},
"bodyMarkdown": {
"type": "string"
},
"markdown": {
"type": "string"
},
"documentType": {
"type": "string",
"enum": [
"contract",
"scientific_paper",
"maths_paper",
"letterhead",
"proposal",
"report",
"policy",
"general"
]
},
"type": {
"type": "string",
"enum": [
"contract",
"scientific_paper",
"maths_paper",
"letterhead",
"proposal",
"report",
"policy",
"general"
]
},
"stylePreset": {
"anyOf": [
{
"type": "string",
"enum": [
"executive",
"legal",
"academic",
"technical",
"brand"
]
},
{
"type": "null"
}
]
},
"style": {
"type": "string",
"enum": [
"executive",
"legal",
"academic",
"technical",
"brand"
]
},
"audience": {
"type": "string"
},
"sourceMaterial": {
"type": "string"
},
"provider": {
"type": "string"
},
"model": {
"type": "string"
},
"generationContract": {},
"approvalStatus": {
"type": "string",
"enum": [
"draft",
"in_review",
"approved",
"rejected"
]
},
"approvalOwner": {
"type": "string"
},
"approvalDueAt": {
"type": "string"
},
"approvalNotes": {
"type": "string"
}
},
"additionalProperties": false
}
Effects
- Initializes the authorized local workspace mirror if needed.
- Creates a document and initial saved version with reason created.
- Calls no model. Title defaults to Untitled document and type to general; omitted optional fields use documented defaults.
- Approval metadata is editable state, not a completed assigned-review decision or signature.
Interpret the response
Use response path $.document.id for compose_document. An empty list does not discover a target.
Expect HTTP 201 with document.id and supplied text. Read documents.get and documents.versions.list in the same workspace; confirm the initial created snapshot and creator.
The success schema below was checked against captured handler responses. Optional structured generation metadata and integration-dependent values can vary. Error examples retain their actual refusal shapes.
Success schema:
{
"type": "object",
"required": [
"document"
],
"properties": {
"document": {
"type": "object",
"required": [
"id",
"title",
"type",
"style",
"audience",
"markdown",
"sourceMaterial",
"generationContract",
"provider",
"model",
"approvalStatus",
"approvalOwner",
"approvalDueAt",
"approvalNotes",
"archivedAt",
"createdByUserId",
"createdByEmail",
"createdAt",
"updatedAt"
],
"properties": {
"id": {
"type": "string"
},
"title": {
"type": "string"
},
"type": {
"type": "string"
},
"style": {
"anyOf": [
{
"type": "null"
},
{
"type": "string"
}
]
},
"audience": {
"type": "string"
},
"markdown": {
"type": "string"
},
"sourceMaterial": {
"type": "null"
},
"generationContract": {
"type": "null"
},
"provider": {
"type": "null"
},
"model": {
"type": "null"
},
"approvalStatus": {
"type": "string"
},
"approvalOwner": {
"type": "null"
},
"approvalDueAt": {
"type": "null"
},
"approvalNotes": {
"type": "null"
},
"archivedAt": {
"type": "null"
},
"createdByUserId": {
"type": "string"
},
"createdByEmail": {
"type": "string"
},
"createdAt": {
"type": "string"
},
"updatedAt": {
"type": "string"
}
}
}
}
}
Worked examples
Responses were captured from the actual Compose Worker using synthetic users, organizations, content and identifiers. Tests simulate Auth, Nexus, Notify, metering and platform workspace transport and use an in-memory D1 adapter or local SQLite. They prove local handler behavior, not live model correctness, provider cost, notification delivery, real workspace grants or cross-store atomicity. HTTP 204 responses are exactly empty strings in the SDK transport. Replace fixture identifiers through credential-scoped discovery. Refused examples demonstrate boundaries and must not be executed as successful workflows.
Successful request
Actual Compose Worker response. Auth, Nexus, notifications, metering and platform workspace transport are simulated. D1 is an in-memory adapter or local SQLite as stated by the test. This does not prove a live model completion or notification delivery. No request credentials are captured. Captured scenario: Compose notification workflows > persists a comment and its unique non-author mentions before emitting.
Input · payload.json:
{
"title": "Launch brief",
"markdown": "# Launch brief"
}
CLI:
topolo actions validate app_topolo_compose.documents.create --data @payload.json --json
topolo actions plan app_topolo_compose.documents.create --resource-type workspace --resource-id "$COMPOSE_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_compose.documents.create --resource-type workspace --resource-id "$COMPOSE_WORKSPACE_ID" --data @payload.json --confirm --json
MCP tool and arguments:
{
"tool": "topolo_call_action",
"arguments": {
"actionId": "app_topolo_compose.documents.create",
"input": {
"title": "Launch brief",
"markdown": "# Launch brief"
},
"resourceType": "workspace",
"resourceId": "<identifier returned by granted resource discovery>",
"confirm": true
}
}
Captured local response · HTTP 201:
{
"document": {
"id": "149c1faf-3b05-4194-930a-04d2022ff964",
"title": "Launch brief",
"type": "general",
"style": null,
"audience": "",
"markdown": "# Launch brief",
"sourceMaterial": null,
"generationContract": null,
"provider": null,
"model": null,
"approvalStatus": "draft",
"approvalOwner": null,
"approvalDueAt": null,
"approvalNotes": null,
"archivedAt": null,
"createdByUserId": "user_test_1",
"createdByEmail": "writer@stg.topolo.us",
"createdAt": "2026-10-04T02:26:27.197Z",
"updatedAt": "2026-10-04T02:26:27.197Z"
}
}
HTTP 201. Expect HTTP 201 with document.id and supplied text. Read documents.get and documents.versions.list in the same workspace; confirm the initial created snapshot and creator.
Another supported request
Actual Compose Worker response. Auth, Nexus, notifications, metering and platform workspace transport are simulated. D1 is an in-memory adapter or local SQLite as stated by the test. This does not prove a live model completion or notification delivery. No request credentials are captured. Captured scenario: doc_exports usage meter emission > successful export emits one doc_exports unit with S2S auth + org/app headers.
Input · payload.json:
{
"title": "Quarterly report",
"markdown": "# Quarterly report\n\nBody",
"type": "report"
}
CLI:
topolo actions validate app_topolo_compose.documents.create --data @payload.json --json
topolo actions plan app_topolo_compose.documents.create --resource-type workspace --resource-id "$COMPOSE_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_compose.documents.create --resource-type workspace --resource-id "$COMPOSE_WORKSPACE_ID" --data @payload.json --confirm --json
MCP tool and arguments:
{
"tool": "topolo_call_action",
"arguments": {
"actionId": "app_topolo_compose.documents.create",
"input": {
"title": "Quarterly report",
"markdown": "# Quarterly report\n\nBody",
"type": "report"
},
"resourceType": "workspace",
"resourceId": "<identifier returned by granted resource discovery>",
"confirm": true
}
}
Captured local response · HTTP 201:
{
"document": {
"id": "c41c7984-c940-4639-9841-fa1cc2a749b7",
"title": "Quarterly report",
"type": "report",
"style": null,
"audience": "",
"markdown": "# Quarterly report\n\nBody",
"sourceMaterial": null,
"generationContract": null,
"provider": null,
"model": null,
"approvalStatus": "draft",
"approvalOwner": null,
"approvalDueAt": null,
"approvalNotes": null,
"archivedAt": null,
"createdByUserId": "user_test_1",
"createdByEmail": "writer@stg.topolo.us",
"createdAt": "2026-10-04T02:26:27.196Z",
"updatedAt": "2026-10-04T02:26:27.196Z"
}
}
HTTP 201. Expect HTTP 201 with document.id and supplied text. Read documents.get and documents.versions.list in the same workspace; confirm the initial created snapshot and creator.
Another supported request
Actual Compose Worker response. Auth, Nexus, notifications, metering and platform workspace transport are simulated. D1 is an in-memory adapter or local SQLite as stated by the test. This does not prove a live model completion or notification delivery. No request credentials are captured. Captured scenario: doc_exports usage meter emission > a metering failure never blocks the export (recorded:false).
Input · payload.json:
{
"title": "Doc",
"markdown": "# Doc"
}
CLI:
topolo actions validate app_topolo_compose.documents.create --data @payload.json --json
topolo actions plan app_topolo_compose.documents.create --resource-type workspace --resource-id "$COMPOSE_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_compose.documents.create --resource-type workspace --resource-id "$COMPOSE_WORKSPACE_ID" --data @payload.json --confirm --json
MCP tool and arguments:
{
"tool": "topolo_call_action",
"arguments": {
"actionId": "app_topolo_compose.documents.create",
"input": {
"title": "Doc",
"markdown": "# Doc"
},
"resourceType": "workspace",
"resourceId": "<identifier returned by granted resource discovery>",
"confirm": true
}
}
Captured local response · HTTP 201:
{
"document": {
"id": "cb253d9f-025e-4fd3-87c1-33ba55fa8400",
"title": "Doc",
"type": "general",
"style": null,
"audience": "",
"markdown": "# Doc",
"sourceMaterial": null,
"generationContract": null,
"provider": null,
"model": null,
"approvalStatus": "draft",
"approvalOwner": null,
"approvalDueAt": null,
"approvalNotes": null,
"archivedAt": null,
"createdByUserId": "user_test_1",
"createdByEmail": "writer@stg.topolo.us",
"createdAt": "2026-10-04T02:26:27.217Z",
"updatedAt": "2026-10-04T02:26:27.217Z"
}
}
HTTP 201. Expect HTTP 201 with document.id and supplied text. Read documents.get and documents.versions.list in the same workspace; confirm the initial created snapshot and creator.
Another supported request
Actual Compose Worker response. Auth, Nexus, notifications, metering and platform workspace transport are simulated. D1 is an in-memory adapter or local SQLite as stated by the test. This does not prove a live model completion or notification delivery. No request credentials are captured. Captured scenario: Compose notification workflows > persists a review request and only the assigned reviewer can complete it.
Input · payload.json:
{
"title": "Launch brief",
"markdown": "# Launch brief"
}
CLI:
topolo actions validate app_topolo_compose.documents.create --data @payload.json --json
topolo actions plan app_topolo_compose.documents.create --resource-type workspace --resource-id "$COMPOSE_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_compose.documents.create --resource-type workspace --resource-id "$COMPOSE_WORKSPACE_ID" --data @payload.json --confirm --json
MCP tool and arguments:
{
"tool": "topolo_call_action",
"arguments": {
"actionId": "app_topolo_compose.documents.create",
"input": {
"title": "Launch brief",
"markdown": "# Launch brief"
},
"resourceType": "workspace",
"resourceId": "<identifier returned by granted resource discovery>",
"confirm": true
}
}
Captured local response · HTTP 201:
{
"document": {
"id": "04272175-06fb-44ec-8eaf-2f47e9dfb954",
"title": "Launch brief",
"type": "general",
"style": null,
"audience": "",
"markdown": "# Launch brief",
"sourceMaterial": null,
"generationContract": null,
"provider": null,
"model": null,
"approvalStatus": "draft",
"approvalOwner": null,
"approvalDueAt": null,
"approvalNotes": null,
"archivedAt": null,
"createdByUserId": "user_test_1",
"createdByEmail": "writer@stg.topolo.us",
"createdAt": "2026-10-04T02:26:27.216Z",
"updatedAt": "2026-10-04T02:26:27.216Z"
}
}
HTTP 201. Expect HTTP 201 with document.id and supplied text. Read documents.get and documents.versions.list in the same workspace; confirm the initial created snapshot and creator.
Refused request · HTTP 403
Actual Compose Worker response. Auth, Nexus, notifications, metering and platform workspace transport are simulated. D1 is an in-memory adapter or local SQLite as stated by the test. This does not prove a live model completion or notification delivery. No request credentials are captured. Captured scenario: each grant level against each route > 'POST' '/api/documents' with a 'read' grant.
Input · payload.json:
{
"title": "Plan",
"markdown": "# Plan"
}
CLI:
topolo actions validate app_topolo_compose.documents.create --data @payload.json --json
topolo actions plan app_topolo_compose.documents.create --resource-type workspace --resource-id "$COMPOSE_WORKSPACE_ID" --data @payload.json --json
Captured local response · HTTP 403:
{
"error": "This workspace requires read_write access",
"code": "workspace_access_insufficient"
}
HTTP 403. The handler refused this request. Resolve its exact cause before retrying; input validation can reject an invalid fixture before it reaches the handler.
Refused request · HTTP 403
Actual Compose Worker response. Auth, Nexus, notifications, metering and platform workspace transport are simulated. D1 is an in-memory adapter or local SQLite as stated by the test. This does not prove a live model completion or notification delivery. No request credentials are captured. Captured scenario: action-contract validation > a request tagged with an unknown action is rejected.
Input · payload.json:
{
"title": "x",
"markdown": "# x"
}
CLI:
topolo actions validate app_topolo_compose.documents.create --data @payload.json --json
topolo actions plan app_topolo_compose.documents.create --resource-type workspace --resource-id "$COMPOSE_WORKSPACE_ID" --data @payload.json --json
Captured local response · HTTP 403:
{
"success": false,
"error": {
"code": "unknown_action_contract",
"message": "Unknown Topolo action contract: documents.nonexistent",
"action": "documents.nonexistent"
}
}
HTTP 403. The handler refused this request. Resolve its exact cause before retrying; input validation can reject an invalid fixture before it reaches the handler.
Verify the result
- Expect HTTP 201 with document.id and supplied text.
- Read documents.get and documents.versions.list in the same workspace; confirm the initial created snapshot and creator.
Errors and recovery
This workspace requires read_write access(HTTP 403): Verify the authenticated organization, application permission and granted workspace. For reviewer_required, use the legitimately assigned reviewer; requesting review grants no access.unknown_action_contract(HTTP 403): Verify the authenticated organization, application permission and granted workspace. For reviewer_required, use the legitimately assigned reviewer; requesting review grants no access.
Auth, action-input validation and platform resource resolution can refuse a request before its handler. Retain the exact error, request id and context; requesting another context is not a legitimate way to bypass a refusal.
Recovery boundary
Archive an unwanted new draft through documents.archive to retain evidence and history. Hard deletion destroys content and requires separate authorization.
Related actions
- Get Compose document: Read one document in the authorized organization and workspace, including current markdown, provenance, approval metadata and archival state. This read can initialize the local workspace mirror.
- List saved Compose document versions: Read the 25 newest saved snapshots of an accessible document. This read can initialize the local workspace mirror and exposes no continuation cursor.
- Archive Compose document: Hide a document from the active list by setting archivedAt, while retaining its content and saved versions. Archived documents still count toward the workspace archival emptiness check.
Evidence
Responses were captured from the actual Compose Worker using synthetic users, organizations, content and identifiers. Tests simulate Auth, Nexus, Notify, metering and platform workspace transport and use an in-memory D1 adapter or local SQLite. They prove local handler behavior, not live model correctness, provider cost, notification delivery, real workspace grants or cross-store atomicity. HTTP 204 responses are exactly empty strings in the SDK transport. Replace fixture identifiers through credential-scoped discovery. Capture digests and test scenarios are retained in the source fixture records.