Skip to content
Browse the docs

API reference · Decisions

Create a decision

POSThttps://api.useunbound.ai/v1/decisions

Answers typed questions about a state with probabilities instead of text: yes or no (noul), one of several options (choice), or a place on an ordered scale (score). Every question is answered on its own against the same state. Priced by tokens: the most it can cost is held before the call and only what the model counted is charged. At most 64 questions and 256 KB in one request.

Headers

  • Authorizationstringrequired

    Bearer <key>, with a key from Settings → API.

  • Idempotency-Keystring

    Any unique string up to 200 characters. A repeat of a call that is running or has run is refused with 409 instead of being charged twice.

Body

application/json

  • modelstringrequired

    The id of a decision model from GET /v1/models.

  • statestring | object | object[]required

    What the questions are about: a text, an object or a list.

  • questionsobjectrequired

    Each question under a name you choose, which the model never sees. From 1 to 64.

Response

One answer for each question, under the same name.

  • modelstringrequired

  • answersobjectrequired

    One answer for each question, under the same name and of the same type.

  • usageobjectrequired

    • input_tokensinteger

    • output_tokensinteger

Errors

  • 400The request is malformed, or a parameter is not supported by the model.
  • 401The API key is missing, revoked or expired.
  • 402Not enough credit, or the key reached its spending limit. Nothing was charged.
  • 403The key does not have the scope this endpoint needs.
  • 404The model does not exist or is not available through the API.
  • 409This Idempotency-Key was already used.
  • 413The request body is larger than 1 MB.
  • 429Too many requests for this key. Retry after the number of seconds in the Retry-After header.
  • 502The upstream provider failed. The hold was released; you were not charged.

All errors use the envelope described in the introduction. None of them result in a charge.