Skip to main content
POST
Create a world (generate or import)

Authorizations

Authorization
string
header
required

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

Headers

Idempotency-Key
string

A retried request with the same key returns the original result without re-generating. Keyed per (app, mode, key value) — test and live keep separate idempotency caches, so reusing a key across modes is safe.

Body

application/json
premise
string

GENERATE mode: a "what if…" pitch. Required if no frame and no world is given.

frame_b64
string

GENERATE mode: base64 seed frame (data-URL or raw).

frame_url
string

GENERATE mode: URL of a seed frame.

text
string

GENERATE mode (BOOK-TO-GAME): a chapter or book excerpt turned into a playable world through the book pipeline (segment → bible → author an act, fail-closed validate). One chapter → one world. Mutually exclusive with premise/frame_b64/frame_url (sending both → 400); over 40000 chars → 400. Recommend async:true for chapters. Meters one generation; tenancy, mode and author stamping match every other create. subject_ref is NOT yet supported with text (sending both → 400) — to carry a character across chapters, author each chapter with premise/frame + subject_ref.

Maximum string length: 40000
world
object

IMPORT mode: a complete compiled SMWorld to store verbatim. When present, generation is skipped and the response is 201 with imported:true. name/description (below) override the blob's own.

name
string
description
string

IMPORT mode: overrides the imported blob's description.

pov
string
default:third_person_shoulder

GENERATE mode only.

async
boolean
default:false

GENERATE mode: queue a durable job and return 202 with a jobId instead of generating inline. Poll GET /v1/jobs/{jobId}. (Ignored by import and by test-mode keys, which return synchronously.)

subject_ref
object

GENERATE mode: a canonical-character reference (subjectRef) for cross-scene consistency — the PIXEL counterpart of the prose subject lock. When present, the opening seed is painted FROM this character and the reference is stored on the world as subjectRef {imageUrl, descriptor}, so later scenes/levels/chapters regenerate seeds that keep the same face, build, hair and clothing (see POST /v1/worlds/{id}/scenes). A image_b64 is hosted to a durable URL first. Threads through the async job path too. FAIL CLOSED: if a supplied image_b64 cannot be hosted the request returns 502 (no world is created) rather than silently dropping the reference.

Response

World created (generate, sync)

worldId
string<uuid>
slug
string | null
ok
boolean

Whether the kernel author landed clean.

cover
string
schemaVersion
string
Example:

"1.0"

mock
boolean

Present and true only for TEST-mode keys — a deterministic sandbox response, no real generation. See Testing.