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

# Cognigy Live Agent API

> The Cognigy Live Agent API provides access to conversations, teams, and agents. It enables you to integrate, automate, and analyze workflows beyond the Live Agent GUI.

<Warning>
  Live Agent has been put in maintenance mode. The product will continue to be maintained in the foreseeable future. Users can continue to fully rely on Live Agent being available. In future releases, only security updates and bug fixes will be provided; no new features will be released.
</Warning>

The [Cognigy Live Agent API](https://liveagent-trial.cognigy.ai/openapi) provides access to conversations, teams, and agents. It enables you to integrate, automate, and analyze workflows beyond the Live Agent GUI.

## Access the API

The API Base URL and an access token are required to access the API.

### Choose the API Base URL

The API Base URL is the endpoint for accessing the Cognigy Live Agent OpenAPI.
The table outlines the base URLs for different environments.

| Environment | API Base URL                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Trial       | `https://liveagent-trial.cognigy.ai`                                                                                                                                                                                                                                                                                                                                                                                                    |
| SaaS        | Choose the environment you use:<ul><li>**App (app.cognigy.ai)** - `https://liveagent-app.cognigy.ai`</li><li>**App-US** - `https://liveagent-app-us.cognigy.ai`</li> <li>**Other SaaS** - use the `https://api-<company-name>.liveagent.cloud/openapi` pattern where `company-name` is your company name. For example, if your company name is `abc123`, the URL would be:<br /> `https://api-abc123.liveagent.cloud/openapi`</li></ul> |
| On-premises | In your Live Agent `values.yaml` file, replace live-agent.example.com in `host: "live-agent.example.com"` with the API URL from your installation.                                                                                                                                                                                                                                                                                      |

### Get an Access Token

To use the Live Agent API, you need to get an access token. The token must be passed for each method in the HTTP-Authorization header.

1. In the bottom-left corner of the Live Agent interface, click your profile icon and select **Profile Settings**.
2. In the **Access Token** section, copy the token and save it for later use.

## Make your First API Request

Create a request to get conversation metadata. Select one of the options to make the request:

<Tabs>
  <Tab title="cURL">
    1. Open your terminal to create a `GET` request:
       ```bash theme={null}
       curl -X GET "https://{api_base_url}/api/v1/accounts/{account_id}/conversations/meta" \
       -H "api_access_token: your_access_token"
       ```
    2. Replace the following placeholders in request:
       * Replace `{api_base_url}` with the base URL of your environment. For example, for the trial environment, use `liveagent-trial.cognigy.ai`.
       * Replace `{account_id}` with your Live Agent account ID. Find the ID in the Live Agent URL. For example, in `https://liveagent-trial.cognigy.ai/accounts/12345/conversations`, the account ID is `12345`.
       * Replace `your_access_token` with the access token you saved.
  </Tab>

  <Tab title="Postman">
    1. Open Postman and create a `GET` request with the following URL: `https://{api_base_url}/api/v1/accounts/{account_id}/conversations/meta`.
    2. Replace the following placeholders in request:
       * Replace `{api_base_url}` with the base URL of your environment. For example, for the trial environment, use `liveagent-trial.cognigy.ai`.
       * Replace `{account_id}` with your Live Agent account ID. Find the ID in the Live Agent URL. For example, in `https://liveagent-trial.cognigy.ai/accounts/12345/conversations`, the account ID is `12345`.
    3. Add the authorization header:
       1. Go to the **Headers** tab.
       2. Add the `api_access_token` key and set the value to `your_access_token`.
    4. Click **Send** to execute the request.
       You should receive a `200 OK` response containing the following JSON:

    ```json theme={null}
    {
        "meta": {
            "mine_count": 0,
            "assigned_count": 20,
            "unassigned_count": 512,
            "all_count": 532
        }
    }
    ```
  </Tab>
</Tabs>

## Troubleshooting

<Accordion title="Error 401 (unauthorized)">
  If you receive a `401 Unauthorized` error, ensure that you have included the correct access token in the request header.
</Accordion>

## More Information

* [Account Settings](/live-agent/settings/account-settings)
