Errors
An unsuccessful request returns an HTTP error status and a JSON body with two fields:
{ "error": "Not Found", "message": "Instance not found"}error names the HTTP error category. message explains the particular failure in human-readable text. Use the HTTP status to handle errors in your application; do not parse the message, whose wording may change.
Each operation’s reference lists its error responses, the circumstances that produce them and an example body.
Correct a request
Section titled “Correct a request”A 400 Bad Request means the parameters or body do not match the operation’s input schema, or the JSON is malformed. Check the message and the documented input constraints before retrying. A 413 Payload Too Large means the request body exceeds 100 KB; reduce its size.
A 401 Unauthorized means authentication is missing or invalid. Supply your API key in the Authorization: Bearer <api-key> header. A 403 Forbidden means the authenticated account does not have permission to perform the operation.
A 404 Not Found means the resource cannot be found or is not accessible to your application. For instance reads, missing, deleted and inaccessible instances deliberately have the same response.
Resolve a state conflict
Section titled “Resolve a state conflict”A 409 Conflict means the request does not fit the current world or story state. For example, a story option may have been replaced, an input request may already have been answered, or an entity may still be required by a story. Read the current game state and the relevant resource before deciding what to do next. Repeating the same write blindly can repeat an action or create another resource.
Story options and conversations have an expiresAt timestamp. Reads of expired temporary resources return 404. Starting a story with an expired or replaced option returns 409. Story input requests are durable and do not use those expiry times.
Handle server failures
Section titled “Handle server failures”A 500 Internal Server Error means the server encountered a failure. Internal diagnostics are withheld. A write may have taken effect before the failure, so inspect the relevant resource before retrying. Instance creation is not idempotent: retrying may create another instance.