Skip to main content

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

HeaderValueRequired
Content-Typeapplication/x-www-form-urlencodedYes

Body Parameters

ParameterTypeRequiredDescription
grant_typestringYesMust be refresh_token
refresh_tokenstringYesYour 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
}
FieldTypeDescription
messagestringAuthorization status message
access_tokenstringThe JWT token to use in subsequent requests
expires_inintegerToken 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

  1. Request -- Call /v1/users/token with your refresh_token using form-encoded body
  2. Receive -- Store the access_token from the response
  3. Use -- Include the token in the Authorization header of all API requests
  4. Refresh -- When the token expires or you receive a 401 response, request a new token using the same refresh_token

See Also