---
title: "Chat"
method: POST
path: "/api/chat"
---

# Chat

`POST /api/chat`

## Request

- Base URL: `https://opwhcervi3.execute-api.ca-central-1.amazonaws.com`
- URL: `https://opwhcervi3.execute-api.ca-central-1.amazonaws.com/api/chat`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-Api-Key`

Asks dxpert Advisor. A bearer session or API key is required. Free accounts get 10 questions per calendar month (then 429 `quota_exceeded`, scope `free_quota`); dxpert Pro has no monthly question count and draws on the one pooled monthly allowance shared with every agent (at 100%, 429 `pro_allowance_exhausted` until it renews; nothing extra to buy). 502 `llm_error` when the model provider fails. No billing, email, or persistent account side effect.

## Headers

- `Authorization` string, nullable
- `X-Api-Key` string, nullable

## Request body

- ChatRequest
  - `history` ChatTurn[]
    - `role` string, required
    - `text` string, required
  - `message` string, required

## Response `200`

Successful Response

- ChatResponse
  - `quota` object, nullable
  - `reply` string, required
  - `routing` ChatRouting: Additive routing provenance returned with chat replies.
    - `class` string
    - `needs_local_evidence` boolean
    - `source` string
  - `scope` string

## Other responses

- `401`: Missing, malformed, or invalid credentials.
- `422`: Validation Error
- `429`: The applicable rate or quota limit has been reached. `quota_exceeded` names the limit in `scope` (for example `free_quota`: the free Advisor's 10 questions this month). `pro_allowance_exhausted`: the dxpert Pro monthly allowance, shared by the Advisor and every agent, is used up; service resumes when it renews (`resets_at`). There is no overage and nothing extra to buy.
- `502`: `llm_error`: the language-model provider failed. Retry later.

---

[API](https://skmtc.dev/dxpert/apis/dxpert-ai-api.md) · [All operations](https://skmtc.dev/dxpert/apis/dxpert-ai-api/llms.txt) · [OpenAPI document](https://skmtc.dev/dxpert/apis/dxpert-ai-api/revisions/460f1c8c53d1?raw)
