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 -X POST --data-urlencode 'password=[yourpassword]' \
'https://api.brandwatch.com/oauth/token?username=[[email protected]]&grant_type=api-password&client_id=brandwatch-api-client'
If successful, you will receive a JSON response similar to the following:
{
"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.
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:
- In the request Headers in the format
Authorization: bearer [ACCESS TOKEN]
- 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 -X GET https://api.brandwatch.com/projects/summary \
-H "Authorization: Bearer xxxx-xxxx-xxxx-xxxx"
Updated over 4 years ago