Beta. These endpoints are switched on per organization. While they are off for yours, each one answers
404 not_found. Ask Finn support to turn them on.
Overview
A chat agent answers your customers on the website widget, WhatsApp and other chat channels. These endpoints read and change its settings (Setup > Agents in Finn) and let you try it before customers see a change.
The agent's instructions and first message belong to its Finn agent: change them with PATCH /finns/{finn_id}/draft (finn:write). For conversations, messages and chat contacts, see the Chat operations.
Base URL: https://api.hirefinn.ai/api/v1. See authentication and scopes.
Credential
Org API keys and member tokens (a personal MCP key or an AI app's OAuth access token) both work. The Chat API must be on for your organization (403 chat_api_not_enabled otherwise).
Endpoints
| Method | Path | Scope | What it does |
|---|---|---|---|
GET | /chat/agents/{agent_id} | chat:read | Get a chat agent's settings. |
PATCH | /chat/agents/{agent_id} | chat:write | Change a chat agent's settings. |
POST | /chat/agents/{agent_id}/test_turn | chat:write | Test a chat agent. |
GET /chat/agents/{agent_id} answers three things: overrides (the agent's own settings), effective (what the agent uses: the workspace's Setup with the overrides on top, with timezone resolved) and the settings version.
Changing settings
PATCH /chat/agents/{agent_id} takes any of hours, handoff, quick_replies, resolution and booking. A setting you send replaces the agent's own. null drops it, so the agent follows the workspace's setting (for booking, no booking). The change is live: the agent uses it on its next reply.
- Org key: the change runs at once, unless your organization holds org keys for
chat.agent_update. - Member token: the person must be an org Owner or Admin (
403 forbiddenotherwise). The change is held until that person approves it in Finn: the answer is202with"status": "pending_approval"and nothing has changed yet. See requests held for approval.
Send an Idempotency-Key, so a retry returns the same approval instead of asking again. If the settings changed at the same moment, the answer is 409 setup_stale: read the agent again and retry.
Testing a reply
POST /chat/agents/{agent_id}/test_turn asks the agent for its next reply, as it would answer a customer. Nothing is sent to anyone, a booking is only simulated, the agent's own HTTP tools aren't called, and nothing is billed. It isn't held for approval.
| Field | Type | Required | Notes |
|---|---|---|---|
latest | string | Yes | The customer's next message. Up to 4,000 characters. |
history | array | No | The conversation so far: up to 50 { "role": "user" or "assistant", "content": "..." } messages. |
channel | string | No | Default widget. |
session | string | No | Keeps several test turns together. |
Example: try a question
curl -X POST https://api.hirefinn.ai/api/v1/chat/agents/2e3f4a5b-6c7d-4e8f-9a0b-1c2d3e4f5a6b/test_turn \
-H "Authorization: Bearer $FINN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"history": [
{ "role": "assistant", "content": "Hi, I am Finn from Acme Clinic. How can I help?" }
],
"latest": "Are you open on Sunday?"
}'
{
"text": "We're closed on Sundays. We're open Monday to Saturday, 9am to 7pm. Would you like me to book a time for you?",
"options": ["Book a time", "Talk to a person"],
"handoff": false,
"end": false,
"booking": null,
"tools": [],
"turn_id": "tt_5f0c2a9e",
"latency_ms": 1840,
"simulated": true
}
Rate limits
300 requests per minute per credential across the Chat API, and 60 writes per minute shared by every Chat write. At most 30 test turns per organization a minute. Over a limit: 429 rate_limited. See rate limits.
Errors
| Status | Code | When |
|---|---|---|
| 400 | invalid_request | The body isn't valid. fields lists which. |
| 401 | api_key_required, invalid_api_key | The credential is missing, unknown or revoked. |
| 403 | chat_api_not_enabled | The Chat API isn't switched on for your organization. |
| 403 | insufficient_scope | The credential lacks chat:read or chat:write. |
| 403 | forbidden | A member token whose person isn't an org Owner or Admin. |
| 403 | approval_unavailable | A held change while approval holds are off for your organization. |
| 404 | agent_not_found | No such chat agent in your organization. |
| 404 | not_found | Chat agent settings aren't switched on for your organization. |
| 409 | setup_stale | The settings changed at the same time. Read the agent again and retry. |
| 422 | content_filtered, validation_failed | The agent refused the test turn. |
| 423 | ai_apps_paused | An admin paused all AI apps. Writes are refused; reads still work. |
| 429 | rate_limited | Over a limit. Wait Retry-After seconds. |
| 503 | unavailable | Chat is briefly unavailable. Safe to retry. |