Realtime TTS-2 is live. Built for realtime conversation that feels human. Read the Realtime TTS-2 announcement

Decisions

Create decision

Get typed answers to named questions about a state

POST/alpha/decisions

Preview. The /alpha path and the request and response formats may change before this API is marked stable. See release stages.

Send a state and a map of typed questions to the selected decision model. It returns one answer per question: a yes/no probability (noul), a pick from your options (choice), or a rating on your levels (score). Answers are never free text, so your code can branch on them directly.

Choose an API model ID from the model catalog. The Decisions guide explains how to choose a model, run examples, and use the answers in your application. The reference examples use typesafe/jev, a text-only model. Requests can be up to 32 MiB (33,554,432 bytes); a larger body returns 413.

Errors

Request validation returns 400 with error.type: "invalid_request_error" before sending the request to a model. For question validation, error.param names the field to fix. Other errors can omit param.

For example, a request to an available model with state present and "questions": {"q": {"type": "rank"}} returns:

json
{
  "error": {
    "message": "questions.q.type: unknown question type \"rank\"; expected noul, choice or score",
    "type": "invalid_request_error",
    "param": "questions.q.type"
  }
}

Model errors relayed to your application keep their HTTP status and use {"error": {"message": "...", "type": "..."}}. Input that passes request validation can still be rejected by the model, including with 422. A relayed 429 uses rate_limit_error; relayed 5xx errors use api_error, except 504, which uses timeout_error. These rate-limit and server errors have generic messages, such as the model failed to answer. When Inworld cannot reach the model, the 502 uses upstream_error. Retry transient errors with exponential backoff and honor Retry-After when present.

Check the HTTP status and content type before parsing: errors for authentication, credits and your account's rate limit use a different body. 401 and 429 are plain text, and 402 has a numeric error.code. See Errors in the Decisions guide for status codes and next steps.

Image, PDF, audio and video input

Use the List models API with output_modalities=decisions to find decision models. In the response, check models[].spec.inputModalities: image, file (PDF), audio and video each mean the model accepts that input. Sending an input type the model doesn't list returns 400 with invalid_request_error, for example typesafe/jev does not accept audio input.

Put each input directly in the state array as a typed part, alongside text:

json
{
  "state": [
    "A customer attached these files to a return request.",
    {"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,<BASE64_IMAGE>", "detail": "auto"}},
    {"type": "file", "file": {"filename": "receipt.pdf", "file_data": "data:application/pdf;base64,<BASE64_PDF>"}},
    {"type": "input_audio", "input_audio": {"data": "<BASE64_AUDIO>", "format": "mp3"}},
    {"type": "video_url", "video_url": {"url": "data:video/mp4;base64,<BASE64_VIDEO>"}}
  ]
}

This fragment illustrates state; a complete request also requires model and questions, and a model that lists every input type it carries.

Field or constraintAccepted values and behavior
image_url.urlA base64 data URL of image/png, image/jpeg or image/webp, which every image model takes, or of image/gif, image/bmp, image/tiff or image/heic, which some image models take. A model that can't take a type returns 400.
image_url.detailOptional: auto, low or high on every image model; medium and ultra_high on some. Some models ignore it, and a higher detail can count more input tokens.
file.file_dataA base64 data URL of application/pdf. file.filename is optional.
input_audio.data, input_audio.formatdata is plain base64 (no data: prefix). format is aac, aiff, flac, mp3, ogg or wav.
video_url.urlA base64 data URL of video/mp4, video/mpeg or video/webm.
LinksNot fetched: an http:// or https:// URL in any part returns 400. Send the file's bytes inline.
PlacementParts must be direct elements of the state array. A part nested deeper is treated as data, not as input. A top-level images field returns 400.
Count and sizeSome models take at most four images per request (400). The whole request, base64 included, must fit 32 MiB (413).

Images, PDFs, audio and video count as input tokens. See Send images, PDFs, audio and video for runnable Python examples and Limits for every limit.

Authorizations

Authorizationstringrequired

Your authentication credentials. For Basic authentication, please populate Basic $INWORLD_API_KEY.

A standard API key can call chat completions, the Responses and Messages APIs, moderation and Decisions. To create, update or delete routers, the key also needs write permissions for the Router API. You can create a key in one command with the Inworld CLI: inworld workspace add-key.

Body

application/json

modelstringrequired

API model ID selected from the Decisions catalog, for example typesafe/jev.

stateoneOfrequired

The content to evaluate: a string for text, or an object or array for structured data. In an array, a model can also take images (image_url), PDFs (file), audio (input_audio) and video (video_url) parts as direct elements, sent inline as base64; each type is accepted only by models whose spec.inputModalities in the List models response lists it (image, file, audio, video), and others return 400. Links are not fetched (400), a part nested deeper is treated as data, and a top-level images field returns 400. The whole request must fit 32 MiB (33,554,432 bytes). See the input contract.

questionsobjectrequired

The questions to answer, keyed by ids you choose. Each answer comes back under the same id. The ids are not sent to the model and do not affect inference.

Response

200 - application/json

modelstring

The model that answered. It can be the ID you sent or a more specific version of it, and the same request can return either, so don't compare it to a fixed value.

answersobject

One answer per question, keyed by the ids used in questions.

usageobject

Token usage. Decisions are billed on input_tokens only; output tokens are not billed. Images, PDFs, audio and video in state count as input tokens.

Show child attributes

input_tokensinteger

output_tokensinteger

metadataobject

Inworld routing metadata, with the same keys as on chat completions.

Show child attributes

attemptsobject[]

Show child attributes

modelstring

status_codeinteger

duration_msnumber

successboolean

generation_idstring

Unique identifier for this request.

total_duration_msinteger

Total request duration in milliseconds.