> ## 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.

# How do I keep generated documents in the EU and delete them after?

> Doconda stores documents in the EU (Ireland) and deletes their content when their retention ends: from 15 minutes (none) to 90 days.

Doconda's documents and files are stored in the European Union (Ireland), and the AI that processes them also runs in
the EU. So they aren't kept longer than needed, set `retention` on each request (from `none`, 15 minutes, to `90d`)
or delete them yourself with `DELETE /documents/{id}` as soon as you download them.

## Steps

1. Store your API key in `DOCONDA_API_KEY` and install the SDK (`pip install doconda` or `npm install @doconda/sdk`).
2. Create the document with the shortest retention that works for you.
3. Download it and delete it, along with any files you uploaded.

<CodeGroup>
  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
  from pathlib import Path
  from doconda import Doconda

  doconda = Doconda()  # reads the key from DOCONDA_API_KEY
  doc = doconda.documents.create(
      format="docx",
      content={"markdown": "# Internal note\n\nMonday's meeting moves to 10:00."},
      retention="none",
  )
  Path("note.docx").write_bytes(doconda.documents.download(doc["id"], "docx"))
  doconda.documents.delete(doc["id"])
  ```

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

  const doconda = new Doconda()
  const doc = await doconda.documents.create({
    format: "docx",
    content: { markdown: "# Internal note\n\nMonday's meeting moves to 10:00." },
    retention: "none",
  })
  await writeFile("note.docx", await doconda.documents.download(doc.id, "docx"))
  await doconda.documents.delete(doc.id)
  ```
</CodeGroup>

If you uploaded files, delete them too with `files.delete(id)`.

## Which values `retention` accepts

| `retention` | Kept for |
| - | - |
| `none` | 15 minutes |
| `1d` | 1 day |
| `7d` | 7 days |
| `30d` | 30 days (default) |
| `90d` | 90 days |

There's no "forever". For a whole project, set it in the dashboard; it also applies to files you upload with
`POST /files`.

## What you get back

* The document has `retention` and `expires_at`: when its content will be deleted (set when it finishes).
* Once deleted, the document shows `content_deleted_at`, and `/report` and `/events` answer `410 content_deleted`.
* The files (Word, PDF, images), your request, the report, the events and the `metadata` are deleted. Only what's
  needed for billing remains: status, format, type, pages and cost.

## Limits

* An artifact with `retention: "none"` can't store shared data: it keeps it in each visitor's browser.
* Download links expire after 5 minutes; `documents.outputs(id)` gives you new ones while the document exists.

## FAQ

<AccordionGroup>
  <Accordion title="Does reading a file to Markdown keep anything?">
    No. [`extract`](/en/guides/extract) has no retention: Doconda keeps nothing once you have the text, and if you
    don't collect it, it's deleted after 15 minutes.
  </Accordion>

  <Accordion title="How do I take each document as soon as it's done?">
    With [webhooks](/en/guides/webhooks): they notify you when it finishes and you download it to your system.
  </Accordion>

  <Accordion title="Which API do I use?">
    Every API key (`ak_eu_…`) goes to `https://api.eu.doconda.com/v1`.
  </Accordion>
</AccordionGroup>

## Keep reading

* [Retention](/en/guides/retention) and [Account and projects](/en/guides/account#projects).
* [Quickstart](/en/quickstart).


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