Skip to main content
To generate a Word document from a prompt in Node.js, install @doconda/sdk and call documents.create with format: "docx" and what you want in prompt. Doconda writes the content, applies any style you ask for in the same sentence and returns an editable .docx and its PDF, with no templates or layout code.

Steps

  1. Create an API key in the dashboard, under API keys, and store it in DOCONDA_API_KEY.
  2. Install the SDK (Node 20 or later, no runtime dependencies): npm install @doconda/sdk.
  3. Create the document and save it to disk.
documents.create waits for the document to be ready, like a call to an LLM. If it takes longer than 120 seconds, the SDK keeps waiting for you.

What you get back

  • An editable .docx: the look lives in the Word styles, and the layout adapts to the kind of document (doc.type: report, letter, contract, memo or minutes).
  • Its PDF, and doc.outputs with direct links (they expire after 5 minutes; documents.outputs(id) gives you new ones).
  • doc.status: ready, ready_with_warnings, needs_review or failed (not charged; doc.error says why).
  • doc.style_unsupported: whatever you asked for that couldn’t be applied.

Limits

  • Use the SDK on your server, never in the browser: your API key gives access to every document in the project.
  • With quality: "fast" you get the basic style; charts, tracked changes or your template’s design need standard or best.
  • If you leave out format and the sentence doesn’t make the file type clear, it fails with format_unclear and isn’t charged.

FAQ

Yes. The SDK works on Node 20 or later, serverless functions included.
Pass it in content: { markdown }: Doconda only lays it out, faster and cheaper.
Yes, with documents.stream. See Watch the document live.
Yes, with the same methods: pip install doconda. See Python SDK.

Keep reading