---
agentTools:
  projectIndex: https://developers.brandwatch.com/llms.txt
---

# Authentication

This page will show you how to generate an access token

Logging into the application as an API User involves a request to the `/oauth/token` endpoint.

## 1. Getting a token

```curl
curl -X POST --data-urlencode 'password=[yourpassword]' \
  'https://api.brandwatch.com/oauth/token?username=[your@username.com]&grant_type=api-password&client_id=brandwatch-api-client'
```

If successful, you will receive a JSON response similar to the following:

```json
{
  "access_token": "aa000000-0aaa-0000-0a00-aa00a000a00a",
  "token_type": "bearer",
  "expires_in": 31535999,
  "scope": "read trust write"
}
```

The access\_token value can now be submitted with any other request to the Brandwatch API and it will grant you access to the API.

The `expires_in` field informs you how long (in seconds) the access token is valid for, the default for an API User is one year.

> 📘 Organization switching in Consumer Research
>
> If you wish to take advantage of the new organization switching feature in Consumer Research in order to access multiple clients with your single username and password and you currently use this username for API access, you will need to use an additional `platform_client_id` parameter in your token request.
>
> This ensures that you are authenticated and authorized correctly against the Consumer Research client you wish to make API requests within.
>
> For example:
>
> ```curl
> curl -X POST --data-urlencode 'password=[yourpassword]' \
>   'https://api.brandwatch.com/oauth/token?username=[your@username.com]&grant_type=api-password&client_id=brandwatch-api-client&platform_client_id=[yourPlatformClientId]'
> ```
>
> To obtain your available list of platform client IDs for Consumer Research, please reach out to our support team who will be happy to provide these for you.

> ❗️ User permissions required for API access
>
> Only "Regular" or "Admin" users will be able to access this API. Please contact your account administrator or your CSM if you aren't sure which permissions you have.

## 2. Using your token

Once you have an access token you now have access to all of the API. When making a request the token can be submitted in one of two ways:

1. In the request Headers in the format `Authorization: bearer [ACCESS TOKEN]`
2. In the URL as a parameter `&access_token=[ACCESS TOKEN]`

For the sake of brevity, we do not include the passing of the token in all of our documented calls. However, here is an example of what it would look like with cURL:

```curl
curl -X GET https://api.brandwatch.com/projects/summary \
  -H "Authorization: Bearer xxxx-xxxx-xxxx-xxxx"
```