Create an embed token
https://app.eraser.io/api/embedTokens Create a URL that shows a read-only Eraser file or diagram in an iframe. Viewers don't need an Eraser account.
Call this from your server, never from the browser – the request carries your API token. See Embedding files and diagrams for choosing what to show, how long an embed lasts, and how to revoke one.
Example request
curl --location 'https://app.eraser.io/api/embedTokens' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $YOUR-TOKEN-HERE' \
--data '{
"fileId": "abc123",
"content": [{ "type": "diagram", "id": "def456" }],
"expiresIn": "1h",
"theme": "dark"
}' Example response
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"embedUrl": "https://app.eraser.io/embed?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresAt": 1790000000000
} Showing the embed
Put embedUrl in an iframe's src:
<iframe src="EMBED_URL" width="100%" height="600" style="border: 0" title="Architecture diagram"></iframe> Request body
fileId string requiredID of the file to embed, or of the file that holds the diagram or figure to embed – the part of the file's URL after /workspace/, or the id returned by List files. Private, archived, template and reference files can't be embedded.
content object[] 2 fields What to show. Leave it out to embed the whole file, or list a diagram to embed just that diagram. Takes 1–20 items; an empty array is rejected. Several items are shown together, where they sit in the file.
content object[] 2 fieldstype string required"diagram" and "figure" show one diagram or figure. "canvas" shows everything on the file's canvas.
canvasfigurediagram
id string Required for "figure" and "diagram". Embedding files and diagrams explains where to find each one.
expiresIn string | integer When the embed stops working. Either a duration from now – a whole number followed by s, m, h, d or w, such as "6h" – or an absolute time as a Unix timestamp in milliseconds. Defaults to "1d".
theme string Select "light" or "dark" theme. Defaults to "light".
lightdark
footer string Whether to show the footer with the Eraser logo and the file title. "auto" (default) shows it on file embeds and hides it on diagram and figure embeds. When the footer is hidden, the file title isn't sent to the viewer at all.
autoalwaysnever
titleLink boolean Whether the file title in the footer links to the file in Eraser. Defaults to true. The link only works for viewers who can already open the file in Eraser.
Responses
200 – The embed URL
token string The signed embed token. embedUrl already contains it, so most integrations never use it on its own.
embedUrl string The URL to put in an iframe. Anyone who has it can view the embed until it expires.
expiresAt integer When the embed stops working, as a Unix timestamp in milliseconds.
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"embedUrl": "https://app.eraser.io/embed?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresAt": 1790000000000
}