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

# Download it

`GET` any of these after `/api/v1/diagrams/:id/`, with your key. The response is the file, with its `Content-Type`. Files are made on request: a picture takes a few seconds, a recording 20 to 60; the same request again is answered from cache. Downloads are always of the latest version. SVG and PDF are on paid plans: on the free plan they answer `403` with `error.type` `plan_required`, which a retry will not change; PNG and JPEG work on every plan.

Every download made with your key also answers with `X-Download-Url`, a link to the same file that works without a key for 15 minutes, and `X-Download-Expires-At`, when it stops working. Hand it to a browser, a build step or a coding agent to fetch with a plain `GET`, for example `curl -fsSL -o images/flow.png "$URL"`. It opens only that file of that diagram, with the same parameters, at that version: after a change to the diagram it answers `410 invalid_link`, and once expired `401 invalid_link`; download again for a new one.

![Diagram of a download link's life: a download with your API key returns X-Download-Url, a link to only that diagram and file, with the same parameters and version, valid for 15 minutes (X-Download-Expires-At). A browser, build step or coding agent opens it without a key, for example with curl. After 15 minutes it answers 401 invalid\_link; after a newer version (a change, edit or animation) it answers 410 invalid\_link. Either way, download again with your key for a new link.](https://mintcdn.com/diagramkit/sWlxT_qLaDK7vTGW/images/download-link.png?fit=max\&auto=format\&n=sWlxT_qLaDK7vTGW\&q=85\&s=62cca547093bbf28da0a2598a7137a30)

A download link opens one file without a key until it expires or the diagram changes; then download again with your key.

| Path | Content-Type | Parameters | What you get |
| - | - | - | - |
| `image.png` | `image/png` | `device`, `quality`, `width_in` | A sharp picture for slides, docs and the web. |
| `image.jpg` | `image/jpeg` | `device`, `quality`, `width_in` | A smaller picture for email and social posts. |
| `image.svg` | `image/svg+xml` | `device` | Vector, every label editable text, for Figma, Illustrator and the web. Paid plans. |
| `image.pdf` | `application/pdf` | `device`, `pages` | Vector, for print and layout tools; `pages=all` makes one PDF of every page of a multi-page diagram. Paid plans. |
| `animation.mp4` | `video/mp4` | `quality`, `size`, `page` | A video, up to 90 seconds. Only for an animated diagram. A multi-page diagram plays every page in order, with a short fade between pages, unless `page` picks one; a long one holds each still page for less so it fits (at least 1.5 seconds), and one too long even so is refused with `422 too_long`. |
| `animation.gif` | `image/gif` | `quality`, `size`, `page` | A looping GIF, up to 60 seconds. Only for an animated diagram. Pages as for `animation.mp4`. |

Parameters go in the query string, for example `image.png?quality=print&width_in=3.25&device=phone`:

| Parameter | For | Values | Default | What it does |
| - | - | - | - | - |
| `device` | `image.*` | `desktop`, `phone` | `desktop` | Which layout: desktop is drawn 900 px wide, phone 390 px wide. Every diagram has both. |
| `quality` | `image.png`, `image.jpg` | `web`, `high`, `print` | `web` | `web` is 1× (900 px wide) and instant; `high` is 2× (1800 px); `print` is 300 dpi at `width_in` inches, with the dpi written into the file. |
| `page` | `image.*` | 1 to 100 | `1` | Which page of a multi-page diagram. |
| `pages` | `image.pdf` | `all` | none | Every page as one PDF, a page each. |
| `width_in` | `image.png`, `image.jpg` with `quality=print` | a number from 1 to 20 (inches, decimals allowed) | `6.5` | The printed width. 6.5 fills a textbook page (1950 px); 3.25 fits one column (975 px). Ignored for other qualities. |
| `quality` | `animation.*` | `low`, `medium`, `high` | `medium` | MP4: low 675 px at up to 24 fps, medium 900 px at 30 fps, high 1800 px at up to 60 fps. GIF: low 675 px at 15 fps, medium 900 px at 20 fps, high 1350 px at 30 fps. Widths are for `size=chat`; framed sizes scale the same way (low is 0.75×, high up to 2×). Higher is larger and slower to record. |
| `size` | `animation.*` | `chat`, `square`, `portrait`, `story`, `landscape`, `wide` | the preset's frame, or `chat` | The frame: chat is the diagram's own shape; square 1080×1080 (1:1); portrait 1080×1350 (4:5); story 1080×1920 (9:16); landscape 1920×1080 (16:9); wide 1920×960 (2:1). The diagram is laid out again for that shape and fitted as large as the frame allows. |
| `page` | `animation.*` | 1 to 100 | none | One page of a multi-page diagram. Left out, every page plays in order in one video: an animated page plays its animation, a still page holds for about 3 seconds, or less in a long set so it fits the format's length (never under 1.5 seconds). About 27 still pages fit a GIF and 41 an MP4; for more, download `image.pdf?pages=all` or one page at a time. |


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