Skip to main content
POST
/
api
/
v1
/
routing-preferences
/
corrections
Record a Routing Correction
curl --request POST \
  --url https://api.example.com/api/v1/routing-preferences/corrections \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "<string>",
  "expected_mode": "<string>",
  "source_message_id": "<string>"
}
'

Documentation Index

Fetch the complete documentation index at: https://docs.hitheo.ai/llms.txt

Use this file to discover all available pages before exploring further.

Records a single routing correction — a turn where the developer disagreed with the resolved mode and supplied the mode they expected. Theo keeps the last 30 days of corrections per caller and clusters them by expected_mode; once a cluster crosses the threshold, the playground surfaces an “I noticed a pattern” toast and the developer can ask Theo to suggest a rule derived from the cluster. Corrections are personal-or-team scoped (matching the caller’s active org context) so a personal correction never triggers a team-level suggestion banner.

Authentication

Requires a Bearer token with the billing API key scope. Idempotent — the same Idempotency-Key header replays the same response.

Body

prompt
string
required
The prompt that produced the unexpected mode. 1–4096 chars. Vendor-name scrubbed at the service layer.
expected_mode
string
required
The Theo mode the developer expected (e.g. "think", "image", "insurance_quote").
source_message_id
string
Optional message id of the turn the correction is attached to. ≤128 chars.

Request Examples

curl
curl -X POST https://www.hitheo.ai/api/v1/routing-preferences/corrections \
  -H "Authorization: Bearer $THEO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Look at this indemnity clause",
    "expected_mode": "think"
  }'

Response

{
  "id": "corr_abc123",
  "ok": true,
  "cluster_threshold": 3,
  "pattern_suggestion_available": true,
  "pattern_expected_mode": "think",
  "pattern_count": 3
}
When pattern_suggestion_available is true, call POST /api/v1/routing-preferences/suggest-rule with the matching expected_mode to receive a deterministic regex derived from the cluster.

Errors

  • 400 routing_correction_invalid — Generic shape failure.
  • 400 routing_correction_vendor_name — Prompt mentions an upstream provider name (Claude, OpenAI, etc.).
  • 400 routing_correction_invalid_modeexpected_mode isn’t a known Theo mode.