> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.mixlayer.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.mixlayer.com/_mcp/server.

# Evaluate ordered classification questions against shared text evidence.

POST https://mixlayer.ai/v1/decisions
Content-Type: application/json

Evaluates independent Predicate, Choice and Score questions against the same text and returns answers in question order. Input may be a string or user messages containing strings or input_text parts. Parts are concatenated verbatim within a message; messages are separated by two newlines. Images, files, audio, other roles and item references are unsupported. The JSON body is limited to 8 MiB; combined input must be nonblank and at most 4 MiB. At most 4096 questions and expanded binary branches are allowed, with at most 16 KiB per expanded question. A predicate uses one branch; choices and scores use one per option or level. Unknown request fields are rejected. This endpoint uses Jini's independent-option scoring policy: choice and score probabilities normalize conditional yes probabilities in log space, and confidence is not calibrated model confidence. Refusal detection is not implemented. No output tokens are generated.

Reference: https://docs.mixlayer.com/api-reference/inference-ap-is/decisions/create-decision

## Authentication

- `Authorization` header (bearer token, required) — Mixlayer API key or console user session supplied as a Bearer token.

## Request

### Body (application/json)

This endpoint expects a DecisionsRequest.

- `input` (DecisionInput, required) — Text evidence supplied directly or as ordered user messages; images are unsupported.
- `model` (string, required) — Classification model identifier; nonblank and at most 256 UTF-8 bytes.
- `questions` (list of DecisionQuestion, required)
- `safety_identifier` (string, optional, nullable) — Accepted for compatibility and ignored; never used as the authenticated identity.

## Response

### 200

Ordered typed answers with input token usage

- `answers` (list of DecisionAnswer, required) — One answer per question; names are echoed, or null for unnamed questions.
- `model` (string, required)
- `usage` (DecisionUsage, required) — Shared-prefix input tokens plus every branch suffix; no compute_units field is returned.

## Errors

### 401 Unauthorized Error

Missing or invalid credentials

- `error` (SystemOneErrorDetails, required) — Safe machine-readable error code and public message.

### 402 Payment Required Error

Billing is required

- `error` (SystemOneErrorDetails, required) — Safe machine-readable error code and public message.

### 403 Forbidden Error

Inference permission or region access denied

- `error` (SystemOneErrorDetails, required) — Safe machine-readable error code and public message.

### 422 Unprocessable Entity Error

Invalid JSON, unsupported input, request shape, validation limits, model or routing hint

- `error` (SystemOneErrorDetails, required) — Safe machine-readable error code and public message.

### 429 Too Many Requests Error

Rate limit exceeded

- `error` (SystemOneErrorDetails, required) — Safe machine-readable error code and public message.

### 500 Internal Server Error

Authentication, routing or inference failed, or the worker returned an invalid response

- `error` (SystemOneErrorDetails, required) — Safe machine-readable error code and public message.

## Types

### DecisionInput

Text evidence supplied directly or as ordered user messages; images are unsupported.

### DecisionQuestion

Independent typed questions; optional names are echoed and do not affect scoring.

### DecisionAnswer

Typed answers; probabilities and confidence follow Jini's scoring policy.

### DecisionUsage

Shared-prefix input tokens plus every branch suffix; no compute_units field is returned.

- `input_tokens` (long, required)
- `input_tokens_details` (DecisionInputTokensDetails, required) — Cache read/write accounting currently reports zero.
- `output_tokens` (long, required) — Classification generates no output tokens.
- `output_tokens_details` (DecisionOutputTokensDetails, required) — Direct scoring generates no reasoning tokens.
- `total_tokens` (long, required) — Equal to input_tokens.

### SystemOneErrorDetails

Safe machine-readable error code and public message.

- `code` (string, required)
- `message` (string, required)
- `type` (string, optional, nullable) — May be present on gateway authentication or routing failures; Jini errors omit this field.

### DecisionQuestion0

Estimate whether a condition holds for the input.

- `instructions` (string, required)
- `type` (enum, required)
  - Allowed values: `predicate`
- `name` (string, optional, nullable)

### DecisionQuestion1

Select one of 1 to 255 distinct string or boolean values.

- `choices` (list of DecisionChoiceOption, required)
- `instructions` (string, required)
- `type` (enum, required)
  - Allowed values: `choice`
- `name` (string, optional, nullable)

### DecisionQuestion2

Score against 2 to 10 ordered levels; labels need not be unique.

- `instructions` (string, required)
- `levels` (list of DecisionScoreLevel, required)
- `type` (enum, required)
  - Allowed values: `score`
- `name` (string, optional, nullable)

### DecisionAnswer0

- `name` (string, required, nullable)
- `probability` (double, required) — Conditional probability of yes versus no.
- `type` (enum, required)
  - Allowed values: `predicate`

### DecisionAnswer1

- `choice` (DecisionChoiceValue, required) — Highest-probability option, preserving its original JSON type.
- `confidence` (double, required) — Winning probability above the uniform baseline, rescaled to [0, 1].
- `name` (string, required, nullable)
- `probabilities` (list of DecisionChoiceProbability, required) — Probabilities in request option order, summing to one.
- `type` (enum, required)
  - Allowed values: `choice`

### DecisionAnswer2

- `confidence` (double, required) — Concentration around the most probable level, relative to uniform spread.
- `name` (string, required, nullable)
- `probabilities` (list of DecisionScoreProbability, required) — Probabilities in request level order, summing to one.
- `score` (double, required) — Probability-weighted mean of zero-based level indices.
- `type` (enum, required)
  - Allowed values: `score`

### DecisionAnswer3

Wire-compatible variant; Jini's binary scorer does not produce refusals.

- `name` (string, required, nullable)
- `type` (enum, required)
  - Allowed values: `refusal`

### DecisionInputTokensDetails

Cache read/write accounting currently reports zero.

- `cache_write_tokens` (long, required)
- `cached_tokens` (long, required)

### DecisionOutputTokensDetails

Direct scoring generates no reasoning tokens.

- `reasoning_tokens` (long, required)

### DecisionChoiceOption

A choice value with an optional description of when it applies.

- `value` (DecisionChoiceValue, required) — Choice values retain their JSON type: boolean `true` and string `"true"` are distinct.
- `description` (string, optional, nullable)

### DecisionScoreLevel

A labeled score level whose numeric value is its zero-based position.

- `label` (string, required)
- `description` (string, optional, nullable)

### DecisionChoiceValue

Choice values retain their JSON type: boolean `true` and string `"true"` are distinct.

### DecisionChoiceProbability

Probability for one original typed choice value.

- `probability` (double, required)
- `value` (DecisionChoiceValue, required) — Choice values retain their JSON type: boolean `true` and string `"true"` are distinct.

### DecisionScoreProbability

Probability for a labeled rubric level at its zero-based index.

- `label` (string, required)
- `probability` (double, required)
- `value` (integer, required)

## Examples

**Request**

```json
{
  "input": "string",
  "model": "string",
  "questions": [
    {
      "instructions": "string",
      "type": "predicate"
    }
  ]
}
```

**Response**

```json
{
  "answers": [
    {
      "name": "string",
      "probability": 0.5,
      "type": "predicate"
    }
  ],
  "model": "string",
  "usage": {
    "input_tokens": 1,
    "input_tokens_details": {
      "cache_write_tokens": 1,
      "cached_tokens": 1
    },
    "output_tokens": 1,
    "output_tokens_details": {
      "reasoning_tokens": 1
    },
    "total_tokens": 1
  }
}
```

**SDK Code**

```python
import requests

url = "https://mixlayer.ai/v1/decisions"

payload = {
    "input": "string",
    "model": "string",
    "questions": [
        {
            "instructions": "string",
            "type": "predicate"
        }
    ]
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://mixlayer.ai/v1/decisions';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"input":"string","model":"string","questions":[{"instructions":"string","type":"predicate"}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://mixlayer.ai/v1/decisions"

	payload := strings.NewReader("{\n  \"input\": \"string\",\n  \"model\": \"string\",\n  \"questions\": [\n    {\n      \"instructions\": \"string\",\n      \"type\": \"predicate\"\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://mixlayer.ai/v1/decisions")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"input\": \"string\",\n  \"model\": \"string\",\n  \"questions\": [\n    {\n      \"instructions\": \"string\",\n      \"type\": \"predicate\"\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://mixlayer.ai/v1/decisions")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"input\": \"string\",\n  \"model\": \"string\",\n  \"questions\": [\n    {\n      \"instructions\": \"string\",\n      \"type\": \"predicate\"\n    }\n  ]\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://mixlayer.ai/v1/decisions', [
  'body' => '{
  "input": "string",
  "model": "string",
  "questions": [
    {
      "instructions": "string",
      "type": "predicate"
    }
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```