Skip to main content
PATCH
/
v1
/
worlds
/
{id}
/
states
/
{stateId}
Update a state
curl --request PATCH \
  --url https://api.alakazam.gg/v1/worlds/{id}/states/{stateId} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "base": "<string>",
  "camera": {
    "static": "<string>",
    "dynamic": "<string>"
  },
  "movement": {
    "static": "<string>",
    "dynamic": "<string>"
  },
  "ambient": [
    "<string>"
  ],
  "variants": [
    {}
  ]
}
'
{
  "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"
}

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
stateId
string
required

Body

application/json

A node in the graph. Optional fields beyond those listed are allowed (forward-compatible). Prose fields must describe pixels, not intent — the kernel doctrine lints enforce this on every write.

base
string

Scene prose for this node (pixels, not intent).

camera
object

A static/dynamic prompt pair. The world model is conditioned on the static layer while the scene holds and on the dynamic layer while it moves. Both are pixel-prose, never authorial intent.

movement
object

A static/dynamic prompt pair. The world model is conditioned on the static layer while the scene holds and on the dynamic layer while it moves. Both are pixel-prose, never authorial intent.

ambient
string[]

Ambient detail prose fragments.

ending
object

Marks this node as a TERMINAL sink. A node with an ending must be a dead end (no outgoing transitions).

variants
object[]

A/B prompt arms (play-only; never compiled into the graph).

Response

State updated

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"