Skip to main content
POST
/
v1
/
worlds
/
{id}
/
ops
Apply a batch of graph ops
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>"
}
'
{
  "world": {
    "id": "<string>",
    "name": "<string>",
    "entrance": {
      "image": {
        "src": "<string>",
        "label": "<string>"
      },
      "state": "<string>"
    },
    "scene": {
      "states": {},
      "events": [
        {}
      ]
    },
    "description": "<string>",
    "cover": "<string>"
  },
  "diagnostics": [
    {
      "lint": "<string>",
      "path": "<string>",
      "message": "<string>",
      "loc": {
        "field": "<string>",
        "template": "<string>",
        "slot": "<string>",
        "fill": "<string>"
      }
    }
  ],
  "rev": "<string>",
  "schemaVersion": "1.0",
  "applyErrors": [
    "<string>"
  ]
}

Authorizations

Authorization
string
header
required

An app API key, e.g. Authorization: Bearer sk_live_…. Secret (sk_) for writes/sessions; publishable (pk_) for read/embed.

Headers

If-Match
string

Path Parameters

id
string<uuid>
required

Body

application/json
ops
(add_state · object | update_state · object | delete_state · object | add_event · object | update_event · object | delete_event · object | set_entrance · object | add_variant · object | remove_variant · object)[]
required
Minimum array length: 1

One 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.

expectedRev
string

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).

world
object

A playable world. The full contract is published as JSON Schema at https://alakazam.gg/schema/smworld-1.0.json (see schema/COMPATIBILITY.md). Additional optional properties are allowed (forward-compatible).

diagnostics
object[]
rev
string

The new revision token. Pass it as If-Match on the next write.

schemaVersion
string
Example:

"1.0"

applyErrors
string[]

Per-op messages for ops that could not be applied (non-fatal).