Demosyne

API reference

Base URL, auth, every customer endpoint, errors, pagination, and idempotency.

Base URL and versioning

Base URL: https://api.demosyne.com/v1. The path prefix is the API version. Additive server changes never break an installed client; anything else is a new version prefix.

Auth

Every customer request carries Authorization: Bearer trr_…. See Authentication for scopes, bindings, and revocation.

Identity

MethodPathScopeReturns
GET/v1/meanyOrg, scopes, capabilities for this key

Scenarios

MethodPathScopeReturns
GET/v1/scenariosobserveScenarios this key can see (yours and the shared catalogue)
POST/v1/scenariosdefineCreated scenario; honour Idempotency-Key
GET/v1/scenarios/{scenario_id}observeOne scenario

Worlds

MethodPathScopeReturns
GET/v1/worldsobservePage envelope {data, has_more}; query limit, after, status
POST/v1/worldsdefineCreated world snapshot; creating from a scenario name in the SDK also reads the catalogue, which takes observe
GET/v1/worlds/{world_id}observeWorld snapshot (usage present only with measure)
POST/v1/worlds/{world_id}/advancecontrolAdvance receipt (start_tick, target_tick)
POST/v1/worlds/{world_id}/pausecontrolUpdated world snapshot
GET/v1/worlds/{world_id}/summaryobserveCast summary and last narrations

Characters

MethodPathScopeReturns
GET/v1/worlds/{world_id}/charactersobserveCast list
POST/v1/worlds/{world_id}/charactersseatCreated or seated character
PATCH/v1/worlds/{world_id}/characters/{character_id}seatUpdated character (brain, memory flags, prompts)
GET…/characters/{character_id}/perceptionobserveScene (clock, narration, text)
PUT…/characters/{character_id}/actionseatStaged attempt
GET…/characters/{character_id}/historyseatHistory entries
PUT…/characters/{character_id}/historyseatReplaced history

Keys

MethodPathScopeReturns
GET/v1/keyscontrolKeys for this org (secret never included)
POST/v1/keyscontrolMinted key; secret shown once
DELETE/v1/keys/{key_id}controlRevoked key metadata

Errors

The server speaks {"detail": …}. Every response carries x-request-id (inbound header honoured, minted otherwise). Status to meaning:

Preserve that header and quote its exact value when asking for support; the SDK also attaches it to API errors. It is the public correlation value, so send it instead of an authorization header, API key, or request body. Staff correlate it against the internal logs, which bind the same value to every line the request wrote.

StatusMeaning
401Authentication failed or missing
403Scope, binding, or org refused the call
404Unknown resource
409Conflict (advance in flight, idempotency key reuse with a different body, …)
422Unprocessable entity
429Rate limited
5xxServer error

Pagination

World listing accepts limit (default 100) and after (an id), and returns { "data": [...], "has_more": bool }. Scenario and key listings stay complete lists for now.

Idempotency

POST /v1/scenarios honours Idempotency-Key: same key and same body returns the existing scenario; same key and a different body is 409.