Decisions
Create decision
Get typed answers to named questions about a state
/alpha/decisionsPreview. 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:
{
"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:
{
"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 constraint | Accepted values and behavior |
|---|---|
image_url.url | A 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.detail | Optional: 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_data | A base64 data URL of application/pdf. file.filename is optional. |
input_audio.data, input_audio.format | data is plain base64 (no data: prefix). format is aac, aiff, flac, mp3, ogg or wav. |
video_url.url | A base64 data URL of video/mp4, video/mpeg or video/webm. |
| Links | Not fetched: an http:// or https:// URL in any part returns 400. Send the file's bytes inline. |
| Placement | Parts 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 size | Some 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.
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.
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.
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.
Inworld routing metadata, with the same keys as on chat completions.