Decision Generation
Use the decision generation API to run one of FormantAI’s managed prompts over your own input and get a JSON object back in a fixed shape, such as a verdict and the reason for it.
Prompt types are set up by FormantAI for your workspace. Ask your FormantAI contact which prompt types are enabled for you and which input variables each one reads.
Base URLs and authentication
Use the global production API unless your workspace is provisioned in the India region.
Every request needs an API key as a bearer token. Keys are created in the dashboard under Developer -> API Keys and are shown once.
A missing header, a scheme other than Bearer, an empty token, an unknown key, and a disabled key all return the same 401 authentication_error.
Every answered request is billed to your workspace. Keep keys server-side and rotate one that has been exposed.
Generate a decision
Content type: application/json.
prompt_variables is not enforced. A request with a missing variable still runs and is billed, and the model answers without that input. Always send every variable the prompt type reads.
The answer is always wrapped in data. Its fields come from response_schema, or from the prompt type’s default shape when you omit it.
Custom response shape
Send response_schema to get the answer in another shape. The model fills whatever fields the schema asks for, so field names and descriptions steer the answer.
The decision can change with the schema. Asking for more fields can make the model apply the prompt’s rules more strictly, so test your schema on real samples before relying on it.
Billing
Each request places a small credit hold on your workspace before the prompt runs. If the balance cannot cover the hold, the request is refused with 402 insufficient_credits and nothing runs.
When the answer is ready, the hold is settled against the tokens the request actually used. Unused credit is returned, and any shortfall is debited. A request that fails with 502 settles at zero, so the whole hold comes back.
Decision generation charges appear in your workspace’s billing transactions, separate from call charges, and are not counted in per-call cost metrics.
Errors
Every error except 422 uses the standard envelope:
Retry 429 after Retry-After, and 502 with bounded exponential backoff. Do not retry 400, 401, 402, 413, 422 or 503 until the cause is fixed.
