---
title: "Create a decision (OpenAI decisions format)"
description: "Answers typed questions in OpenAI's decisions contract: evidence as `input` and an ordered list of `questions`, each a `predicate`, a `choice` of `choices`, or a `score` of `levels`. Answers come back in question order, echoing each `name`. Any decisions model works, including System One models. A decision is answered whole: `stream` is refused with `400`."
---

**POST** `https://gateway.respan.ai/openai/v1/decisions`

Answers typed questions in OpenAI's decisions contract: evidence as `input` and an ordered list of `questions`, each a `predicate`, a `choice` of `choices`, or a `score` of `levels`. Answers come back in question order, echoing each `name`. Any decisions model works, including System One models. A decision is answered whole: `stream` is refused with `400`.

## Servers

`https://gateway.respan.ai`: Respan gateway

## Authentication

### RespanApiKey

Use your Respan API key for Respan API authentication. Enter only the Respan API key value; clients send Authorization: Bearer &lt;RESPAN_API_KEY&gt;. For /api/responses, provider credentials such as Perplexity, OpenAI, or Azure OpenAI go in Settings -&gt; Providers or respan_params.credential_override in the request body, not in this authentication field.

HTTP scheme: `bearer`; format: `Respan API key`.


```http
Authorization: Bearer $RESPAN_API_KEY
```


## Request body

A request body is required.

### application/json


| Field | Type | Requirement | Description and constraints |
| --- | --- | --- | --- |
| `$` | `object` | Required body | Reference: `#/components/schemas/OpenAIDecisionRequest` |
| `model` | `string` | Required in parent | A decisions model. Either contract's client is served by either contract's provider. |
| `input` | `string or array<object>` | Required in parent | The evidence: a text, or user messages of `input_text` and `input_image` parts. |
| `input (oneOf 1)` | `string` | Schema variant | - |
| `input (oneOf 2)` | `array<object>` | Schema variant | - |
| `input (oneOf 2)[]` | `object` | Array item | Additional properties are allowed |
| `questions` | `array<object>` | Required in parent | Ordered questions. Answers come back in the same order.<br />Maximum items: `400` |
| `questions[]` | `object` | Array item | - |
| `questions[].type` | `string` | Required in parent | Allowed: `"predicate"`, `"choice"`, `"score"` |
| `questions[].name` | `string` | Optional | Echoed on the answer. Defaults to the question's position. |
| `questions[].instructions` | `string` | Optional | - |
| `questions[].choices` | `array<object>` | Optional | For `choice`. |
| `questions[].choices[]` | `object` | Array item | - |
| `questions[].choices[].value` | `string or boolean` | Optional | - |
| `questions[].choices[].value (oneOf 1)` | `string` | Schema variant | - |
| `questions[].choices[].value (oneOf 2)` | `boolean` | Schema variant | - |
| `questions[].choices[].description` | `string` | Optional | - |
| `questions[].levels` | `array<object>` | Optional | For `score`. |
| `questions[].levels[]` | `object` | Array item | - |
| `questions[].levels[].label` | `string` | Optional | - |
| `respan_params` | `object` | Optional | Additional properties are allowed |


<details class="api-schema-source">
<summary>OpenAPI request schema</summary>


```json
{
  "$ref": "#/components/schemas/OpenAIDecisionRequest"
}
```

</details>

##### Example


```json
{
  "model": "span-02",
  "input": "My package arrived damaged. I want a refund now.",
  "questions": [
    {
      "type": "choice",
      "name": "department",
      "instructions": "Which team should handle this ticket?",
      "choices": [
        {
          "value": "returns",
          "description": "Wrong or damaged items"
        },
        {
          "value": "billing",
          "description": "Charges and invoices"
        }
      ]
    },
    {
      "type": "predicate",
      "name": "wants_refund",
      "instructions": "Does the customer ask for a refund?"
    }
  ]
}
```


## Examples

### Route a ticket

Response captured from a live call on 2026-11-23.

#### Headers


```json
{
  "Authorization": "Bearer YOUR_RESPAN_API_KEY"
}
```


#### Request


```json
{
  "model": "span-02",
  "input": "My package arrived damaged. I want a refund now.",
  "questions": [
    {
      "type": "choice",
      "name": "department",
      "instructions": "Which team should handle this ticket?",
      "choices": [
        {
          "value": "returns",
          "description": "Wrong or damaged items"
        },
        {
          "value": "billing",
          "description": "Charges and invoices"
        }
      ]
    },
    {
      "type": "predicate",
      "name": "wants_refund",
      "instructions": "Does the customer ask for a refund?"
    }
  ]
}
```


#### Response


```json
{
  "body": {
    "model": "span-02",
    "answers": [
      {
        "type": "choice",
        "name": "department",
        "choice": "returns",
        "probabilities": [
          {
            "value": "returns",
            "probability": 0.9958053
          },
          {
            "value": "billing",
            "probability": 0.004194674
          }
        ],
        "confidence": 0.99161065
      },
      {
        "type": "predicate",
        "name": "wants_refund",
        "probability": 0.99991345
      }
    ],
    "usage": {
      "input_tokens": 228,
      "input_tokens_details": {
        "cached_tokens": 0,
        "cache_write_tokens": 0
      },
      "output_tokens": 0,
      "output_tokens_details": {
        "reasoning_tokens": 0
      },
      "total_tokens": 228
    }
  }
}
```


#### cURL


```bash
curl --request POST 'https://gateway.respan.ai/openai/v1/decisions' \
  --header "Authorization: Bearer $RESPAN_API_KEY" \
  --header 'Content-Type: application/json' \
  --data @- <<'JSON'
{
  "model": "span-02",
  "input": "My package arrived damaged. I want a refund now.",
  "questions": [
    {
      "type": "choice",
      "name": "department",
      "instructions": "Which team should handle this ticket?",
      "choices": [
        {
          "value": "returns",
          "description": "Wrong or damaged items"
        },
        {
          "value": "billing",
          "description": "Charges and invoices"
        }
      ]
    },
    {
      "type": "predicate",
      "name": "wants_refund",
      "instructions": "Does the customer ask for a refund?"
    }
  ]
}
JSON
```


<details>
<summary>Python</summary>



```python
import json
import os
import urllib.request

payload = json.loads(r'''{
  "model": "span-02",
  "input": "My package arrived damaged. I want a refund now.",
  "questions": [
    {
      "type": "choice",
      "name": "department",
      "instructions": "Which team should handle this ticket?",
      "choices": [
        {
          "value": "returns",
          "description": "Wrong or damaged items"
        },
        {
          "value": "billing",
          "description": "Charges and invoices"
        }
      ]
    },
    {
      "type": "predicate",
      "name": "wants_refund",
      "instructions": "Does the customer ask for a refund?"
    }
  ]
}''')

request = urllib.request.Request(
    "https://gateway.respan.ai/openai/v1/decisions",
    data=json.dumps(payload).encode(),
    headers={
        "Authorization": f"Bearer {os.environ['RESPAN_API_KEY']}",
        "Content-Type": "application/json",
    },
    method="POST",
)
with urllib.request.urlopen(request) as response:
    print(response.read().decode())
```


</details>

<details>
<summary>TypeScript</summary>



```typescript
const response = await fetch("https://gateway.respan.ai/openai/v1/decisions", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.RESPAN_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "model": "span-02",
    "input": "My package arrived damaged. I want a refund now.",
    "questions": [
      {
        "type": "choice",
        "name": "department",
        "instructions": "Which team should handle this ticket?",
        "choices": [
          {
            "value": "returns",
            "description": "Wrong or damaged items"
          },
          {
            "value": "billing",
            "description": "Charges and invoices"
          }
        ]
      },
      {
        "type": "predicate",
        "name": "wants_refund",
        "instructions": "Does the customer ask for a refund?"
      }
    ]
  }),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.text());
```


</details>

## Responses

### 200

Answers in question order.

#### Response headers


| Parameter | Type | Required | Description and constraints |
| --- | --- | --- | --- |
| `X-Respan-Log-Id` | `string` | Optional | ID of the Respan log for this call. |
| `X-Respan-Gateway-Request-Id` | `string` | Optional | ID of the whole gateway request, on every log row it writes. |


#### application/json


| Field | Type | Requirement | Description and constraints |
| --- | --- | --- | --- |
| `$` | `object` | Body | Reference: `#/components/schemas/OpenAIDecisionResponse` |
| `model` | `string` | Optional | - |
| `answers` | `array<object>` | Required in parent | - |
| `answers[]` | `object` | Array item | Additional properties are allowed |
| `answers[].type` | `string` | Optional | Allowed: `"predicate"`, `"choice"`, `"score"`, `"refusal"` |
| `answers[].name` | `string` | Optional | - |
| `answers[].probability` | `number` | Optional | A predicate's probability of true. |
| `answers[].choice` | `string or boolean` | Optional | - |
| `answers[].choice (oneOf 1)` | `string` | Schema variant | - |
| `answers[].choice (oneOf 2)` | `boolean` | Schema variant | - |
| `answers[].score` | `number` | Optional | - |
| `answers[].probabilities` | `array<object>` | Optional | - |
| `answers[].probabilities[]` | `object` | Array item | Additional properties are allowed |
| `answers[].confidence` | `number` | Optional | - |
| `usage` | `object` | Optional | Additional properties are allowed |


<details class="api-schema-source">
<summary>OpenAPI response schema</summary>


```json
{
  "$ref": "#/components/schemas/OpenAIDecisionResponse"
}
```

</details>

##### Example


```json
{
  "model": "span-02",
  "answers": [
    {
      "type": "choice",
      "name": "department",
      "choice": "returns",
      "confidence": 0.97,
      "probabilities": [
        {
          "value": "returns",
          "probability": 0.98
        },
        {
          "value": "billing",
          "probability": 0.02
        }
      ]
    },
    {
      "type": "predicate",
      "name": "wants_refund",
      "probability": 0.99
    }
  ],
  "usage": {
    "input_tokens": 420,
    "output_tokens": 1
  }
}
```


### 400

Invalid request, `stream: true`, or no question the model can answer.

#### application/json


| Field | Type | Requirement | Description and constraints |
| --- | --- | --- | --- |
| `$` | `object` | Body | OpenAI-style error written by the gateway.<br />Reference: `#/components/schemas/GatewayError` |
| `error` | `object` | Required in parent | - |
| `error.message` | `string` | Required in parent | - |
| `error.type` | `string` | Optional | - |
| `error.param` | `string or null` | Optional | - |
| `error.code` | `string or null` | Optional | - |


<details class="api-schema-source">
<summary>OpenAPI response schema</summary>


```json
{
  "$ref": "#/components/schemas/GatewayError"
}
```

</details>

### 403

The API key is missing, invalid or expired.

#### application/json


| Field | Type | Requirement | Description and constraints |
| --- | --- | --- | --- |
| `$` | `object` | Body | OpenAI-style error written by the gateway.<br />Reference: `#/components/schemas/GatewayError` |
| `error` | `object` | Required in parent | - |
| `error.message` | `string` | Required in parent | - |
| `error.type` | `string` | Optional | - |
| `error.param` | `string or null` | Optional | - |
| `error.code` | `string or null` | Optional | - |


<details class="api-schema-source">
<summary>OpenAPI response schema</summary>


```json
{
  "$ref": "#/components/schemas/GatewayError"
}
```

</details>

##### Example


```json
{
  "error": {
    "message": "Your API key is invalid or expired, please check your API key in the platform settings.",
    "type": "error",
    "param": null,
    "code": "error"
  }
}
```


### 429

Rate limit reached. Retry with exponential backoff.

#### application/json


| Field | Type | Requirement | Description and constraints |
| --- | --- | --- | --- |
| `$` | `object` | Body | OpenAI-style error written by the gateway.<br />Reference: `#/components/schemas/GatewayError` |
| `error` | `object` | Required in parent | - |
| `error.message` | `string` | Required in parent | - |
| `error.type` | `string` | Optional | - |
| `error.param` | `string or null` | Optional | - |
| `error.code` | `string or null` | Optional | - |


<details class="api-schema-source">
<summary>OpenAPI response schema</summary>


```json
{
  "$ref": "#/components/schemas/GatewayError"
}
```

</details>

## OpenAPI source

The operation and referenced components below retain the complete OpenAPI definitions, including constraints and examples.

<!-- openapi-operation:start -->
<details class="api-schema-source">
<summary>OpenAPI operation</summary>


```json
{
  "summary": "Create a decision (OpenAI decisions format)",
  "operationId": "createOpenAIDecision",
  "tags": [
    "Gateway"
  ],
  "description": "Answers typed questions in OpenAI's decisions contract: evidence as `input` and an ordered list of `questions`, each a `predicate`, a `choice` of `choices`, or a `score` of `levels`. Answers come back in question order, echoing each `name`. Any decisions model works, including System One models. A decision is answered whole: `stream` is refused with `400`.",
  "servers": [
    {
      "url": "https://gateway.respan.ai",
      "description": "Respan gateway"
    }
  ],
  "security": [
    {
      "RespanApiKey": []
    }
  ],
  "parameters": [],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/OpenAIDecisionRequest"
        },
        "example": {
          "model": "span-02",
          "input": "My package arrived damaged. I want a refund now.",
          "questions": [
            {
              "type": "choice",
              "name": "department",
              "instructions": "Which team should handle this ticket?",
              "choices": [
                {
                  "value": "returns",
                  "description": "Wrong or damaged items"
                },
                {
                  "value": "billing",
                  "description": "Charges and invoices"
                }
              ]
            },
            {
              "type": "predicate",
              "name": "wants_refund",
              "instructions": "Does the customer ask for a refund?"
            }
          ]
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Answers in question order.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/OpenAIDecisionResponse"
          },
          "example": {
            "model": "span-02",
            "answers": [
              {
                "type": "choice",
                "name": "department",
                "choice": "returns",
                "confidence": 0.97,
                "probabilities": [
                  {
                    "value": "returns",
                    "probability": 0.98
                  },
                  {
                    "value": "billing",
                    "probability": 0.02
                  }
                ]
              },
              {
                "type": "predicate",
                "name": "wants_refund",
                "probability": 0.99
              }
            ],
            "usage": {
              "input_tokens": 420,
              "output_tokens": 1
            }
          }
        }
      },
      "headers": {
        "X-Respan-Log-Id": {
          "description": "ID of the Respan log for this call.",
          "schema": {
            "type": "string"
          }
        },
        "X-Respan-Gateway-Request-Id": {
          "description": "ID of the whole gateway request, on every log row it writes.",
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "400": {
      "description": "Invalid request, `stream: true`, or no question the model can answer.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/GatewayError"
          }
        }
      }
    },
    "403": {
      "description": "The API key is missing, invalid or expired.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/GatewayError"
          },
          "example": {
            "error": {
              "message": "Your API key is invalid or expired, please check your API key in the platform settings.",
              "type": "error",
              "param": null,
              "code": "error"
            }
          }
        }
      }
    },
    "429": {
      "description": "Rate limit reached. Retry with exponential backoff.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/GatewayError"
          }
        }
      }
    }
  },
  "x-fern-examples": [
    {
      "name": "Route a ticket",
      "description": "Response captured from a live call on 2026-11-23.",
      "headers": {
        "Authorization": "Bearer YOUR_RESPAN_API_KEY"
      },
      "request": {
        "model": "span-02",
        "input": "My package arrived damaged. I want a refund now.",
        "questions": [
          {
            "type": "choice",
            "name": "department",
            "instructions": "Which team should handle this ticket?",
            "choices": [
              {
                "value": "returns",
                "description": "Wrong or damaged items"
              },
              {
                "value": "billing",
                "description": "Charges and invoices"
              }
            ]
          },
          {
            "type": "predicate",
            "name": "wants_refund",
            "instructions": "Does the customer ask for a refund?"
          }
        ]
      },
      "response": {
        "body": {
          "model": "span-02",
          "answers": [
            {
              "type": "choice",
              "name": "department",
              "choice": "returns",
              "probabilities": [
                {
                  "value": "returns",
                  "probability": 0.9958053
                },
                {
                  "value": "billing",
                  "probability": 0.004194674
                }
              ],
              "confidence": 0.99161065
            },
            {
              "type": "predicate",
              "name": "wants_refund",
              "probability": 0.99991345
            }
          ],
          "usage": {
            "input_tokens": 228,
            "input_tokens_details": {
              "cached_tokens": 0,
              "cache_write_tokens": 0
            },
            "output_tokens": 0,
            "output_tokens_details": {
              "reasoning_tokens": 0
            },
            "total_tokens": 228
          }
        }
      }
    }
  ]
}
```

</details>
<!-- openapi-operation:end -->

<!-- openapi-path-item:start -->
<details class="api-schema-source">
<summary>OpenAPI path metadata</summary>


```json
{}
```

</details>
<!-- openapi-path-item:end -->

<!-- openapi-components:start -->
<details class="api-schema-source">
<summary>Referenced OpenAPI components</summary>


```json
{
  "schemas": {
    "GatewayError": {
      "type": "object",
      "required": [
        "error"
      ],
      "description": "OpenAI-style error written by the gateway.",
      "properties": {
        "error": {
          "type": "object",
          "required": [
            "message"
          ],
          "properties": {
            "message": {
              "type": "string"
            },
            "type": {
              "type": "string"
            },
            "param": {
              "type": "string",
              "nullable": true
            },
            "code": {
              "type": "string",
              "nullable": true
            }
          }
        }
      }
    },
    "OpenAIDecisionRequest": {
      "type": "object",
      "required": [
        "model",
        "input",
        "questions"
      ],
      "properties": {
        "model": {
          "type": "string",
          "description": "A decisions model. Either contract's client is served by either contract's provider."
        },
        "input": {
          "description": "The evidence: a text, or user messages of `input_text` and `input_image` parts.",
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": true
              }
            }
          ]
        },
        "questions": {
          "type": "array",
          "maxItems": 400,
          "description": "Ordered questions. Answers come back in the same order.",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "predicate",
                  "choice",
                  "score"
                ]
              },
              "name": {
                "type": "string",
                "description": "Echoed on the answer. Defaults to the question's position."
              },
              "instructions": {
                "type": "string"
              },
              "choices": {
                "type": "array",
                "description": "For `choice`.",
                "items": {
                  "type": "object",
                  "properties": {
                    "value": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "boolean"
                        }
                      ]
                    },
                    "description": {
                      "type": "string"
                    }
                  }
                }
              },
              "levels": {
                "type": "array",
                "description": "For `score`.",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "respan_params": {
          "type": "object",
          "additionalProperties": true
        }
      }
    },
    "OpenAIDecisionResponse": {
      "type": "object",
      "required": [
        "answers"
      ],
      "properties": {
        "model": {
          "type": "string"
        },
        "answers": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true,
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "predicate",
                  "choice",
                  "score",
                  "refusal"
                ]
              },
              "name": {
                "type": "string"
              },
              "probability": {
                "type": "number",
                "description": "A predicate's probability of true."
              },
              "choice": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "boolean"
                  }
                ]
              },
              "score": {
                "type": "number"
              },
              "probabilities": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              "confidence": {
                "type": "number"
              }
            }
          }
        },
        "usage": {
          "type": "object",
          "additionalProperties": true
        }
      }
    }
  },
  "securitySchemes": {
    "RespanApiKey": {
      "type": "http",
      "scheme": "bearer",
      "bearerFormat": "Respan API key",
      "description": "Use your Respan API key for Respan API authentication. Enter only the Respan API key value; clients send Authorization: Bearer <RESPAN_API_KEY>. For /api/responses, provider credentials such as Perplexity, OpenAI, or Azure OpenAI go in Settings -> Providers or respan_params.credential_override in the request body, not in this authentication field.",
      "x-fern-bearer": {
        "name": "respanApiKey",
        "env": "RESPAN_API_KEY"
      }
    }
  }
}
```

</details>
<!-- openapi-components:end -->
