Export a diagram
https://app.eraser.io/api/export/diagram Export a diagram that is already stored in an Eraser file, in the formats of the app's Export menu: PNG, JPEG or SVG images, or draw.io, Visio, PowerPoint, BPMN or PDF files. Google Slides export is only in the app.
By default the export is the response body, with the format's Content-Type and a <diagramId>.<extension> download name, and nothing is stored. Pass returnAs: "url" to store the export instead and get back { format, url }. The link expires after 1 hour by default; see urlSettings.
The file must belong to the token's team (for an organization token, to any team in its organization) and must not be archived or private.
Formats
format |
Plan | Diagram types | File | Content-Type |
|---|---|---|---|---|
png (default) |
Any | Any | .png |
image/png |
jpeg |
Any | Any | .jpeg |
image/jpeg |
svg |
Any | Any | .svg |
image/svg+xml |
bpmn |
Any | BPMN | .bpmn |
application/xml |
drawio |
Paid | Any | .drawio |
application/xml |
visio |
Paid | Cloud architecture, flowchart, freeform, BPMN | .vsdx |
application/vnd.ms-visio.drawing |
powerpoint |
Paid | Any | .pptx |
application/vnd.openxmlformats-officedocument.presentationml.presentation |
pdf |
Paid | Any | .pdf |
application/pdf |
- A paid format on a free plan returns
402.visioandbpmnreturn400for other diagram types, naming the diagram's type. imageQualityapplies to PNG and JPEG;backgroundto PNG, JPEG and SVG.pdfprints the one diagram the way Export → PDF prints a selection in the app. A PDF of the whole canvas exports only from the app.
Example requests
Save the diagram to a PNG file:
curl --location 'https://app.eraser.io/api/export/diagram' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $YOUR-TOKEN-HERE' \
--output diagram.png \
--data '{
"fileId": "abc123",
"diagramId": "def456"
}' Save the diagram as SVG with a solid background:
curl --location 'https://app.eraser.io/api/export/diagram' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $YOUR-TOKEN-HERE' \
--output diagram.svg \
--data '{
"fileId": "abc123",
"diagramId": "def456",
"format": "svg",
"background": true
}' Export as draw.io on a dark background:
curl --location 'https://app.eraser.io/api/export/diagram' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $YOUR-TOKEN-HERE' \
--output diagram.drawio \
--data '{
"fileId": "abc123",
"diagramId": "def456",
"format": "drawio",
"theme": "dark"
}' Store the export and get a link back:
curl --location 'https://app.eraser.io/api/export/diagram' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $YOUR-TOKEN-HERE' \
--data '{
"fileId": "abc123",
"diagramId": "def456",
"imageQuality": 3,
"returnAs": "url"
}' Example response
With returnAs: "url":
{
"format": "png",
"url": "https://IMAGE-SITE-URL/IMAGE-NAME.png"
} Request body
fileId string requiredID of the file that holds the diagram.
diagramId string requiredID of the diagram to export. List the diagrams in a file with `GET /api/files/{fileId}/diagrams`.
format string Export format. Defaults to "png". "drawio", "visio", "powerpoint" and "pdf" need a paid plan. "visio" supports cloud architecture, flowchart, freeform and BPMN diagrams; "bpmn" supports BPMN diagrams only.
pngjpegsvgdrawiovisiopowerpointbpmnpdf
returnAs string "file" (default) returns the export as the response body, named `<diagramId>.<extension>`, and stores nothing. "url" stores the export and returns a link to it, which expires after 1 hour by default; see `urlSettings`.
fileurl
theme string Select "light" or "dark" theme. Defaults to "light". Ignored when `format` is "pdf".
lightdark
imageQuality integer Image quality/resolution multiplier. Use 1 (low), 2 (medium), or 3 (high). Defaults to 2. Applies to "png" and "jpeg" only.
123
background boolean Select transparent (false) or solid (true) background. Defaults to false. Applies to "png", "jpeg" and "svg" only.
urlSettings object 2 fields Controls the link returned when `returnAs` is "url". By default it is an expiring link (1 hour, unless your team or organization sets another default).
urlSettings object 2 fieldsaccess string required"public" returns a permanent link. "token" returns a link that expires after `ttl`. Teams and organizations can turn off public links.
publictoken
ttl integer | string Only with `access: "token"`. Seconds (e.g. 3600) or a duration such as "6h", "5d" or "2w", up to 365d.
Responses
200 – The exported diagram
format string The format the diagram was exported in.
pngjpegsvgdrawiovisiopowerpointbpmnpdf
url string URL of the stored export.
{
"format": "png",
"url": "string"
}