API access
A subset of the Adshero API is publicly accessible — this primarily includes emission and sending interactions and attribution events. The remaining APIs are secured and require authentication via a token.
If the API requires authentication, it is indicated in the documentation as follows:
Authorization header.This means that each request must include the Authorization header with the value Bearer {access_token} (the {access_token} part should be replaced with the actual token obtained as described below).
Obtaining a Token
We provide a standard OIDC (OpenID Connect) endpoint at the following address:
https://api.adshero.io/v1/oauth/tokenThe recommended authentication method is the OAuth2 client_credentials grant.
API clients are created in the Adshero panel: open the account switcher in the top-left, select your whitelabel on its White-label tab, then open the API clients section in the left menu. Give the client a name and choose the scopes it may access.
After creation you receive a client_id and a client_secret. The secret is shown only once, so store it securely right away.
If you do not use a whitelabel, please contact us.
The API does not accept the credentials of regular user panel users.
Example request:
POST https://api.adshero.io/v1/oauth/token HTTP/2
Content-Type: application/x-www-form-urlencoded
grant_type = client_credentials &
client_id = {client_id} &
client_secret = {client_secret}client_id and client_secret parameters should be replaced with actual ones.
curl --location --request POST 'https://api.adshero.io/v1/oauth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id={client_id}' \
--data-urlencode 'client_secret={client_secret}'client_id and client_secret parameters should be replaced with actual ones.
The response returns a JSON object in the following format:
HTTP/2 200 OK
Content-Type: application/json
{
"access_token": "string",
"expires_in": "int",
"token_type": "string",
"scope": "string"
}The access_token field should be passed as the Authorization header:
Authorization: Bearer {access_token}expires_in indicates how many seconds until the token expires (is no longer accepted by the API).
The response contains no refresh token — once this time has passed, simply request a new token the same way.
The token carries the scopes granted to the client, e.g. wallet, slots.
Each endpoint states which scope it requires.
Legacy access (password grant)
Integrations created earlier may authenticate using the “password grant” with the username and password received from us.
New integrations should use the client_credentials grant described above.
Example request:
POST https://api.adshero.io/v1/oauth/token HTTP/2
Content-Type: application/x-www-form-urlencoded
grant_type = password &
client_id = public-api &
username = username &
password = passwordusername and password parameters should be replaced with actual ones.
curl --location --request POST 'https://api.adshero.io/v1/oauth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'client_id=public-api' \
--data-urlencode 'username={username}' \
--data-urlencode 'password={password}'username and password parameters should be replaced with actual ones.
The response returns a JSON object in the following format:
HTTP/2 200 OK
Content-Type: application/json
{
"access_token": "string",
"expires_in": "int",
"refresh_expires_in": "int",
"refresh_token": "string",
"token_type": "string",
"not-before-policy": "int",
"session_state": "string",
"scope": "string"
}The access_token field is passed in the Authorization header the same way as with the client_credentials grant.