> ## Documentation Index
> Fetch the complete documentation index at: https://docs.truagents.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Errors and status codes

> How the TruAgents public API reports failures — HTTP status codes, the shared JSON error envelope, and where to find per-API detail.

The TruAgents public API reports failures with standard HTTP status codes and a JSON error envelope. Per-API status-code tables live on the API pages themselves — the sections below point you at the canonical detail.

## OAuth token endpoint

`POST /oauth/token` returns standard OAuth 2.0 error envelopes per [RFC 6749 §5.2](https://datatracker.ietf.org/doc/html/rfc6749#section-5.2) with the codes `invalid_request`, `invalid_client`, and `invalid_grant`.

See [Authentication → Error responses](/developers/authentication#error-responses) for the full table and remediation notes.

## Unsubscribe API

`/api/v1/unsubscribe/{email,sms,phone}` returns `400`, `401`, `403`, or `429` with the shared `RestErrorResponse` envelope (described below).

See [Unsubscribe API → Error responses](/integrations/unsubscribe-api#error-responses) for status codes, sub-codes (`bad_request`, `invalid_cursor`, `unauthorized_organization`), and per-endpoint failure modes.

## Response body shape

REST API endpoints share this JSON envelope:

```json theme={null}
{
  "error": "<code>",
  "message": "<human-readable detail>"
}
```

Program against `error` — it is stable and machine-readable. Log `message` for humans; its wording may change without notice.

`POST /oauth/token` uses the RFC 6749 §5.2 envelope instead — `error` plus `error_description`. See [Authentication → Error responses](/developers/authentication#error-responses) for the OAuth-specific shape.

## Related pages

* [Authentication](/developers/authentication)
* [Unsubscribe API](/integrations/unsubscribe-api)
* [Rate limits and retries](/developers/rate-limits-and-retries)
* [Python SDK](/sdks/python)
