Status codes
Reading the message
Most errors put the explanation indetail. A few endpoints use error instead,
so handle both:
Validation errors
A422 tells you which field and why:
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
What a failed request looks like, and what to do about it.
{ "detail": "Assistant not found" }
| What it means | What to do | |
|---|---|---|
400 | Something in the request was rejected. | Read detail. Setting up a phone connection also names the offending field. |
401 | Missing or invalid API key. | Check the Authorization header and that the key is still enabled. |
403 | Your role isn’t allowed to do this. | Needs a higher role. |
404 | Doesn’t exist, or isn’t in your organisation. | Check the id. The two cases look the same on purpose. |
409 | Something with that name already exists. | Use the existing one, or pick another name. |
422 | A field failed validation. | detail is a list naming each bad field. |
500 | Something went wrong on our side. | Retry. If it persists, get in touch. |
detail. A few endpoints use error instead,
so handle both:
import os, requests
response = requests.get(
"https://qall.io/api/assistants/999",
headers={"Authorization": f"Bearer {os.environ['QALL_API_KEY']}"},
timeout=30,
)
if not response.ok:
body = response.json()
message = body.get("detail") or body.get("error") or response.text
raise SystemExit(f"{response.status_code}: {message}")
422 tells you which field and why:
{
"detail": [
{
"loc": ["body", "name"],
"msg": "Field required",
"type": "missing"
}
]
}