Errors
Error response shape
Every error response shares a common JSON shape:
Every response — success or error — also includes a Request-Id header. Log it; Agora support uses it to trace requests end-to-end.
Error codes
Authentication failures (401)
A 401 unauthorized response carries a context.reason naming the specific cause, so clients can branch without parsing message:
See the Authentication guide for the full exchange and refresh flow.
Error context
Three codes attach a context object; all others omit it.
parameter_invalid returns a context.issues array describing each validation failure:
Illustrative example. The fields shown above are illustrative. The context.issues shape is stable across every endpoint that emits parameter_invalid.
unauthorized returns a context.reason — see Authentication failures above.
route_already_exists returns a context.routeId — the id of the pre-existing route. Route ids are deterministic, so you can use it directly (e.g. fetch the route via GET /v0/routes/{routeId}).
Handling errors programmatically
- Match on
code, never onmessage. Messages are human-readable and may change without notice. For401, branch oncontext.reason. - Use the HTTP status as a secondary filter. Status plus
codetogether fully disambiguate every error. - Persist the
Request-Idheader. It is the single best lever for diagnosing issues with Agora support. - Retry-with-backoff for
429,500, and503. HonorRetry-Afterwhen present. The503codes (route_creation_unavailable,service_unavailable) are transient and safe to retry.

