Tokens
The /v1/users/token endpoint allows you to obtain a JWT access token by exchanging your refresh_token for a short-lived access token. This endpoint follows the OAuth 2.0 specification (RFC 6749) and requires a form-encoded request body.
Endpoint
POST https://targeted-api.adgem.com/v1/users/token
Request
Headers
| Header | Value | Required |
|---|---|---|
Content-Type | application/x-www-form-urlencoded | Yes |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
grant_type | string | Yes | Must be refresh_token |
refresh_token | string | Yes | Your long-lived authentication token provided by the AdGem Team |
Example Request
curl -X POST https://targeted-api.adgem.com/v1/users/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=refresh_token&refresh_token=<your-refresh-token>"
Response
Success Response (201 Created)
When the credentials are valid, the API returns a JWT access token:
{
"message": "Authorized",
"access_token": "<your-jwt-token>",
"expires_in": 3600
}
| Field | Type | Description |
|---|---|---|
message | string | Authorization status message |
access_token | string | The JWT token to use in subsequent requests |
expires_in | integer | Token validity duration in seconds |
Error Responses
401 Unauthorized
Returned when the provided refresh_token is invalid or expired.
{
"message": "Authentication failed. Please check your credentials and try again."
}
403 Forbidden
Returned when the authenticated user lacks the required permissions.
{
"message": "Forbidden."
}
415 Unsupported Media Type
Returned when the Content-Type header is not application/x-www-form-urlencoded.
{
"error": "Content-Type must be application/x-www-form-urlencoded"
}
422 Unprocessable Entity
Returned when required fields are missing from the request body.
{
"message": "The refresh_token field is required.",
"errors": {
"refresh_token": ["The refresh_token field is required."]
}
}
Usage
Once you have obtained the access token, include it in the Authorization header of all requests to Prism:
curl -X POST https://targeted-api.adgem.com/v1/offers \
-H "Authorization: Bearer <your-jwt-token>" \
-H "Content-Type: application/json" \
-d '{
"query": "{ offers(player_id: \"user123\") { id name total_payout_usd } }"
}'
Token Lifecycle
- Request -- Call
/v1/users/tokenwith yourrefresh_tokenusing form-encoded body - Receive -- Store the
access_tokenfrom the response - Use -- Include the token in the
Authorizationheader of all API requests - Refresh -- When the token expires or you receive a
401response, request a new token using the samerefresh_token
See Also
- Authentication Guide - Complete overview of the authentication flow
- Offers Query - Query targeted offers using your token