# ส่งคำขอ decisions แบบมีโครงสร้าง

**API:** Model API

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

คำขอแบบ state/questions ที่ไม่สตรีมมิ่ง คำตอบยังคงรูปแบบ Decisions

## Base URL

- `https://openapi.felo.ai` — โปรดักชัน

## Authentication

- `FeloBearerAuth` (http bearer) — คีย์ API ของ Felo ที่ส่งมาในรูปแบบ `Authorization: Bearer <key>`
- `FeloApiKey` (apiKey in header `X-API-Key`) — คีย์ API ของ Felo ที่ส่งมาในรูปแบบ `X-API-Key: <key>`

## Parameters

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `X-Felo-Channel` | header | no | string, default: "default" | รหัสช่องทางสาธารณะที่คั่นด้วยเครื่องหมายจุลภาคตามลำดับ หากไม่ส่งเฮดเดอร์นี้จะใช้ default โดยต้องใช้ default เดี่ยว ๆ เท่านั้น ในโหมดกระเป๋าเงิน default จะสแกนลำดับช่องทางสาธารณะที่มีผลของโมเดลจากท้ายไปต้น ข้ามช่องทางที่ยังไม่เผยแพร่หรือไม่พร้อมใช้งาน และเลือกผู้ให้บริการของช่องทางแรกที่พร้อมใช้งาน โดยจะรวม endpoint ที่พร้อมใช้งานของผู้ให้บริการรายนั้นที่มี upstream model 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 — คำตอบของ decisions

**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
}
```
