error string. Some also have details, which explains a validation problem, or code, a fixed machine-readable reason.
The shape depends on the endpoint and on which check rejected the request: the key check that runs first, the permission check, or the endpoint itself. So:
- Branch on the HTTP status, and on
codewhen it is present. - Log
erroranddetailsto help you troubleshoot, but don’t match on the message text in your code.
Status codes at a glance
400 Bad Request
Validation errors with field details
Used by List calls and Create outbound call.details has:
field: the parameter or body field with the problem.message: what is wrong.code: the kind of rule that failed, for exampleinvalid_type,invalid_value,invalid_format,too_small,too_bigorcustom.
Plain messages
Some endpoints return only anerror string:
Malformed JSON
Metadata errors
Update organization metadata has two more400 bodies:
{"error": "Invalid request body format", "details": {"name": "ZodError", "message": "..."}}whenmetadatais missing or isn’t a JSON object.details.messageis a JSON-encoded string that lists the problems.{"error": "Schema validation failed", "details": [...]}when the object breaks your integration’s JSON Schema. Each item hasinstancePath,schemaPath,keyword,paramsandmessage.
401 Unauthorized
A401 can come from three places.
1. The key check. Most endpoints return this when they don’t accept the key:
Authorization header; the header doesn’t start with Bearer (capital B, one space); the key doesn’t start with sk-; the key is unknown or was deleted; or the person who created the key no longer has an active AlloMia account.
2. The identity check. It runs on every endpoint:
Unauthorized, for a missing, unknown or deleted key.
3. Endpoint checks. These mean the key is valid but is the wrong kind for the endpoint:
403 Forbidden
404 Not Found
A
404 also means the resource exists but your key can’t see it, for example a call from another clinic, or a clinic outside your partner account. Check the ID with Finding IDs, and check that you are using the key for the right clinic or partner account.
409 Conflict
422 Unprocessable Entity
Create outbound call returns this when the clinic that owns the phone number is inactive:429 Too Many Requests
retryAfter and the Retry-After header give the number of seconds to wait. AlloMia didn’t process the request, so you can send it again after waiting. See Rate limits.
500 Internal Server Error
The body depends on the endpoint:Input errors that currently return 500
Today, a few input problems come back as500 instead of 400:
- Create organization: a body that breaks a validation rule returns the generic message, without field details.
- List organizations: a
sortvalue outside the four allowed values returns the generic message. - Create outbound call: malformed JSON returns
Internal server error. A destination number that can’t be dialled, or a clinic number that can’t place calls, returns a specific message, such asPhone number format is invalid. Please provide a valid E.164 formatted number (e.g., +15145551234).orThis number cannot be used as an outbound caller ID. Choose a PSTN phone number.
error on every 500.
Retrying after a 500
- Reads (
GET): retry with exponential backoff, for example after 1, 2, 4 and 8 seconds, then stop and log the failure. - Create organization: before you retry, call List organizations with
searchset to the clinic’s name. Clinic names don’t have to be unique, so a blind retry can create a duplicate. - Create outbound call: a
500doesn’t always mean no call was placed. Before you retry, check whether a call went out. Calls placed through the API appear in the dashboard under Tools & Actions → Outbound, namedAPI Call -followed by the number. Finished calls also appear in List calls withcallType=Outbound. - Update and Delete organization: these are safe to repeat. A
404on a repeated delete usually means the first attempt worked.
500 keeps happening, contact AlloMia with the time of the request, the endpoint and the error text.