Skip to navigation

API · Docs · Create a long-form document

View as Markdown

Create a new long-form document rendered in the Quill editor. Content is stored as Quill Delta JSON (ops array). Used by AI-writer skills (Essay Writer, Article Writer) to persist generated markdown content into an editable document.

The returned document is immediately openable at /ai-writer/document/{space_or_organization}/{id} in the Simplified web app.

To convert markdown content into the required Quill Delta shape, call markdown_to_quill_delta from the writers toolkit before passing to this endpoint.

Authentication

AuthorizationApi-Key

Header authentication of the form Api-Key <token>

OR
AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Request

This endpoint expects an object.
titlestringRequired

Document title shown in the editor and the document list. For AI-writer skills, use the essay/article title from the originating show_article tool call.

formintegerRequired

Document form type enum. Use 1 for LONG_FORM (Quill-editor-backed documents — the standard for essays, articles, and any rich-text content). 0 = SHORT_FORM (AI templates, not used by these skills).

contentobjectRequired

Quill Delta JSON representing the document body. Contains an ops array of operations. Each op is a dict with insert (string or embed object) and optional attributes (formatting like bold, italic, header, list, link, code-block, blockquote).

For markdown-sourced content, call markdown_to_quill_delta to produce a compliant Delta before passing to this field.

payloadobjectOptional

Optional document metadata. Can be left empty (). Supported fields: description, tone, keywords, voice_id, output. Used for AI template context — not required for skill-generated content.

parentstringOptional

Optional parent document id for creating a sub-document. Not used by AI-writer skills in v1.

Response

Document created — returns document id plus workspace context

Errors

400
Bad Request Error
401
Unauthorized Error