Embedding files and diagrams
Show a read-only Eraser file or diagram in your own product, internal portal or docs site. Viewers don’t need an Eraser account. For Notion or Confluence, use the Notion or Confluence integration instead.
How it works
- Your server calls Create an embed token with a team API token and the file or diagram to show.
- Eraser returns an
embedUrl. - Your page puts
embedUrlin an iframe.
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"
}' <iframe src="EMBED_URL" width="100%" height="600" style="border: 0" title="Architecture diagram"></iframe> Call the endpoint from your backend – the request carries your API token. Creating a new URL on every page view is fine; the limit is 20,000 requests an hour per token.
Choose what to show
- A file – send only
fileId. The embed shows the file’s canvas, not its document. - A diagram – add
{ "type": "diagram", "id": "<diagramId>" }tocontent, withfileIdset to the file that holds it. - A figure – the same, with
"type": "figure". The embed shows the figure and everything inside it.
content takes up to 20 items. Several items are shown together, where they sit in the file. The embed fits its content to the iframe and refits when the iframe is resized.
Finding IDs
- File – the part of the file’s URL after
/workspace/, or theidfrom List files. - Diagram – select it and choose Copy link. The ID is the
diagramvalue in the link (/workspace/<fileId>?diagram=<diagramId>). List diagrams in a file returns the same IDs. - Figure – select it and choose Copy link. The ID is the
figurevalue in the link (/workspace/<fileId>?figure=<figureId>).
An ID that isn’t in the file fails with a 400.
Appearance
theme–light(default) ordark, whatever the viewer’s own setting.footer– the Eraser logo and the file title.auto(default) shows it on file embeds only;alwaysandneveroverride that. When it’s hidden, the file title isn’t sent to the viewer.titleLink– links the footer title to the file in Eraser. Defaults totrue; turn it off for viewers outside your team.
Viewers can pan and zoom, but can’t edit, comment, copy or export.
Expiry
expiresIn takes a duration such as "15m", "12h" or "2w" (units s, m, h, d, w), or a Unix timestamp in milliseconds. It defaults to "1d", and the response’s expiresAt gives the exact time. Anyone with the URL can view the embed until then, so keep expiries short.
Each load reads the file as it is then. An open embed doesn’t update live.
Revoking
Eraser doesn’t store embeds, so there’s nothing to delete one by one. Delete the API token that created an embed in Settings → API Token, and every embed it created stops working. Use a separate token for each integration so you can revoke one without the others.
An embed also stops working if its file is made private, archived, deleted, moved to another team, or turned into a template or reference. If a selected diagram or figure is deleted, the embed shows a notice in its place rather than more of the file. Expired and revoked embeds show “This embed is unavailable.”
Requirements
- A team API token, which needs a paid plan. Organization-level tokens can’t create embeds.
- On private cloud, use your own Eraser host instead of
app.eraser.io.