Skip to main content

JSON Schema

The Excalidraw data format uses plaintext JSON.

Excalidraw files

When saving an Excalidraw scene locally to a file, the JSON file (.excalidraw) is using the below format.

Attributes

AttributeDescriptionValue
typeThe type of the Excalidraw schema"excalidraw"
versionThe version of the Excalidraw schemanumber
sourceThe source URL of the Excalidraw application"https://excalidraw.com"
elementsAn array of objects representing excalidraw elements on canvasArray containing excalidraw element objects
appStateAdditional application state/configurationObject containing application state properties
filesData for excalidraw image elementsObject containing image data

JSON Schema example

{
// schema information
"type": "excalidraw",
"version": 2,
"source": "https://excalidraw.com",

// elements on canvas
"elements": [
// example element
{
"id": "pologsyG-tAraPgiN9xP9b",
"type": "rectangle",
"x": 928,
"y": 319,
"width": 134,
"height": 90
/* ...other element properties */
}
/* other elements */
],

// editor state (canvas config, preferences, ...)
"appState": {
"gridSize": 20,
"viewBackgroundColor": "#ffffff"
},

// files data for "image" elements, using format `{ [fileId]: fileData }`
"files": {
// example of an image data object
"3cebd7720911620a3938ce77243696149da03861": {
"mimeType": "image/png",
"id": "3cebd7720911620a3938c.77243626149da03861",
"dataURL": "data:image/png;base64,iVBORWOKGgoAAAANSUhEUgA=",
"created": 1690295874454,
"lastRetrieved": 1690295874454
}
/* ...other image data objects */
}
}

Element creation time

Every normalized element has a created: number | null field. A number is the client's wall-clock time in epoch milliseconds when this element instance was created. null means the creation time is unknown; restoring an older file does not substitute its load time or last-update time.

Operationcreated
Construct a new elementCurrent time, unless explicitly supplied (including null)
Duplicate, paste, or insert from a libraryNew time for the new instance
Convert element skeletons with ID regenerationNew time for each resulting instance
Restore/open/import an existing scenePreserve the carried value; missing values become null
Edit, change type while retaining the ID, capture, undo, or redoPreserve the value

Excalidraw clipboard format

When copying selected excalidraw elements to clipboard, the JSON schema is similar to .excalidraw format, except it differs in attributes.

Attributes

AttributeDescriptionExample Value
typeThe type of the Excalidraw document."excalidraw/clipboard"
elementsAn array of objects representing excalidraw elements on canvas.Array containing excalidraw element objects (see example below)
filesData for excalidraw image elements.Object containing image data