Skip to main content
Every error response has a JSON body with an 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 code when it is present.
  • Log error and details to 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.
Each item in details has:
  • field: the parameter or body field with the problem.
  • message: what is wrong.
  • code: the kind of rule that failed, for example invalid_type, invalid_value, invalid_format, too_small, too_big or custom.
The same field can appear more than once when it breaks several rules.

Plain messages

Some endpoints return only an error string:

Malformed JSON

Metadata errors

Update organization metadata has two more 400 bodies:
  • {"error": "Invalid request body format", "details": {"name": "ZodError", "message": "..."}} when metadata is missing or isn’t a JSON object. details.message is a JSON-encoded string that lists the problems.
  • {"error": "Schema validation failed", "details": [...]} when the object breaks your integration’s JSON Schema. Each item has instancePath, schemaPath, keyword, params and message.

401 Unauthorized

A 401 can come from three places. 1. The key check. Most endpoints return this when they don’t accept the key:
Causes: no 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:
The key couldn’t be matched to an active clinic or partner account. Update organization metadata returns this one, instead of 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

The key is valid, but the person who created it doesn’t have the role the endpoint needs. Returned by the organization endpoints, Update organization metadata, Create outbound call and Get outbound call status. List calls and Get call accept any valid key. Fix: create a new key from the right account. For a clinic key, that is the clinic owner or a Tenant Admin. For a partner key, it is the partner account owner or a Tenant Admin. See Authentication.

404 Not Found

The message names what wasn’t 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 as 500 instead of 400:
  • Create organization: a body that breaks a validation rule returns the generic message, without field details.
  • List organizations: a sort value 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 as Phone number format is invalid. Please provide a valid E.164 formatted number (e.g., +15145551234). or This number cannot be used as an outbound caller ID. Choose a PSTN phone number.
Check your requests against each endpoint’s rules before you send them, and read 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 search set 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 500 doesn’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, named API Call - followed by the number. Finished calls also appear in List calls with callType=Outbound.
  • Update and Delete organization: these are safe to repeat. A 404 on a repeated delete usually means the first attempt worked.
If a 500 keeps happening, contact AlloMia with the time of the request, the endpoint and the error text.