Images, Pages and More

Worked examples for the rest of a document: images, pages and articles, pictures of a tab and copies.

A tab's elements change through changesets, but a document holds more than elements: the images it shows, its pages and its articles. Each has its own endpoints, shown here with curl. The examples assume your API token is in $TOKEN and a document id in $DOC; paths are relative to https://livedocuments.app/api, and /api/openapi.json has every field.

Every write here reaches anyone with the document open straight away, credited to you.

Images

Upload the raw bytes of a PNG, JPEG, WebP or GIF, up to 10 MB, with its pixel size in two headers:

curl -X POST https://livedocuments.app/api/images \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: image/png" \
  -H "X-Image-Width: 1200" -H "X-Image-Height: 800" \
  -H "X-Image-Original-Name: architecture.png" \
  --data-binary @architecture.png
{
  "image": {
    "id": "9f2c…",
    "contentType": "image/png",
    "byteSize": 48211,
    "width": 1200,
    "height": 800,
    "originalName": "architecture.png",
    "createdAt": 1760180000000
  },
  "deduped": false
}

Uploading the same bytes again answers the image you already have, with "deduped": true. Then put it on a tab with a changeset that adds a whole image element:

curl -X POST https://livedocuments.app/api/documents/$DOC/tabs/$TAB/changesets \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{ "operations": [ { "op": "add", "element": { "type": "image", "imageId": "'"$IMAGE"'", "x": 0, "y": 0, "width": 600, "height": 400, "naturalWidth": 1200, "naturalHeight": 800, "alt": "Architecture overview" } } ] }'

GET /images lists your uploads, GET /images/usage maps each to the documents that use it, GET /images/{id} downloads one, and DELETE /images/{id} removes it from your gallery. Refusals are 415 unsupported_type, 413 file_too_large, and 403 gallery_full once your gallery holds 100 images or 100 MB, counted across every liveworkspace app.

Pages and Articles

POST /documents/$DOC/tabs/$TAB/pages changes a tab's Pages pages, up to 50 changes as one edit, or writes an article from Markdown. A locked tab is refused.

# Add two slides and rename the first page
curl -X POST https://livedocuments.app/api/documents/$DOC/tabs/$TAB/pages \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{ "pages": [
    { "op": "add", "kind": "slide", "name": "Roadmap" },
    { "op": "add", "kind": "slide", "background": { "gradient": ["#1e3a8a", "#7c3aed"] } },
    { "op": "set", "page": 1, "name": "Cover" }
  ] }'

# Write an article: the editor flows it onto pages
curl -X POST https://livedocuments.app/api/documents/$DOC/tabs/$TAB/pages \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{ "article": { "markdown": "# Release notes\n\nWhat changed this month.", "size": "a4" } }'

A page change is add (a kind of infographic or slide, with an optional size, orientation, name, background, layout and at), set, layout, move, duplicate or delete; a page is named by its id, its place in the row (from 1) or its name. An article write takes mode replace (the default) or append, and article to name an existing one. The answer lists every page with its rectangle on the canvas, which is where a changeset puts elements to land them on that page.

A Tab as a Picture

curl https://livedocuments.app/api/documents/$DOC/tabs/$TAB/render.svg \
  -H "Authorization: Bearer $TOKEN" -o overview.svg

The tab drawn by the same renderer the CLI's tab render and pull --svg use, as image/svg+xml, with images inlined when the host stores them. It is never cached, so it always shows the tab now. For an image to embed somewhere public, use a live image instead.

Copy a Document

curl -X POST https://livedocuments.app/api/documents/$DOC/copy \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{ "name": "Service map (2027 draft)" }'

Makes a copy in your own files and answers 201 with the new document. Leave out name for Copy of <name>. Anything you can read can be copied; share links are not copied with it.

Was this article helpful?