> ## Documentation Index
> Fetch the complete documentation index at: https://docs.doconda.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get started with the SDK

> Install it, give it your API key and create your first document in three lines.

The TypeScript SDK does the same as the API, but with types, retries and streaming already handled. It works on
Node 20 or later (serverless functions too) and has no runtime dependencies.

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
npm install @doconda/sdk
```

## Your first document

```ts theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
import { Doconda } from "@doconda/sdk"

const doconda = new Doconda()
const doc = await doconda.documents.create({ format: "docx", prompt: "Report on the housing law" })

console.log(doc.status) // "ready"
console.log(doc.outputs) // links to the Word file and the PDF
```

`new Doconda()` reads the key from `DOCONDA_API_KEY`. Create it in the dashboard, under **API keys**.

## Options

```ts theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
const doconda = new Doconda({
  apiKey: process.env.DOCONDA_API_KEY, // default
  maxRetries: 2,                       // retries on network errors, 429 and 5xx
  baseUrl: "https://api.eu.doconda.com/v1", // usually not needed
})
```

| Option | What for |
| - | - |
| `apiKey` | Your key. Its prefix picks the region: `ak_eu_…` goes to the Europe API, `ak_us_…` to the US one. |
| `maxRetries` | How many times to retry a network or server failure. Defaults to 2. |
| `baseUrl` | A different API URL (for example, your local environment: `http://localhost:3000/v1`). Also `DOCONDA_BASE_URL`. |
| `fetch` | Your own `fetch`, for tests or special environments. |

<Warning>
  Use the SDK **on your server**, never in the browser: your API key gives access to every document in the project.
  If you want to show a document being built on your site, see [Watch the document live](/en/sdk/stream).
</Warning>

## What's next

<CardGroup cols={2}>
  <Card title="Create documents" href="/en/sdk/create">Word, PDF, PowerPoint, Excel and artifacts.</Card>
  <Card title="Watch the document live" href="/en/sdk/stream">Events while it is being written.</Card>
  <Card title="Review and edit your file" href="/en/sdk/review-edit">Upload a file and work on it.</Card>
  <Card title="Errors and retries" href="/en/sdk/errors">What can fail and how to react.</Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.