Skip to main content
Assumes you have installed an SDK: TypeScript or Python.
This guide covers creating a document from a sentence or from your Markdown, choosing the format and quality, adding your files as sources, downloading the result and creating in the background. documents.create sends the request and waits until the document finishes, like a call to an LLM. If it takes longer than 120 s, the API answers 202 and the SDK keeps waiting for you. In Python, responses are dicts: doc.id is doc["id"].

Create from a sentence

Set prompt (3 to 8,000 characters) and Doconda writes the content. Any look you describe in it (“blue headings”, “with a table of contents”) is applied too; style takes the look separately.
doc.type says what Doconda decided it is (report, letter, contract, memo or minutes for Word and PDF), which sets its base layout. You don’t choose it: describe the document in prompt and the look in style.

Create from your Markdown

Set content.markdown (up to 500,000 characters) and Doconda only lays it out, without rewriting it. It costs less than from a sentence: €0.20 instead of €0.50 at standard.

Choose the format

format decides the file. Word, PowerPoint and Excel also come with their PDF, and every file with one PNG preview per page. Without format, Doconda infers it from prompt. When it can’t tell, the document ends failed with format_unclear and isn’t charged.

Choose the quality

quality sets how much work the agent puts in, and the price. The default, auto, lets Doconda pick; max_quality caps what it may pick.
fast takes about a minute and can’t copy a file’s design. With auto, your balance must cover the highest level Doconda may pick before it starts. See quality levels and pricing.

Add your files as sources

sources takes up to 5 documents that the AI reads before writing, and up to 10 pictures it places in the document. Each entry is a file_… from files.upload, a doc_…, { url } or { data, filename }.
With content, sources only carries pictures: place them from the Markdown with ![Caption](img:1), where 1 is the first picture in sources. To copy a file’s look, see copy the design of a file.

Download the result

download asks for fresh links and fetches the file. The links in doc.outputs expire after 5 minutes; documents.outputs(id) returns new ones until the document’s retention ends (30 days by default, doc.expires_at).

Check the status

create returns when the document reaches ready, failed or canceled. A failed or canceled document isn’t an exception, so check status.
For every error.code, see when a document fails.

Create in the background

createInBackground (Python: create_in_background) answers at once with status: "queued", so a job queue or a web request doesn’t hold the connection.
wait follows the document’s events and reconnects up to 5 times if the connection drops. To be notified instead of waiting, use webhooks. Behavior to be aware of:
  • max_quality only works with quality: "auto". Any other combination is rejected with 422 input_invalid.
  • Each create call sends its own Idempotency-Key, so the SDK’s retries never create a second document. To make your own retries safe, see idempotency.
  • name (up to 200 characters) names the downloaded files; retention overrides the project’s (none, 1d, 7d, 30d or 90d).
For all parameters, see the API reference.

Next steps

Edit a file

Change an existing document and see what changed.

Build artifacts

Web pages that store data.

Handle errors

Codes, retries and idempotency.

SDK reference

Every method and what it returns.