Documents, generation and exports API
All paths below are relative to https://api.corpdev.ai/v1/public. Authentication and workspace permissions apply to every protected operation.
Read and create
GET /documents
List accessible deliverables with cursor pagination.
GET /documents/:documentId
Read a deliverable.
GET /folders
List deliverable folders.
POST /documents
Create a draft or start a generated deliverable.
Creation requires name. Optional fields include markdown, docType, folderId, prompt, model, contextDocuments and cloudFiles. A non-null folder must exist in the key's workspace. Use references to accessible source documents and files; do not pass another workspace's path as a reference.
Unknown creation fields are rejected. Omit docType to use the default document type. A request without a non-empty prompt creates a draft; a prompt starts metered Analyst work. See the quick start for a complete draft example.
Continue an Analyst task
POST /documents/:documentId/prompt requires a non-empty prompt and write access. For example, the JSON body can be:
{
"prompt": "Add an open diligence questions section. Distinguish missing evidence from confirmed findings."
}Optional context and model options must match the supported schema. Do not assume a second prompt always starts immediately: the response can report queuing or a conflict with current work.
Poll GET /jobs/:jobId for a known job, or GET /documents/:documentId/job for the document's job. Use the returned status and identifiers. The legacy path /documents/:documentId/jobs/:jobId is not the current polling route.
Revise, copy or remove
PUT /documents/:documentId
Update supported document fields.
POST /documents/:documentId/apply-ops
Apply supported structured document operations.
POST /documents/:documentId/duplicate
Create a separate copy.
DELETE /documents/:documentId
Delete the document.
For version-sensitive full replacement operations, use expectedVersion and handle HTTP 409 rather than overwriting changes blindly. Confirm the operation schema before writing. A delete is not an archive or a reversible draft change.
Attachments and slides
GET /documents/:documentId/attachments lists attachments. Read a particular attachment with GET /documents/:documentId/attachments/:attachmentId. Upload attachments using POST /documents/:documentId/attachments with multipart field files and write access. Let the HTTP client generate the multipart boundary.
GET /documents/:documentId/slides reads slide content where present. An attachment or slide result can differ from the main document's Markdown; inspect the intended representation.
Export
POST /documents/:documentId/exports/:format requires export scope and returns the exported file. Supported format names are markdown, slides-markdown, docx, pptx and xlsx. An XLSX export reads the document's stored workbook; if no workbook exists, it returns 422. Do not assume every format offered elsewhere in the product is available on this route.
The default response is the file; requesting Accept: application/json returns a JSON representation containing base64 content. Save the file using its content type and filename. For Word exports, inspect X-Export-Fidelity when present: a fallback render can have reduced fidelity. Handle a non-success response before treating its body as a document. Open generated Office files to check their layout before distribution.