Authentication overview

The API uses OpenID Connect for authentication and authorization. In particular, the OAuth2 client_credentials flow is used.

  • OpenID Provider Configuration URL: https://api.adomni.com/.well-known/openid-configuration
  • OAuth2 Token Endpoint: https://api.adomni.com/oauth/token

For API access, you should receive a client_id and client_secret from Adomni. Use these with the OAuth2 Token Endpoint above to retrieve an access_token, which will be used for all API requests.

The access_token should be included in the Authorization header of all API requests. For example:

Authorization: Bearer <access_token>

The access_token is valid for 1 hour. If the token expires, you will receive a 401 Unauthorized response. In this case, you should request a new token using the OAuth2 Token Endpoint.

Example

Start by fetching an access token.

curl --request POST \
--url https://api.adomni.com/oauth/token \
--header 'content-type: application/x-www-form-urlencoded' \
--data grant_type=client_credentials \
--data client_id=YOUR_CLIENT_ID \
--data client_secret=YOUR_CLIENT_SECRET

The response should look like this:

{
    "access_token": "eyJhbGciOiJS...",
    "token_type": "bearer",
    "expires_in": 3600
}

The expires_in value indicates the number of seconds until the token expires.

You can then use the access_token in subsequent requests.

curl
--url https://api.adomni.com/campaigns
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN'