# 構造化された decisions を送信

**API:** Model API

**Endpoint:** `POST /api/v1/decisions`

非ストリーミングの state/questions リクエストです。回答は Decisions の形式を維持します。

## Base URL

- `https://openapi.felo.ai` — 本番環境

## Authentication

- `FeloBearerAuth` (http bearer) — Felo APIキーを `Authorization: Bearer <key>` として送信します。
- `FeloApiKey` (apiKey in header `X-API-Key`) — Felo APIキーを `X-API-Key: <key>` として送信します。

## Parameters

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `X-Felo-Channel` | header | no | string, default: "default" | カンマ区切りの公開チャンネルコード（順序どおり）。このヘッダーを省略すると default が使われ、default は単独でのみ使用できます。ウォレットモードでは、default はモデルの有効な公開チャンネル順を逆から走査し、未公開または利用不可のチャンネルをスキップして、最初に利用可能なチャンネルのプロバイダーを選択します。そのプロバイダーから、同じ上流モデル ID とサービスティアを持つ利用可能なエンドポイントを含めます。明示的なチャンネルはクライアントが指定した順序で検証され、最初のチャンネルのプロバイダーグループのみが送信されます。他のプロバイダーへの自動フォールバックはありません。従来のプロバイダーヘッダーでチャンネルルーティングを上書きすることはできません。 |

## Request body

Required: **yes**

### application/json

Schema: `DecisionsRequest` (`#/components/schemas/DecisionsRequest`)

```json
{
  "type": "object",
  "required": [
    "model",
    "state",
    "questions"
  ],
  "properties": {
    "model": {
      "type": "string"
    },
    "state": {},
    "questions": {
      "type": "object",
      "additionalProperties": {
        "type": "object"
      }
    },
    "stream": {
      "type": "boolean",
      "const": false
    },
    "service_tier": {
      "type": [
        "string",
        "null"
      ],
      "default": "default",
      "description": "現在は default（standard）のみをサポートしています。省略、null、エイリアス、未対応の文字列は default にフォールバックし、それ以外のタイプは HTTP 400 を返します。設定済みのチャンネルと料金は変わりません。テキスト API はプロバイダーの標準値を使用し、Decisions と生成 API は上流のフィールドを省略します。"
    }
  },
  "additionalProperties": true,
  "description": "非ストリーミングの Decisions。質問の定義はそのまま渡されます。"
}
```

Example:

```json
{
  "model": "configured-decisions-model",
  "state": "A payout failed.",
  "questions": {
    "urgent": {
      "type": "noul",
      "instructions": "Is it urgent?",
      "criteria": {
        "true": "Urgent",
        "false": "No"
      }
    }
  }
}
```

## Responses

### 200 — decision の回答

**application/json**

Schema: `DecisionsResponse` (`#/components/schemas/DecisionsResponse`)

### 400 — リクエストが拒否されたか、上流が利用できません

**application/json**

Schema: `DecisionsErrorResponse` (`#/components/schemas/DecisionsErrorResponse`)

### 401 — リクエストが拒否されたか、上流が利用できません

**application/json**

Schema: `DecisionsErrorResponse` (`#/components/schemas/DecisionsErrorResponse`)

### 402 — リクエストが拒否されたか、上流が利用できません

**application/json**

Schema: `DecisionsErrorResponse` (`#/components/schemas/DecisionsErrorResponse`)

### 403 — リクエストが拒否されたか、上流が利用できません

**application/json**

Schema: `DecisionsErrorResponse` (`#/components/schemas/DecisionsErrorResponse`)

### 429 — リクエストが拒否されたか、上流が利用できません

**application/json**

Schema: `DecisionsErrorResponse` (`#/components/schemas/DecisionsErrorResponse`)

### 502 — リクエストが拒否されたか、上流が利用できません

**application/json**

Schema: `DecisionsErrorResponse` (`#/components/schemas/DecisionsErrorResponse`)

### 503 — リクエストが拒否されたか、上流が利用できません

**application/json**

Schema: `DecisionsErrorResponse` (`#/components/schemas/DecisionsErrorResponse`)

## Schema definitions

### DecisionsErrorResponse

`#/components/schemas/DecisionsErrorResponse`

```json
{
  "type": "object",
  "required": [
    "error"
  ],
  "properties": {
    "error": {
      "type": "object",
      "required": [
        "code",
        "message"
      ],
      "properties": {
        "code": {
          "type": "integer"
        },
        "message": {
          "type": "string"
        }
      }
    }
  }
}
```

### DecisionsResponse

`#/components/schemas/DecisionsResponse`

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "answers": {
      "type": "object",
      "additionalProperties": true
    },
    "usage": {
      "type": "object",
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
```
