Apply a batch of graph ops
Apply an ordered batch of GraphOps atomically: unapplicable ops are collected in applyErrors (the editor’s behavior), then the resulting world is validated ONCE through the kernel gate. A 422 means the batch was rejected as a whole. Nothing persists. This single endpoint backs nearly all editor mutations.
curl --request POST \
--url https://api.alakazam.gg/v1/worlds/{id}/ops \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"ops": [
{
"op": "add_state",
"id": "<string>",
"base": "<string>",
"camera": {
"static": "<string>",
"dynamic": "<string>"
},
"movement": {
"static": "<string>",
"dynamic": "<string>"
},
"ambient": [
"<string>"
],
"ending": {},
"variants": [
{}
]
}
],
"expectedRev": "<string>"
}
'import requests
url = "https://api.alakazam.gg/v1/worlds/{id}/ops"
payload = {
"ops": [
{
"op": "add_state",
"id": "<string>",
"base": "<string>",
"camera": {
"static": "<string>",
"dynamic": "<string>"
},
"movement": {
"static": "<string>",
"dynamic": "<string>"
},
"ambient": ["<string>"],
"ending": {},
"variants": [{}]
}
],
"expectedRev": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
ops: [
{
op: 'add_state',
id: '<string>',
base: '<string>',
camera: {static: '<string>', dynamic: '<string>'},
movement: {static: '<string>', dynamic: '<string>'},
ambient: ['<string>'],
ending: {},
variants: [{}]
}
],
expectedRev: '<string>'
})
};
fetch('https://api.alakazam.gg/v1/worlds/{id}/ops', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.alakazam.gg/v1/worlds/{id}/ops",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'ops' => [
[
'op' => 'add_state',
'id' => '<string>',
'base' => '<string>',
'camera' => [
'static' => '<string>',
'dynamic' => '<string>'
],
'movement' => [
'static' => '<string>',
'dynamic' => '<string>'
],
'ambient' => [
'<string>'
],
'ending' => [
],
'variants' => [
[
]
]
]
],
'expectedRev' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.alakazam.gg/v1/worlds/{id}/ops"
payload := strings.NewReader("{\n \"ops\": [\n {\n \"op\": \"add_state\",\n \"id\": \"<string>\",\n \"base\": \"<string>\",\n \"camera\": {\n \"static\": \"<string>\",\n \"dynamic\": \"<string>\"\n },\n \"movement\": {\n \"static\": \"<string>\",\n \"dynamic\": \"<string>\"\n },\n \"ambient\": [\n \"<string>\"\n ],\n \"ending\": {},\n \"variants\": [\n {}\n ]\n }\n ],\n \"expectedRev\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.alakazam.gg/v1/worlds/{id}/ops")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"ops\": [\n {\n \"op\": \"add_state\",\n \"id\": \"<string>\",\n \"base\": \"<string>\",\n \"camera\": {\n \"static\": \"<string>\",\n \"dynamic\": \"<string>\"\n },\n \"movement\": {\n \"static\": \"<string>\",\n \"dynamic\": \"<string>\"\n },\n \"ambient\": [\n \"<string>\"\n ],\n \"ending\": {},\n \"variants\": [\n {}\n ]\n }\n ],\n \"expectedRev\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.alakazam.gg/v1/worlds/{id}/ops")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"ops\": [\n {\n \"op\": \"add_state\",\n \"id\": \"<string>\",\n \"base\": \"<string>\",\n \"camera\": {\n \"static\": \"<string>\",\n \"dynamic\": \"<string>\"\n },\n \"movement\": {\n \"static\": \"<string>\",\n \"dynamic\": \"<string>\"\n },\n \"ambient\": [\n \"<string>\"\n ],\n \"ending\": {},\n \"variants\": [\n {}\n ]\n }\n ],\n \"expectedRev\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"world": {
"id": "<string>",
"name": "<string>",
"entrance": {
"image": {
"src": "<string>",
"label": "<string>"
},
"state": "<string>"
},
"scene": {
"states": {},
"events": [
{}
]
},
"description": "<string>",
"cover": "<string>",
"subject": "<string>",
"subjectRef": {
"imageUrl": "<string>",
"descriptor": "<string>"
}
},
"diagnostics": [
{
"lint": "<string>",
"severity": "error",
"path": "<string>",
"message": "<string>",
"loc": {
"field": "<string>",
"template": "<string>",
"slot": "<string>",
"fill": "<string>"
}
}
],
"rev": "<string>",
"schemaVersion": "1.0",
"applyErrors": [
"<string>"
]
}{
"detail": "<string>",
"errors": [
"<string>"
],
"schemaVersion": "<string>"
}{
"detail": "<string>",
"errors": [
"<string>"
],
"schemaVersion": "<string>"
}{
"detail": "<string>",
"errors": [
"<string>"
],
"schemaVersion": "<string>"
}{
"detail": "<string>",
"errors": [
"<string>"
],
"schemaVersion": "<string>"
}{
"detail": "<string>",
"errors": [
"<string>"
],
"schemaVersion": "<string>"
}{
"detail": "<string>",
"diagnostics": [
{
"lint": "<string>",
"severity": "error",
"path": "<string>",
"message": "<string>",
"loc": {
"field": "<string>",
"template": "<string>",
"slot": "<string>",
"fill": "<string>"
}
}
],
"schemaVersion": "1.0"
}Authorizations
An app API key, e.g. Authorization: Bearer sk_live_…. Secret (sk_) for writes/sessions; publishable (pk_) is read-only (browser-safe).
Headers
Path Parameters
Body
1One operation in the CURATED public op vocabulary applied by POST /v1/worlds/{id}/ops. This is a stable, versioned surface mapped onto the internal engine. The kernel's internal op grammar is not exposed. Every op funnels through the same fail-closed validation gate as the dedicated CRUD endpoints.
- add_state
- update_state
- delete_state
- add_event
- update_event
- delete_event
- set_entrance
- set_subject_ref
- add_variant
- remove_variant
Show child attributes
Show child attributes
Response
Batch applied
The result of a graph write. world is the new, kernel-validated world; diagnostics carries advisory (warning/info) findings; rev is the new concurrency token (also returned as the ETag header).
A playable world's compiled graph, id, name, entrance, and the scene (states + events). This is the shape returned inside the world field of a World resource (see World) and by the graph-editing routes. Additional optional properties are allowed (forward-compatible); the schemaVersion on responses pins the contract version.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
The new revision token. Pass it as If-Match on the next write.
"1.0"
Per-op messages for ops that could not be applied (non-fatal).
curl --request POST \
--url https://api.alakazam.gg/v1/worlds/{id}/ops \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"ops": [
{
"op": "add_state",
"id": "<string>",
"base": "<string>",
"camera": {
"static": "<string>",
"dynamic": "<string>"
},
"movement": {
"static": "<string>",
"dynamic": "<string>"
},
"ambient": [
"<string>"
],
"ending": {},
"variants": [
{}
]
}
],
"expectedRev": "<string>"
}
'import requests
url = "https://api.alakazam.gg/v1/worlds/{id}/ops"
payload = {
"ops": [
{
"op": "add_state",
"id": "<string>",
"base": "<string>",
"camera": {
"static": "<string>",
"dynamic": "<string>"
},
"movement": {
"static": "<string>",
"dynamic": "<string>"
},
"ambient": ["<string>"],
"ending": {},
"variants": [{}]
}
],
"expectedRev": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
ops: [
{
op: 'add_state',
id: '<string>',
base: '<string>',
camera: {static: '<string>', dynamic: '<string>'},
movement: {static: '<string>', dynamic: '<string>'},
ambient: ['<string>'],
ending: {},
variants: [{}]
}
],
expectedRev: '<string>'
})
};
fetch('https://api.alakazam.gg/v1/worlds/{id}/ops', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.alakazam.gg/v1/worlds/{id}/ops",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'ops' => [
[
'op' => 'add_state',
'id' => '<string>',
'base' => '<string>',
'camera' => [
'static' => '<string>',
'dynamic' => '<string>'
],
'movement' => [
'static' => '<string>',
'dynamic' => '<string>'
],
'ambient' => [
'<string>'
],
'ending' => [
],
'variants' => [
[
]
]
]
],
'expectedRev' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.alakazam.gg/v1/worlds/{id}/ops"
payload := strings.NewReader("{\n \"ops\": [\n {\n \"op\": \"add_state\",\n \"id\": \"<string>\",\n \"base\": \"<string>\",\n \"camera\": {\n \"static\": \"<string>\",\n \"dynamic\": \"<string>\"\n },\n \"movement\": {\n \"static\": \"<string>\",\n \"dynamic\": \"<string>\"\n },\n \"ambient\": [\n \"<string>\"\n ],\n \"ending\": {},\n \"variants\": [\n {}\n ]\n }\n ],\n \"expectedRev\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.alakazam.gg/v1/worlds/{id}/ops")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"ops\": [\n {\n \"op\": \"add_state\",\n \"id\": \"<string>\",\n \"base\": \"<string>\",\n \"camera\": {\n \"static\": \"<string>\",\n \"dynamic\": \"<string>\"\n },\n \"movement\": {\n \"static\": \"<string>\",\n \"dynamic\": \"<string>\"\n },\n \"ambient\": [\n \"<string>\"\n ],\n \"ending\": {},\n \"variants\": [\n {}\n ]\n }\n ],\n \"expectedRev\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.alakazam.gg/v1/worlds/{id}/ops")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"ops\": [\n {\n \"op\": \"add_state\",\n \"id\": \"<string>\",\n \"base\": \"<string>\",\n \"camera\": {\n \"static\": \"<string>\",\n \"dynamic\": \"<string>\"\n },\n \"movement\": {\n \"static\": \"<string>\",\n \"dynamic\": \"<string>\"\n },\n \"ambient\": [\n \"<string>\"\n ],\n \"ending\": {},\n \"variants\": [\n {}\n ]\n }\n ],\n \"expectedRev\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"world": {
"id": "<string>",
"name": "<string>",
"entrance": {
"image": {
"src": "<string>",
"label": "<string>"
},
"state": "<string>"
},
"scene": {
"states": {},
"events": [
{}
]
},
"description": "<string>",
"cover": "<string>",
"subject": "<string>",
"subjectRef": {
"imageUrl": "<string>",
"descriptor": "<string>"
}
},
"diagnostics": [
{
"lint": "<string>",
"severity": "error",
"path": "<string>",
"message": "<string>",
"loc": {
"field": "<string>",
"template": "<string>",
"slot": "<string>",
"fill": "<string>"
}
}
],
"rev": "<string>",
"schemaVersion": "1.0",
"applyErrors": [
"<string>"
]
}{
"detail": "<string>",
"errors": [
"<string>"
],
"schemaVersion": "<string>"
}{
"detail": "<string>",
"errors": [
"<string>"
],
"schemaVersion": "<string>"
}{
"detail": "<string>",
"errors": [
"<string>"
],
"schemaVersion": "<string>"
}{
"detail": "<string>",
"errors": [
"<string>"
],
"schemaVersion": "<string>"
}{
"detail": "<string>",
"errors": [
"<string>"
],
"schemaVersion": "<string>"
}{
"detail": "<string>",
"diagnostics": [
{
"lint": "<string>",
"severity": "error",
"path": "<string>",
"message": "<string>",
"loc": {
"field": "<string>",
"template": "<string>",
"slot": "<string>",
"fill": "<string>"
}
}
],
"schemaVersion": "1.0"
}
