Skip to main content
AI Search returns failures in the standard Telnyx plural error envelope — branch on errors[].code and read detail. The code style depends on the operation:
  • Collection management (create, retrieve, update, delete, the sources subresource, and the settings subresource) is mixed: its specific failures use string codes — for example collection_not_found, collection_slug_taken, source_already_exists, invalid_source_type, invalid_top_k (often with a meta.pointer) — while the shared malformed (10015) and auth (10009) failures use the general numeric codes.
  • Search (the documents endpoint) uses general numeric codes — 10005, 10027, 10015 — each with a meta.url link.
Authentication is shared: a missing or invalid API key returns 401 with 10009 (see the general API error codes); authenticated requests may also see 403, 429 (with Retry-After), or 503.
Branch on code and read detail — don’t assume a numeric or string shape: collection management mixes string codes (its specific cases) with the shared numeric 10015 / 10009, and search is numeric throughout.Not every failure uses the JSON envelope. A couple of framework-level rejections bypass the error handler: an unknown key in a settings request returns a raw 400 as text/plain (not {"errors":[...]}), and a wrong Content-Type returns a bare 415 with an empty body. Check the response status and Content-Type before parsing errors[].

Collection management errors

Returned by create / retrieve / update / delete, the sources subresource, and the settings subresource.

Search errors

Returned by the documents (search) endpoint — general numeric codes with a meta.url.