iMarioiMario
DocumentsAPI reference

Guides

API Overview and QuickstartAuthenticationSandbox and Test KeysAPI ErrorsPaginationIdempotent RequestsRate LimitsAPI VersioningWebhooks

Endpoints

All EndpointsWorkspaceAudiencesPeopleStudiesReportsLibraryFilesAuto StudiesConnectionsMembersAPI KeysWebhook Endpoints
Guides

API Errors

The error object, what each type and status means, the request id, and the codes to handle.

The error object

A call that does not succeed answers with an HTTP status and one JSON object:

{
  "error": {
    "type": "permission_error",
    "code": "insufficient_scope",
    "message": "This key does not have the `studies:write` scope.",
    "param": null,
    "request_id": "req_3f9a1c0b7d2e4a6f8b1c3d5e",
    "required_scope": "studies:write"
  }
}
FieldMeaning
typeThe kind of failure. Each type belongs to one status family (table below)
codeWhat went wrong, in stable snake_case. Branch on this
messageAn English sentence for a person. It may be reworded; do not parse it
paramThe request field at fault, when there is one, such as audience_ids or cursor
request_idThe request's id, the same as its Request-Id header

Some errors add fields that help: required_scope and required_role on a permission error, credits or cap and spent on a credits error (a few calls name theirs differently, such as required and remaining on a chat message; the endpoint's reference says which), maximum when a limit is reached. A request that fails validation lists every field at fault, up to ten, in errors: [{"param": "options", "message": "..."}].

Types and statuses

typeStatusMeaning
invalid_request_error400, also 405 and 413The request is wrong: a missing or invalid field, a method the route does not take, a file that is too large. Fix it before you retry
authentication_error401No credential, or one that is unknown, revoked or expired
insufficient_credits_error402Not enough credits, or the daily limit or a member's monthly cap would be passed. Nothing was charged
permission_error403The key lacks the scope or role, the address is not allowed, or the call is not open to this key
not_found_error404No such object in this workspace, or no such route
conflict_error409The object's state does not allow it now, or an Idempotency-Key clash
rate_limit_error429Too many requests for this key, too many studies queued or running at once, or a daily cap reached. Wait for Retry-After
api_error500, 502, 503A failure on iMario's side, a connected provider that did not answer, or a service that is briefly unavailable

An object in another workspace answers 404, never 403, so an id from elsewhere reveals nothing.

The request id

Every response, success or failure, carries a Request-Id header such as req_3f9a1c0b7d2e4a6f8b1c3d5e, and an error repeats it in request_id. Log it. API activity in Settings > MCP & API lists recent requests with their ids, and support can find a request from its id.

Codes you will meet

CodeStatusWhat to do
missing_api_key401Send Authorization: Bearer <key>
invalid_api_key401The key is unknown, revoked or expired, or it is a personal key whose holder left the workspace. Use a working key
insufficient_scope403Use a key that holds required_scope, or add the scope to a new key
role_not_allowed403The key acts with a role below required_role. Use a key whose holder or service role is high enough
livemode_only403Test keys cannot change members, keys or connections. Use a live key
live_object_read_only403A test key cannot change or delete a live object, such as a live Library item or a live report's share link
ip_not_allowed403The key's allowlist does not include this address
account_suspended403The account the key acts for is suspended. Contact [email protected]
audience_rejected403The workspace may not use one of the audiences. Read the reason; do not swap in another audience without asking
parameter_invalid400A field is missing or invalid. See param and errors
kind_mismatch400The request sent a field that another kind of study reads. Remove it
cursor_invalid400Pass back a next_cursor exactly as the API returned it
idempotency_key_invalid400An Idempotency-Key must be 1 to 255 characters
insufficient_credits402Add credits, or make the study smaller. Nothing was charged
daily_budget_exceeded402Today's API budget would be passed. Wait for 00:00 UTC, make the call smaller, or have an owner or admin raise the daily limit
member_cap_exceeded402The member's monthly cap in a pooled workspace would be passed
resource_not_found, and codes such as study_not_found404Check the id and that it belongs to this workspace
route_not_found404Check the method and the path, including /v1
study_already_started409Only a study that is still queued or waiting_for_audience can be canceled
study_already_ended409The study has already finished, so there is nothing to cancel
idempotency_key_reused409The key was used with a different request. Use a new key for a new request
request_in_progress409The first request with this key is still running. Retry shortly
key_limit_reached409The workspace holds 50 working keys. Revoke one first
rate_limited429Wait the seconds in Retry-After, then slow down
too_many_auth_failures429Too many requests without a working key came from this address. Check the key, then retry after Retry-After
too_many_active_runs429The key's member already has the most studies queued or running at once. Wait for one to finish (Retry-After 30). Nothing was charged
screened_audience_cap429Today's limit on new screened audiences is reached. Try again tomorrow (Retry-After 3600)
provider_unavailable502The connected source (a CRM, a survey tool) did not answer. Retry later
internal_error500Retry with the same Idempotency-Key; if it keeps happening, send support the request id
temporarily_unavailable503Wait the seconds in Retry-After and retry
reply_failed, insight_failed503The person, or the AI read of a group, gave no answer. Nothing was charged for a message. Retry

Other codes are specific to one endpoint and named in its reference entry, such as no_difference for an AI read of a group that answers like everyone else. New codes may appear in v1 (see API versioning): treat an unknown code by its type.

When to retry

  • 429 and 503: retry after the seconds in Retry-After.
  • 500: retry with the same Idempotency-Key, a few times, with growing waits.
  • 409 request_in_progress: retry after a few seconds.
  • Other 4xx: do not retry the same request. Change it first.

A spending call that failed with a 4xx charged nothing. For POST requests, an Idempotency-Key makes every retry safe: see Idempotent requests.

← Sandbox and Test KeysPagination →

On this page

The error objectTypes and statusesThe request idCodes you will meetWhen to retry