Authentication & request signing
The Survey Feed API uses two credentials, both found in the Publisher Dashboard under your app's Settings tab → API settings:
- API token — identifies your app. Required on every request.
- API Secret — used to compute and verify signatures. Never sent in a request.
API token
Your API token is required on every Survey Feed API endpoint. Send it in a header:
| Header | Description |
|---|---|
X-Api-Token | Identifies your app. |
A missing or invalid token returns 401.
User identifiers
/players/impanel and /campaigns also need to know which participant the request is for:
| Header | Required | Description |
|---|---|---|
X-User-Identifier | Yes | Your unique, stable participant identifier. |
X-Device-Identifier | Optional | Hardware/device ID for multi-device distinction. |
Using the API secret
Your API secret is never transmitted. It's used to compute or verify signatures for:
- Impanel security hash — the
sechyou send to/players/impanel(below) - Redirect signing — the
sechon post-survey redirects (Redirect URLs) - Postback signing — the signature on reward postbacks (Handling rewards)
Security hash
The security hash verifies authenticity for /players/impanel.
How to generate
- Concatenate the
X-User-Identifiervalue and the current Unix timestamp with a colon. Example:123e4567-e89b-12d3-a456-426614174000:1713456789 - Compute the HMAC-SHA256 of that string, keyed with your API secret.
- Send the following as request params (not headers):
sech: the hex-encoded HMAC digestts: the same Unix timestamp used in the payload
- Hashes expire after 5 minutes.
Ruby example
require "openssl"
api_secret = "26dcc0fc7b6208fdfeffaf19f627cb4a" # example secret
user_identifier = "123e4567-e89b-12d3-a456-426614174000"
timestamp = Time.now.to_i
payload = "#{user_identifier}:#{timestamp}"
digest = OpenSSL::HMAC.hexdigest("SHA256", api_secret, payload)