Excalidraw+ API

Replace scene content

Replace the complete content of a scene with the supplied elements, files, and app state.

This endpoint allows you to:

  • Replace all scene elements with new ones
  • Update or add files to the scene
  • Modify scene settings and app state
  • Force connected editors to reload the scene after an authoritative full replacement

This is an authoritative full replacement. Any existing elements not included in the request will be removed from the scene, connected editors will be forced to reload instead of reconciling the change incrementally, and any sceneVersion value in the request body will be ignored because the server always recomputes it from the submitted content. If you only want to add or update specific elements, files, or app-state fields without replacing the whole scene, use PATCH /scenes/:sceneId/content instead.

Use cases:

  • Restoring scene from backup
  • Replacing a scene from an external system of record
  • Correcting a scene even while editors are currently open
  • Programmatic scene generation
PUT
/api/v1/scenes/{sceneId}/content

Authorization

apiKey
headerAuthorizationBearer <Bearer>

The API will use the Authorization: Bearer <your-key> header for requests.

Path Parameters

sceneId*string

Request Body

application/json
  1. body
type*"excalidraw"
Value in"excalidraw"
version*number
source*string
appState*unknown
elements*unknown
sceneVersion?string
files*
filesFailedToEmbed?array<string>

Ignored on write requests. Present so GET responses can be reused as PUT/PATCH inputs.

Response Body

This response returns the replaced content for the scene.

application/json
  1. response

This response returns the replaced content for the scene.

type*"excalidraw"
Value in"excalidraw"
version*number
source*string
appState*
elements*array<unknown>
sceneVersion*string
files*
Example Request
curl -X PUT 'https://api.excalidraw.com/api/v1/scenes/string/content' \
  -H 'Content-Type: application/json' \
  -d '{
  "type": "excalidraw",
  "version": 0,
  "source": "string",
  "appState": null,
  "elements": null,
  "files": {
    "property1": {
      "mimeType": "string",
      "id": "string",
      "created": 1,
      "dataURL": "string"
    },
    "property2": {
      "mimeType": "string",
      "id": "string",
      "created": 1,
      "dataURL": "string"
    }
  }
}'
Example Response
{
  "type": "excalidraw",
  "version": 0,
  "source": "string",
  "appState": {
    "viewBackgroundColor": "string",
    "lockedMultiSelections": {
      "property1": true,
      "property2": true
    }
  },
  "elements": [
    null
  ],
  "sceneVersion": "string",
  "files": {
    "property1": {
      "mimeType": "string",
      "id": "string",
      "created": 1,
      "lastRetrieved": 1,
      "version": 1,
      "dataURL": "string"
    },
    "property2": {
      "mimeType": "string",
      "id": "string",
      "created": 1,
      "lastRetrieved": 1,
      "version": 1,
      "dataURL": "string"
    }
  }
}

Last updated on