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
AuthorizationBearer <token>

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

In: header

Path Parameters

sceneId*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

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,    "files": {      "property1": {        "mimeType": "string",        "id": "string",        "created": 9007199254740991,        "dataURL": "string"      },      "property2": {        "mimeType": "string",        "id": "string",        "created": 9007199254740991,        "dataURL": "string"      }    }  }'
{
  "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": 9007199254740991,
      "lastRetrieved": 9007199254740991,
      "version": 9007199254740991,
      "dataURL": "string"
    },
    "property2": {
      "mimeType": "string",
      "id": "string",
      "created": 9007199254740991,
      "lastRetrieved": 9007199254740991,
      "version": 9007199254740991,
      "dataURL": "string"
    }
  }
}
{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "string"
}
{
  "statusCode": 401,
  "error": "Unauthorized",
  "message": "string"
}
{
  "statusCode": 403,
  "error": "Forbidden",
  "message": "string"
}
{
  "statusCode": 404,
  "error": "Not Found",
  "message": "string"
}

Last updated on