Studio HTTP API
Every Mode 8 Studio route, its body fields, status codes, auth and WebSocket events.
mode8 studio is the browser workbench, and everything its UI does goes through a small JSON API on your machine: 58 routes. You can script it too, for example to drive Studio from a test or a custom tool. Using the UI itself is covered in Studio.
Note
This page is generated from mode8 schema --section http and tests/golden/outputs_v1.json by docs/manual/_tools/gen_reference.py. To change it, change Mode 8 (or the prose in the generator) and run the generator with --write; a test fails when this page is out of date.
Connecting#
Install the extra (pip install "mode8[studio]") and start Studio. It listens on 127.0.0.1:8420 by default and prints one ready document with the URL and a fresh session token:
mode8 studio my-game --no-browser- Every
/api/*route and/wsneed the token: send the headerX-Mode8-Token: <token>, the query?token=<token>or the cookiemode8_token. - Non-loopback Host / Origin headers are rejected (403) unless allowed via --allow-host.
- Every JSON response carries
"ok": true; errors use the envelope{"ok": false, "error": {"type", "msg", ...}}.
Here is a call with curl, using the token from the ready document:
curl -s -H "X-Mode8-Token: $TOKEN" http://127.0.0.1:8420/api/assetsRequest bodies#
- Bodies are JSON objects sent as
Content-Type: application/json(anything else is a 415). Every mutating route refuses unknown fields with a 400InputErrorthat lists them inerror.fields. - Body cap: 2097152 bytes (2 MiB); 100663296 bytes (96 MiB) on the image routes (
PUT /api/assets/{name}/pixels/{kind},POST /api/assets/{name}/layers,POST /api/jobs/inpaint). A larger body is a 413. - Many writes take
expected_sha256: the SHA-256 you last read. If the file changed since, the write is refused with a 409ConflictErrorinstead of overwriting someone else's work. actor(human,agentorcli) is who the journal records for the edit. Studio's own UI sendshuman.
Status codes#
| Status | Meaning |
|---|---|
400 | invalid input (InputError: a bad value, an unknown body field, an invalid JSON body) |
401 | missing/invalid token |
403 | forbidden host or origin |
404 | not found (NotFoundError: route, asset, layer, job, palette, file) |
405 | method not allowed |
409 | conflict (ConflictError, LayeredAssetError, AssetExistsError, FileExistsError, ProjectVersionError, PaletteInUseError) |
413 | request body too large |
415 | unsupported media type |
500 | unexpected error (type = the exception class, msg = its message; never a traceback) |
Studio-specific error types (the shared ones are on Output Envelope and Exit Codes):
| Type | Status and extras |
|---|---|
AssetExistsError | 409, with asset / path |
AuthError | 401 missing/invalid token |
ForbiddenError | 403 host / origin |
MethodNotAllowedError | 405 wrong method for the route |
NotFoundError | 404 unknown route, asset, layer, job, palette or file |
NothingToRedoError | 400, with asset / can_undo / can_redo |
NothingToUndoError | 400, with asset / can_undo / can_redo |
PaletteInUseError | 409, with used_by |
PayloadTooLargeError | 413 body over the route's byte cap (with limit) |
UnsupportedMediaTypeError | 415 body Content-Type is not application/json |
Routes at a glance#
| Method | Path | Group |
|---|---|---|
GET | / | Pages and info |
GET | /static/{path} | Pages and info |
GET | /source | Pages and info |
GET | /api/info | Pages and info |
GET | /api/doctor | Pages and info |
GET | /api/palettes | Palettes |
POST | /api/palettes/import | Palettes |
PUT | /api/palettes/{name} | Palettes |
DELETE | /api/palettes/{name} | Palettes |
GET | /api/assets | Assets |
POST | /api/assets | Assets |
GET | /api/assets/{name} | Assets |
GET | /api/assets/{name}/image/{kind} | Assets |
GET | /api/assets/{name}/pixels/{kind} | Assets |
PUT | /api/assets/{name}/pixels/{kind} | Assets |
POST | /api/assets/{name}/draft | Assets |
POST | /api/assets/{name}/parts | Assets |
POST | /api/assets/{name}/rig | Assets |
POST | /api/assets/{name}/outline | Assets |
POST | /api/assets/{name}/palette-swap | Assets |
POST | /api/assets/{name}/wrap-shift | Assets |
GET | /api/assets/{name}/lint | Assets |
POST | /api/assets/{name}/lint | Assets |
POST | /api/assets/{name}/lint-fix | Assets |
POST | /api/assets/{name}/rename | Asset management |
POST | /api/assets/{name}/duplicate | Asset management |
DELETE | /api/assets/{name} | Asset management |
POST | /api/assets/restore | Asset management |
POST | /api/assets/{name}/resize | Asset management |
POST | /api/assets/{name}/frames | Asset management |
GET | /api/assets/{name}/boxes | Gameplay boxes |
PUT | /api/assets/{name}/boxes | Gameplay boxes |
GET | /api/assets/{name}/history | History |
POST | /api/assets/{name}/undo | History |
POST | /api/assets/{name}/redo | History |
GET | /api/assets/{name}/layers | Layers |
POST | /api/assets/{name}/layers | Layers |
POST | /api/assets/{name}/layers/reorder | Layers |
POST | /api/assets/{name}/layers/flatten | Layers |
PATCH | /api/assets/{name}/layers/{layer_id} | Layers |
DELETE | /api/assets/{name}/layers/{layer_id} | Layers |
POST | /api/assets/{name}/layers/{layer_id}/duplicate | Layers |
POST | /api/assets/{name}/layers/{layer_id}/merge-down | Layers |
POST | /api/assets/{name}/export | Export |
GET | /api/exports/{name} | Export |
GET | /api/exports/{name}/{filename} | Export |
GET | /api/exports/{name}.zip | Export |
POST | /api/exports/{name}/open | Export |
GET | /api/jobs | Generation jobs |
POST | /api/jobs/gen | Generation jobs |
POST | /api/jobs/inpaint | Generation jobs |
POST | /api/jobs/animate | Generation jobs |
GET | /api/jobs/{job_id} | Generation jobs |
GET | /api/jobs/{job_id}/candidate/{index:int} | Generation jobs |
POST | /api/jobs/{job_id}/accept | Generation jobs |
POST | /api/jobs/{job_id}/cancel | Generation jobs |
POST | /api/jobs/{job_id}/retry | Generation jobs |
WEBSOCKET | /ws | Live updates |
Routes#
Pages and info#
The Studio page, license information and project-wide facts.
GET /#
Serves the Studio page. Opening it with ?token=<token> stores the session token in an HTTP-only cookie, so the page's own API calls are authorized.
GET /static/{path}#
Static files of the Studio page (scripts, styles).
GET /source#
License and source location: {"ok": true, "license", "mode8_version", "source_url"}. A browser (an Accept: text/html request) is redirected to the source URL instead.
Response keys: license, mode8_version, ok, source_url.
GET /api/info#
Project config, Mode 8 version and every catalog the UI needs: archetypes, rigs, tile kinds, export and engine formats, metrics, dithers, art types and UI-kit kinds, styles and states.
Response keys: archetypes, art_types, comfy_url, config, dithers, engine_formats, export_formats, license, metrics, mode8_version, ok, project_root, rigs, routes, source_url, tile_kinds, token_required, ui_default_sizes, ui_kinds, ui_states, ui_styles.
GET /api/doctor#
The mode8 doctor readiness report for the configured ComfyUI. Optional query preset.
Response keys: comfy_start, comfy_start_source, comfy_url, comfy_url_source, environment, failure, hints, missing_models, missing_nodes, ok, pass, preset_art_types, presets, reachable, setup_commands.
Palettes#
Bundled palettes plus the project's own palettes/<name>.gpl files.
GET /api/palettes#
Every palette Studio can use (bundled and project), with colors as hex.
Response keys: ok, palettes.
POST /api/palettes/import#
Imports GIMP .gpl or hex palette text as the project palette name (201). #000000 entries are dropped and reported in dropped_black.
Body fields: name, text, title.
Response keys: dropped_black, ok, palette.
PUT /api/palettes/{name}#
Creates or replaces the project palette palettes/<name>.gpl from colors (a list of #rrggbb strings or [r, g, b] triples). Bundled palettes are never touched.
Body fields: colors, title.
Response keys: ok, palette.
DELETE /api/palettes/{name}#
Deletes a project palette. A palette still used by an asset or as the project default_palette is a 409 PaletteInUseError listing used_by, unless the body says {"force": true}. Bundled palettes cannot be deleted.
Body fields: force.
Response keys: deleted, ok, used_by.
Assets#
Create, read and edit the assets under assets/<name>/.
GET /api/assets#
A summary row for every asset in the project.
Response keys: assets, ok.
POST /api/assets#
Creates an asset (201): blank, from a draft archetype, an art_type profile, or a UI-kit piece (ui_kind, style, state). A name that is already taken is a 409 AssetExistsError.
Body fields: actor, archetype, art_type, name, palette, size, state, style, ui_kind.
Response keys: animations, archetype, art_type, boxes_sha256, can_redo, can_undo, draft_edited, draft_sha256, facing, frame_names, frames, frames_custom, frames_rig, has_draft, has_parts, has_pins, has_rig, layers, lint, master_sha256, name, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, overrides, palette, palette_colors, palette_path, parts_legend, parts_sha256, path, pins_count, pins_sha256, rig, sidecar, size, stale, undo_deletes_asset, undo_restores_asset, urls.
GET /api/assets/{name}#
Everything about one asset: sidecar, master_sha256 (send it back as expected_sha256), frames, overrides, layers, lint, undo flags and image URLs.
Response keys: animations, archetype, art_type, boxes_sha256, can_redo, can_undo, draft_edited, draft_sha256, facing, frame_names, frames, frames_custom, frames_rig, has_draft, has_parts, has_pins, has_rig, layers, lint, master_sha256, name, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, overrides, palette, palette_colors, palette_path, parts_legend, parts_sha256, path, pins_count, pins_sha256, rig, sidecar, size, stale, undo_deletes_asset, undo_restores_asset, urls.
GET /api/assets/{name}/image/{kind}#
PNG bytes of one image of the asset. kind is master, draft, parts, pins, frame:<frame>, override:<frame>, layer:<id> or parts_overlay (a colored rendering of the part map).
GET /api/assets/{name}/pixels/{kind}#
Raw pixels of one image as JSON (width, height, rgba_b64, sha256, exists) for the editor. kind as for the image route, except parts_overlay; parts also returns parts_b64 and legend.
Response keys: exists, height, kind, layer, layer_id, layer_sha256, master_sha256, ok, rgba_b64, sha256, width.
PUT /api/assets/{name}/pixels/{kind}#
Writes edited pixels (journaled, default actor human). kind is master, layer:<id>, draft, parts, pins or frame:<frame> (saved as a sparse override against the rig frame). Pass expected_sha256 for a conflict check. The accepted fields depend on the kind (table below).
Body cap: 96 MiB (image route).
Response keys: can_redo, can_undo, entry_id, layer_id, layer_sha256, layers, lint, master_sha256, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, pins_changed, previous_sha256, sha256, stale, undo_deletes_asset, undo_restores_asset.
Body fields per kind:
| Kind | Body fields |
|---|---|
draft | actor, expected_sha256, height, rgba_b64, width |
frame | actor, expected_sha256, height, rgba_b64, width |
layer | actor, expected_layer_sha256, expected_sha256, height, rgba_b64, update_pins, width |
master | actor, expected_sha256, height, on_layers, rgba_b64, update_pins, width |
parts | actor, expected_sha256, height, parts_b64, rgba_b64, width |
pins | actor, expected_sha256, height, rgba_b64, width |
POST /api/assets/{name}/draft#
Rebuilds the asset's 1x pose draft from an archetype.
Body fields: actor, archetype, expected_sha256, palette, size.
Response keys: can_redo, can_undo, lint, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, sha256, size, undo_deletes_asset, undo_restores_asset.
POST /api/assets/{name}/parts#
Creates the indexed parts.png part map. mode is default (the rig's standard parts, the default) or propose (proposed from the draft); a matching rig.json is written when needed.
Body fields: actor, facing, mode, rig.
Response keys: can_redo, can_undo, facing, legend, mode, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, part_ids, rig, rig_written, sha256, stale, undo_deletes_asset, undo_restores_asset.
POST /api/assets/{name}/rig#
Renders the animation frames from the master with a built-in or custom rig (optionally driven by the part map), composing saved overrides in.
Body fields: actor, facing, rig, use_parts.
Response keys: animations, can_redo, can_undo, facing, frames, kept_animations, kept_custom_frames, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, override_report, parts_rig, rig, rig_frames_skipped, rig_spec_name, sha256, stale, undo_deletes_asset, undo_restores_asset.
POST /api/assets/{name}/outline#
Redraws the 1px black outer outline of the master (an existing outline is stripped first).
Body fields: actor, expected_sha256, on_layers.
Response keys: can_redo, can_undo, layers_dropped, lint, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, sha256, stale, undo_deletes_asset, undo_restores_asset.
POST /api/assets/{name}/palette-swap#
Remaps the master onto another palette (metric, dither).
Body fields: actor, dither, expected_sha256, metric, palette.
Response keys: can_redo, can_undo, entry_id, hex, layers, lint, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, palette, palette_colors, previous_sha256, sha256, stale, undo_deletes_asset, undo_restores_asset.
POST /api/assets/{name}/wrap-shift#
Shifts the master, every layer, pins.png and parts.png by dx / dy with wrap-around, in one journal entry (handy for seamless tiles).
Body fields: actor, dx, dy, expected_sha256.
Response keys: can_redo, can_undo, dx, dy, entry_id, layers, lint, master_sha256, next_redo_label, next_redo_op, next_undo_label, next_undo_op, noop, ok, pins_sha256, previous_sha256, sha256, shifted, stale, undo_deletes_asset, undo_restores_asset.
GET /api/assets/{name}/lint#
Lints the master. Read-only: a GET never applies a fix. Optional queries quality and check_interior_black.
Response keys: can_redo, can_undo, errors, file, fixed, has_draft, lint, metrics, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, pass, sha256, size, stale, state, undo_deletes_asset, undo_restores_asset, warnings.
POST /api/assets/{name}/lint#
Lints the master with options; fix: true also applies the lint auto-fixes and saves the master (journaled).
Body fields: actor, check_interior_black, expected_sha256, fix, metric, on_layers, quality.
Response keys: can_redo, can_undo, errors, file, fixed, has_draft, lint, metrics, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, pass, quality, sha256, size, stale, state, undo_deletes_asset, undo_restores_asset, warnings.
POST /api/assets/{name}/lint-fix#
Applies the lint auto-fixes to the master and reports the new lint result.
Body fields: actor, check_interior_black, expected_sha256, metric, on_layers, quality.
Response keys: can_redo, can_undo, changed, errors, file, fixed, has_draft, layers_dropped, lint, metrics, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, pass, sha256, size, stale, state, undo_deletes_asset, undo_restores_asset, warnings.
Asset management#
Rename, duplicate, delete and restore assets, resize the canvas and edit the frame list. Every change is one journaled, undoable operation.
POST /api/assets/{name}/rename#
Renames the asset to new_name, moving every file of it in one journal entry; the answer is the asset under its new name plus renamed_from. A taken name is a 409 AssetExistsError. Undo on the new name renames it back (the detail's undo_restores_asset says to which name).
Body fields: actor, new_name.
Response keys: animations, archetype, art_type, boxes_sha256, can_redo, can_undo, draft_edited, draft_sha256, entry_id, facing, frame_names, frames, frames_custom, frames_rig, has_draft, has_parts, has_pins, has_rig, layers, lint, master_sha256, name, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, overrides, palette, palette_colors, palette_path, parts_legend, parts_sha256, path, pins_count, pins_sha256, renamed_from, rig, sidecar, size, stale, undo_deletes_asset, undo_restores_asset, urls.
POST /api/assets/{name}/duplicate#
Copies the asset (201) to new_name (default <name>_copy, then <name>_copy2 ...). Its first Undo would delete the copy, so it is guarded like a creation (undo_deletes_asset, keep_asset).
Body fields: actor, new_name.
Response keys: animations, archetype, art_type, boxes_sha256, can_redo, can_undo, draft_edited, draft_sha256, duplicated_from, entry_id, facing, frame_names, frames, frames_custom, frames_rig, has_draft, has_parts, has_pins, has_rig, layers, lint, master_sha256, name, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, overrides, palette, palette_colors, palette_path, parts_legend, parts_sha256, path, pins_count, pins_sha256, rig, sidecar, size, stale, undo_deletes_asset, undo_restores_asset, urls.
DELETE /api/assets/{name}#
Deletes the asset (journaled, so undoable) and answers deleted, a restore token and the undo flags. expected_sha256 guards against a stale master.
Body fields: actor, expected_sha256.
Response keys: can_redo, can_undo, deleted, entry_id, files, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, restore, undo_deletes_asset, undo_restores_asset.
POST /api/assets/restore#
Brings a deleted asset back from its delete token. A stale token (the name was reused or the delete was already undone) is a 409.
Body fields: actor, token.
Response keys: animations, archetype, art_type, boxes_sha256, can_redo, can_undo, draft_edited, draft_sha256, facing, frame_names, frames, frames_custom, frames_rig, has_draft, has_parts, has_pins, has_rig, layers, lint, master_sha256, name, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, overrides, palette, palette_colors, palette_path, parts_legend, parts_sha256, path, pins_count, pins_sha256, restored, rig, sidecar, size, stale, undo_deletes_asset, undo_restores_asset, urls.
POST /api/assets/{name}/resize#
Resizes the canvas of the master, draft, parts, pins, layers, every frame and override and boxes.json together (one journal entry): width, height and an anchor (nw n ne w c e sw s se, default c) or an explicit offset [dx, dy]. The answer carries resize {from, to, offset, files, cropped_pixels}.
Body fields: actor, anchor, expected_sha256, height, offset, width.
Response keys: animations, archetype, art_type, boxes_sha256, can_redo, can_undo, draft_edited, draft_sha256, entry_id, facing, frame_names, frames, frames_custom, frames_rig, has_draft, has_parts, has_pins, has_rig, layers, lint, master_sha256, name, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, overrides, palette, palette_colors, palette_path, parts_legend, parts_sha256, path, pins_count, pins_sha256, resize, rig, sidecar, size, stale, undo_deletes_asset, undo_restores_asset, urls.
POST /api/assets/{name}/frames#
One frame-list operation per call (one journal entry each), chosen by op: add (animation, to, source blank or master), duplicate (frame), delete (frame, optional animation / index), move (animation, frame or index, to), duration (animation, frame or index, ticks 1..64: how many ticks of the fps the frame is held) and timing (animation, fps, loop). Frames made here are custom frames that a re-rig keeps.
Body fields: actor, animation, fps, frame, index, loop, op, source, ticks, to.
Response keys: animation, animations, archetype, art_type, boxes_sha256, can_redo, can_undo, changed, draft_edited, draft_sha256, entry_id, facing, frame, frame_names, frames, frames_custom, frames_rig, has_draft, has_parts, has_pins, has_rig, layers, lint, master_sha256, name, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, op, overrides, palette, palette_colors, palette_path, parts_legend, parts_sha256, path, pins_count, pins_sha256, rig, sidecar, size, stale, undo_deletes_asset, undo_restores_asset, urls.
Gameplay boxes#
Hurt, hit and body boxes per frame, as the Godot scene export uses them.
GET /api/assets/{name}/boxes#
The effective gameplay boxes (hand-edited overrides over the computed ones): frame_size, pivot, body, per-frame hurtbox / hitbox with auto flags, computed, the stored overrides (boxes.json), orphaned edits of frames that no longer exist, sha256 and export_applies.
Response keys: asset, body, body_auto, bounds, can_redo, can_undo, computed, export_applies, frame_names, frame_size, frames, hitbox_frames, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, orphaned, overrides, pivot, sha256, undo_deletes_asset, undo_restores_asset.
PUT /api/assets/{name}/boxes#
Patches boxes.json (journaled): body (one shape per sprite) and frames {frame: {hurtbox, hitbox}}, each a box {x, y, w, h}, null (no box) or "auto" (back to computed); replace: true swaps the whole document. expected_sha256 is the sha of boxes.json. Exports apply the result.
Body fields: actor, body, expected_sha256, frames, replace.
Response keys: asset, body, body_auto, bounds, can_redo, can_undo, changed, computed, entry_id, export_applies, frame_names, frame_size, frames, hitbox_frames, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, orphaned, overrides, pivot, sha256, undo_deletes_asset, undo_restores_asset.
History#
Undo, redo and the operation journal (shared with the CLI and agents).
GET /api/assets/{name}/history#
Journal entries for the asset, oldest first. Query limit (default 20, 1..500).
Response keys: asset, can_redo, can_undo, count, entries, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, undo_deletes_asset, undo_restores_asset.
POST /api/assets/{name}/undo#
Undoes the most recent operation on the asset, whoever made it. With keep_asset: true an undo that would delete the asset (its creation is next) is refused (400 NothingToUndoError, guarded: true).
Body fields: actor, keep_asset.
Response keys: action, actor, asset, can_redo, can_undo, drift, entry_id, exists, lint, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, op, sha256, summary, switch_to, undo_deletes_asset, undo_restores_asset, undoes.
POST /api/assets/{name}/redo#
Redoes the most recently undone operation.
Body fields: actor.
Response keys: action, actor, asset, can_redo, can_undo, drift, entry_id, exists, lint, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, op, redoes, sha256, summary, switch_to, undo_deletes_asset, undo_restores_asset.
Layers#
The asset's layer stack. Every edit is one journaled, undoable operation.
GET /api/assets/{name}/layers#
The layer stack bottom to top (layers is null for a flat asset) plus master_sha256.
Response keys: asset, can_redo, can_undo, layer_count, layered, layers, master_sha256, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, undo_deletes_asset, undo_restores_asset.
POST /api/assets/{name}/layers#
Adds a layer (blank, or from rgba_b64 pixels). A flat asset becomes a stack first. Place it with position (top, bottom, above:<id>, below:<id>) or index.
Body fields: actor, expected_sha256, height, index, layer_id, name, opacity, position, rgba_b64, visible, width.
Body cap: 96 MiB (image route).
Response keys: action, can_redo, can_undo, entry_id, index, layer_id, layers, lint, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, previous_sha256, sha256, stale, undo_deletes_asset, undo_restores_asset.
POST /api/assets/{name}/layers/reorder#
Reorders the stack; order lists every layer id, bottom to top.
Body fields: actor, expected_sha256, order.
Response keys: action, can_redo, can_undo, entry_id, layers, lint, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, previous_sha256, sha256, stale, undo_deletes_asset, undo_restores_asset.
POST /api/assets/{name}/layers/flatten#
Drops the layer stack and keeps the flattened master.
Body fields: actor, expected_sha256.
Response keys: action, can_redo, can_undo, entry_id, layers, layers_dropped, lint, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, previous_sha256, sha256, stale, undo_deletes_asset, undo_restores_asset.
PATCH /api/assets/{name}/layers/{layer_id}#
Renames a layer, shows or hides it, or changes its opacity.
Body fields: actor, expected_sha256, name, opacity, visible.
Response keys: action, can_redo, can_undo, entry_id, layer_id, layers, lint, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, previous_sha256, sha256, stale, undo_deletes_asset, undo_restores_asset.
DELETE /api/assets/{name}/layers/{layer_id}#
Deletes a layer (never the last one).
Body fields: actor, expected_sha256.
Response keys: action, can_redo, can_undo, entry_id, layer_id, layers, lint, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, previous_sha256, sha256, stale, undo_deletes_asset, undo_restores_asset.
POST /api/assets/{name}/layers/{layer_id}/duplicate#
Copies a layer to just above itself.
Body fields: actor, expected_sha256.
Response keys: action, can_redo, can_undo, entry_id, layer_id, layers, lint, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, previous_sha256, sha256, stale, undo_deletes_asset, undo_restores_asset.
POST /api/assets/{name}/layers/{layer_id}/merge-down#
Merges a layer into the layer below it.
Body fields: actor, expected_sha256.
Response keys: action, can_redo, can_undo, entry_id, layer_id, layers, lint, merged, next_redo_label, next_redo_op, next_undo_label, next_undo_op, ok, previous_sha256, sha256, stale, undo_deletes_asset, undo_restores_asset.
Export#
Export an asset and download the files.
POST /api/assets/{name}/export#
Exports the asset's rig frames (or its master when it has none) to exports/<name>/. formats names export formats plus aseprite, as a list or a comma-separated string like --formats (default: atlas, godot, gif and aseprite); an unknown one is a 400 with error.param formats. The report is the export_sprites report with project-relative files, role-keyed paths and download urls.
Body fields: bevel, emissive, emissive_exclude, emissive_min_chroma, emissive_min_lightness, extrude, formats, fps, gif_scale, gif_transparent, guid_namespace, levels, palette, pixels_per_unit, power_of_two, relief, scene_kind, strength.
Response keys: animations, aseprite, atlas, boxes_applied, file_list, files, formats, frame_count, frames, gif, godot, name, ok, open_url, out_dir, out_dir_abs, paths, pixi, skipped, sources, timing_sidecar, total_bytes, urls, warnings, zip_url.
GET /api/exports/{name}#
What is exported on disk now: exists, out_dir, out_dir_abs, file_list [{name, path, bytes, url, kind}], total_bytes, zip_url, open_url, updated_at (the export result card survives a reload).
Response keys: exists, file_list, name, ok, open_url, out_dir, out_dir_abs, total_bytes, updated_at, zip_url.
GET /api/exports/{name}/{filename}#
Downloads one exported file. .lua, .css, .html, .meta, .hex, .fnt, .gd, .anim and .controller files are served as attachments.
GET /api/exports/{name}.zip#
Every exported file of the asset as one zip attachment (<name>_export.zip, files under <name>/); 404 when nothing was exported.
POST /api/exports/{name}/open#
Shows the export folder in the desktop's file manager: {opened, path, reason}; opened is false with a plain reason when the request is not from this machine or no opener exists.
Body: an empty object.
Generation jobs#
Background ComfyUI jobs. These need a reachable ComfyUI backend.
GET /api/jobs#
Every generation job of this Studio session.
Response keys: jobs, ok.
POST /api/jobs/gen#
Starts a ComfyUI generation job for asset (202). Candidates render one at a time; progress (stage, stage_label, step / steps, elapsed_s, eta_s) arrives as WebSocket events at least once a second, and finished candidates stream in. passes 1 or 2 (default: 2 for a draft-guided job) chooses the second clean-up pass; a job's advice [{code, text, params}] says how to retry in plain words.
Body fields: art_type, asset, bg, colors, dither, metric, min_pose_match, n, outline_black, passes, preset, prompt, prompt_mode, ref_asset, seed, tile_x, tile_y, use_draft.
POST /api/jobs/inpaint#
Starts a ComfyUI inpaint job (202). The mask is mask_b64 (raw RGBA or L), mask_png_b64 or mask_rect.
Body fields: asset, height, mask_b64, mask_png_b64, mask_rect, n, outline_black, preset, prompt, respect_pins, seed, width.
Body cap: 96 MiB (image route).
POST /api/jobs/animate#
Starts an AI animation job for asset and animation (202; the asset needs a sidecar archetype and a prompt): each frame of the rig animation is repainted from its posed blockout with the master as the reference. Progress names the frame (frame, frames_total, frames_done); finished frames stream in frames; accept writes them all as custom frames.
Body fields: animation, asset, fps, n, passes, preset, prompt, seed.
GET /api/jobs/{job_id}#
One job: status, stage, progress, candidates, warnings and failure (null, or {type, msg, title, hint, code, retryable, recheck, log_path, start_command}).
GET /api/jobs/{job_id}/candidate/{index:int}#
PNG bytes of one candidate of a job.
POST /api/jobs/{job_id}/accept#
Accepts candidate index as the asset's new master (journaled; expected_sha256, respect_pins and on_layers apply).
Body fields: actor, expected_sha256, index, on_layers, respect_pins.
POST /api/jobs/{job_id}/cancel#
Cancels a running job. The body must be empty ({}).
Body: an empty object.
POST /api/jobs/{job_id}/retry#
Starts a new job with the parameters of a finished, failed or cancelled job (202; retry_of names the old one). seed: omitted keeps the old seed, null picks a fresh one; passes (gen and animate jobs) overrides the pass count.
Body fields: passes, seed.
Live updates#
A WebSocket for file, palette and job events.
WEBSOCKET /ws#
Live events. The server greets with hello and answers a {"type": "ping"} message with pong; file, palette and job changes are pushed as they happen.
Events: asset_list_changed, file_changed, hello, job_complete, job_error, job_progress, palette_changed, pong.
The hello event carries jobs, mode8_version, project_root, type.
See also#
- Studio for the workbench UI.
- Layers and History for conflict detection, undo and the journal.
- Limits for image and body caps.