There are two HTTP headers that must be set to authorize any request to the Reporting API:
X-API-Key: YOUR_API_KEY
Authorization: Bearer YOUR_JWT
The API key and the JWT can both be obtained programmatically or via a self serve portal.
To access the self serve portal:
- Log in to the TripleLift Console
- From the top menu bar, locate the Reporting dropdown
- Click on Reporting API
Obtaining an API Key
The API key is unique to your TripleLift member. It does not expire, but it can be invalidated if a new key is generated.
Note that generating a new key effectively changes the key for all users and programs that query the API on behalf of your TripleLift member!
Manually
From the self serve portal section titled "Current API Key", copy your existing API key, or click Generate New Key to invalidate the existing key for everyone and obtain a new key.
Programmatically
Make a post request to the /generate-api-key
endpoint to invalidate the existing API key for everyone and obtain a new key:
curl \
-X POST https://reporting-api.triplelift.net/generate-api-key \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Authorization: Bearer YOUR_JWT' \
-H 'Content-Type: application/json' \
-d '{"id": "YOUR_MEMBER_ID", "overwriteExistingKey": true}'
Obtaining a JWT
The JWT (JSON Web Token) expires after a period of one month. You will need to occasionally obtain a new one.
Manually
From the self serve portal section titled "Current Token", copy your JWT.
Programmatically
Make a post request to the /login
endpoint:
curl \
-X POST https://api.triplelift.com/login \
-H 'Content-Type: application/json' \
-d '{"username": "YOUR_USERNAME", "password": "YOUR_PASSWORD"}'
The JWT token will be a top-level field in the response JSON, called reporting_api_token
.