Outcome
Record the outcome of a client document export attempt, deduplicate its identifier and attempt usage metering for a new ready result. This action returns no file bytes or download URL.
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.export --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/{documentId}/export
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 |
|---|---|---|---|
documentId | Required | string | {"minLength":1} |
format | Optional | string | {"minLength":1} |
exportId | Optional | string | {"minLength":1} |
error | Optional | string | {"minLength":1} |
Exact input schema:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"documentId": {
"type": "string",
"minLength": 1
},
"format": {
"type": "string",
"minLength": 1
},
"exportId": {
"type": "string",
"minLength": 1
},
"error": {
"type": "string",
"minLength": 1
}
},
"required": [
"documentId"
],
"additionalProperties": false
}
Effects
- Persists ready or failed export-attempt metadata using the supplied error field.
- Uses exportId, then X-Topolo-Request-Id, then documentId as its deduplication identifier. Reusing the id returns the existing attempt even if new request fields differ.
- For a new ready attempt, tries Notify emission and one doc_exports usage event. Usage failure is non-fatal and recorded:false; duplicate or failed attempts do not emit another usage unit.
- Format is a string; the handler does not render or validate a downloadable artifact and does not enforce the export allowance itself.
Interpret the response
Use response path $.export.id for compose_export_attempt. An empty list does not discover a target.
Expect HTTP 201 with export.id, status, duplicate and recorded. Inspect error and duplicate before calling it a new successful attempt. Verify the separately created client artifact and actual provider usage through their own authorized surfaces; ready is metadata supplied to this handler.
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": [
"export",
"recorded"
],
"properties": {
"export": {
"type": "object",
"required": [
"id",
"status",
"error",
"createdAt",
"duplicate"
],
"properties": {
"id": {
"type": "string"
},
"status": {
"type": "string"
},
"error": {
"anyOf": [
{
"type": "null"
},
{
"type": "string"
}
]
},
"createdAt": {
"type": "string"
},
"duplicate": {
"type": "boolean"
}
}
},
"recorded": {
"type": "boolean"
}
}
}
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: doc_exports usage meter emission > successful export emits one doc_exports unit with S2S auth + org/app headers.
Input · payload.json:
{
"documentId": "c41c7984-c940-4639-9841-fa1cc2a749b7",
"format": "docx",
"exportId": "exp_123"
}
CLI:
topolo actions validate app_topolo_compose.documents.export --data @payload.json --json
topolo actions plan app_topolo_compose.documents.export --resource-type workspace --resource-id "$COMPOSE_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_compose.documents.export --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.export",
"input": {
"documentId": "c41c7984-c940-4639-9841-fa1cc2a749b7",
"format": "docx",
"exportId": "exp_123"
},
"resourceType": "workspace",
"resourceId": "<identifier returned by granted resource discovery>",
"confirm": true
}
}
Captured local response · HTTP 201:
{
"export": {
"id": "exp_123",
"status": "ready",
"error": null,
"createdAt": "2026-10-04T02:26:27.212Z",
"duplicate": false
},
"recorded": true
}
HTTP 201. Expect HTTP 201 with export.id, status, duplicate and recorded. Inspect error and duplicate before calling it a new successful attempt. Verify the separately created client artifact and actual provider usage through their own authorized surfaces; ready is metadata supplied to this handler.
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:
{
"documentId": "cb253d9f-025e-4fd3-87c1-33ba55fa8400",
"format": "html"
}
CLI:
topolo actions validate app_topolo_compose.documents.export --data @payload.json --json
topolo actions plan app_topolo_compose.documents.export --resource-type workspace --resource-id "$COMPOSE_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_compose.documents.export --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.export",
"input": {
"documentId": "cb253d9f-025e-4fd3-87c1-33ba55fa8400",
"format": "html"
},
"resourceType": "workspace",
"resourceId": "<identifier returned by granted resource discovery>",
"confirm": true
}
}
Captured local response · HTTP 201:
{
"export": {
"id": "cb253d9f-025e-4fd3-87c1-33ba55fa8400",
"status": "ready",
"error": null,
"createdAt": "2026-10-04T02:26:27.219Z",
"duplicate": false
},
"recorded": false
}
HTTP 201. Expect HTTP 201 with export.id, status, duplicate and recorded. Inspect error and duplicate before calling it a new successful attempt. Verify the separately created client artifact and actual provider usage through their own authorized surfaces; ready is metadata supplied to this handler.
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 ready and failed exports, emits once, and meters only a new ready artifact.
Input · payload.json:
{
"documentId": "d25b5df8-59f7-4b98-a044-e8dfd1abf824",
"format": "docx",
"exportId": "export_ready_1"
}
CLI:
topolo actions validate app_topolo_compose.documents.export --data @payload.json --json
topolo actions plan app_topolo_compose.documents.export --resource-type workspace --resource-id "$COMPOSE_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_compose.documents.export --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.export",
"input": {
"documentId": "d25b5df8-59f7-4b98-a044-e8dfd1abf824",
"format": "docx",
"exportId": "export_ready_1"
},
"resourceType": "workspace",
"resourceId": "<identifier returned by granted resource discovery>",
"confirm": true
}
}
Captured local response · HTTP 201:
{
"export": {
"id": "export_ready_1",
"status": "ready",
"error": null,
"createdAt": "2026-10-04T02:26:27.222Z",
"duplicate": false
},
"recorded": true
}
HTTP 201. Expect HTTP 201 with export.id, status, duplicate and recorded. Inspect error and duplicate before calling it a new successful attempt. Verify the separately created client artifact and actual provider usage through their own authorized surfaces; ready is metadata supplied to this handler.
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 ready and failed exports, emits once, and meters only a new ready artifact.
Input · payload.json:
{
"documentId": "d25b5df8-59f7-4b98-a044-e8dfd1abf824",
"format": "pdf",
"exportId": "export_failed_1"
}
CLI:
topolo actions validate app_topolo_compose.documents.export --data @payload.json --json
topolo actions plan app_topolo_compose.documents.export --resource-type workspace --resource-id "$COMPOSE_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_compose.documents.export --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.export",
"input": {
"documentId": "d25b5df8-59f7-4b98-a044-e8dfd1abf824",
"format": "pdf",
"exportId": "export_failed_1"
},
"resourceType": "workspace",
"resourceId": "<identifier returned by granted resource discovery>",
"confirm": true
}
}
Captured local response · HTTP 201:
{
"export": {
"id": "export_failed_1",
"status": "failed",
"error": "unsupported_export_format",
"createdAt": "2026-10-04T02:26:27.228Z",
"duplicate": false
},
"recorded": false
}
HTTP 201. Expect HTTP 201 with export.id, status, duplicate and recorded. Inspect error and duplicate before calling it a new successful attempt. Verify the separately created client artifact and actual provider usage through their own authorized surfaces; ready is metadata supplied to this handler.
Refused request · HTTP 404
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 > export of a missing document does not emit.
Input · payload.json:
{
"documentId": "does-not-exist",
"format": "pdf"
}
CLI:
topolo actions validate app_topolo_compose.documents.export --data @payload.json --json
topolo actions plan app_topolo_compose.documents.export --resource-type workspace --resource-id "$COMPOSE_WORKSPACE_ID" --data @payload.json --json
Captured local response · HTTP 404:
{
"error": "not_found"
}
HTTP 404. 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: each grant level against each route > 'POST' '/api/documents/{documentId}/export' with a 'read' grant.
Input · payload.json:
{
"documentId": "documentId_missing"
}
CLI:
topolo actions validate app_topolo_compose.documents.export --data @payload.json --json
topolo actions plan app_topolo_compose.documents.export --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.
Verify the result
- Expect HTTP 201 with export.id, status, duplicate and recorded.
- Inspect error and duplicate before calling it a new successful attempt. Verify the separately created client artifact and actual provider usage through their own authorized surfaces; ready is metadata supplied to this handler.
Errors and recovery
not_found(HTTP 404): Discover the accessible document and version in the selected workspace. A missing or inaccessible id is not permission to create a replacement.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.
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
No export-attempt-delete or meter-refund action is published. Preserve an attempt id across a retry to avoid duplicate metering; use a new id only for a genuinely separate export attempt.
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.
- Export Compose organization data: Export Compose-owned documents, versions, comments, review requests, export attempts and workspace mirrors across the authenticated organization. This private-data export requires privacy:read and explicit authorization.
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.