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

# API errors

> Common errors you may encounter when working with the Text APIs and how to resolve them.

## Invalid access token

1. You may be using an agent token to authorize a call to the **Customer Chat API**, or vice versa.
   * [Get a token for Agent Chat and Configuration APIs](/authentication/oauth-authorization/)
   * [Get a token for Customer Chat API](/authentication/customer-tokens/)
2. Check that you copied the token correctly.
3. Check if your token contains `%3A`. If it does, replace it with `:`.
4. If the issue persists, try acquiring a new token using [the OAuth authorization guide](/authentication/oauth-authorization/).
5. You can verify your token using the **Check token** option in Text under **Settings → API access**. Note that this tool does not support customer access tokens.

## Invalid message

1. Make sure the request body is in **JSON** format.
2. Check that all commas, quotation marks, and brackets are correct.
3. Compare your request payload with the corresponding example in the API reference.

## The client is not authorized to request a token using this method

This error occurs when exchanging an expired authorization `code` for a token in the OAuth flow. Authorization codes are short-lived and can only be exchanged **once**.

## The request is missing a required parameter

1. Make sure `response_type` matches your client type: `code` for server-side apps, `token` for web apps.
2. Confirm that `client_id` matches the Client ID of your app, available in Text under **Settings → API access → OAuth clients**.
3. Check that `redirect_uri` exactly matches the URI configured in your OAuth client, including any trailing slash.

Here is a sample URL for the **web client type**:

```shell theme={null}
https://accounts.livechat.com/
  ?response_type=token
  &client_id=<APP-CLIENT-ID>
  &redirect_uri=http://my-application.com/
```

Here is a sample URL for the **server-side client type**:

```shell theme={null}
https://accounts.livechat.com/
  ?response_type=code
  &client_id=<APP-CLIENT-ID>
  &redirect_uri=https://my-application.com/
```
