Save canvas state
Persist the full working state of a canvas: viewport, the complete set of nodes, and the complete set of edges. Nodes and edges not present in the payload are deleted. Increments the canvas version and writes a version snapshot. Requires an agency key (ak_).
curl -X POST "https://mythic-analytics.gulp.workers.dev/builder/canvases/123e4567-e89b-12d3-a456-426614174000/save?location_id=acme-retail" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"viewport": {
"x": 0,
"y": 0,
"zoom": 1
},
"nodes": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"type": "page",
"label": "example_string",
"position_x": 3.14,
"position_y": 3.14
}
],
"edges": [
{
"id": "example_string",
"source_node_id": "123e4567-e89b-12d3-a456-426614174000",
"target_node_id": "123e4567-e89b-12d3-a456-426614174000",
"source_handle": "example_string",
"target_handle": "example_string",
"label": "example_string"
}
]
}'
import requests
import json
url = "https://mythic-analytics.gulp.workers.dev/builder/canvases/123e4567-e89b-12d3-a456-426614174000/save?location_id=acme-retail"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
}
data = {
"viewport": {
"x": 0,
"y": 0,
"zoom": 1
},
"nodes": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"type": "page",
"label": "example_string",
"position_x": 3.14,
"position_y": 3.14
}
],
"edges": [
{
"id": "example_string",
"source_node_id": "123e4567-e89b-12d3-a456-426614174000",
"target_node_id": "123e4567-e89b-12d3-a456-426614174000",
"source_handle": "example_string",
"target_handle": "example_string",
"label": "example_string"
}
]
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://mythic-analytics.gulp.workers.dev/builder/canvases/123e4567-e89b-12d3-a456-426614174000/save?location_id=acme-retail", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
},
body: JSON.stringify({
"viewport": {
"x": 0,
"y": 0,
"zoom": 1
},
"nodes": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"type": "page",
"label": "example_string",
"position_x": 3.14,
"position_y": 3.14
}
],
"edges": [
{
"id": "example_string",
"source_node_id": "123e4567-e89b-12d3-a456-426614174000",
"target_node_id": "123e4567-e89b-12d3-a456-426614174000",
"source_handle": "example_string",
"target_handle": "example_string",
"label": "example_string"
}
]
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"viewport": {
"x": 0,
"y": 0,
"zoom": 1
},
"nodes": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"type": "page",
"label": "example_string",
"position_x": 3.14,
"position_y": 3.14
}
],
"edges": [
{
"id": "example_string",
"source_node_id": "123e4567-e89b-12d3-a456-426614174000",
"target_node_id": "123e4567-e89b-12d3-a456-426614174000",
"source_handle": "example_string",
"target_handle": "example_string",
"label": "example_string"
}
]
}`)
req, err := http.NewRequest("POST", "https://mythic-analytics.gulp.workers.dev/builder/canvases/123e4567-e89b-12d3-a456-426614174000/save?location_id=acme-retail", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://mythic-analytics.gulp.workers.dev/builder/canvases/123e4567-e89b-12d3-a456-426614174000/save?location_id=acme-retail')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['Authorization'] = 'Bearer YOUR_API_TOKEN'
request.body = '{
"viewport": {
"x": 0,
"y": 0,
"zoom": 1
},
"nodes": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"type": "page",
"label": "example_string",
"position_x": 3.14,
"position_y": 3.14
}
],
"edges": [
{
"id": "example_string",
"source_node_id": "123e4567-e89b-12d3-a456-426614174000",
"target_node_id": "123e4567-e89b-12d3-a456-426614174000",
"source_handle": "example_string",
"target_handle": "example_string",
"label": "example_string"
}
]
}'
response = http.request(request)
puts response.body
{
"success": true,
"version": 4
}
{
"error": "Forbidden",
"message": "You don't have permission to access this resource",
"code": 403
}
{
"error": "Not Found",
"message": "The requested resource was not found",
"code": 404
}
{
"error": "Internal Server Error",
"message": "An unexpected error occurred on the server",
"code": 500,
"requestId": "req_1234567890"
}
/canvases/{id}/saveTarget server for requests. Edit to use your own host.
Builder key as a bearer token. Use an agency key for full CRUD (Bearer ak_...) or a viewer key for read-only access (Bearer sk_...). Scoped keys (mcp_) are accepted too and need canvases:read or canvases:write. See Using an mcp_ key over HTTP.
Bearer ak_...) or a viewer key for read-only access (Bearer sk_...). Scoped keys (mcp_) are accepted too and need canvases:read or canvases:write. See Using an mcp_ key over HTTP.Canvas UUID.
Client location to scope the request to. Required when authenticating with an agency key (ak_). Ignored for viewer keys (sk_).
The media type of the request body
Complete node set. Missing nodes are deleted.
Complete edge set. Missing edges are deleted.
Request Preview
Response
Response will appear here after sending the request
Authentication
Bearer token. Builder key as a bearer token. Use an agency key for full CRUD (Bearer ak_...) or a viewer key for read-only access (Bearer sk_...). Scoped keys (mcp_) are accepted too and need canvases:read or canvases:write. See Using an mcp_ key over HTTP.
Path Parameters
Canvas UUID.
Query Parameters
Client location to scope the request to. Required when authenticating with an agency key (ak_). Ignored for viewer keys (sk_).
acme-retailBody
{"x":0,"y":0,"zoom":1}Complete node set. Missing nodes are deleted.
Complete edge set. Missing edges are deleted.