Server SDKs
Fetch Token
Retrieve the creative token for a registered user
The FetchToken API retrieves the creative token for a user who was previously registered.
Usage
from audiencelab_python_sdk import (
Client, UserData, FetchToken
)
client = Client(
api_key="YOUR_API_KEY",
base_url="https://analytics.geeklab.app"
)
user_data = UserData()
user_data.set_user_id("user_12345")
user_data.set_user_ip("203.0.113.42")
response = FetchToken(client, user_data).send()Response
{
"creative_token": "abc123-creative-token",
"install_date": "2026-06-09T10:00:00.000Z",
"last_login_date": "2026-06-09T10:00:00.000Z",
"retention_day": 4,
"backfill_day": 3,
"total_purchase_value": 12.5,
"total_ad_value": 1.25,
"wp": { "_network": "meta" }
}When to Use
Call FetchToken for a previously registered user before sending any in-app events for that user. It hydrates user_data with the creative token, retention state, and device context that every event requires, so this step must run first for each user whose event data you send (use Register User instead on first launch).
After a successful fetch, call user_data.set_user_creative_token_info(response). The SDK stores the token, retention/cumulative values, and merges returned wp with any caller-set whitelisted properties.
For first-time registration (which also returns a token), use Register User instead.
RegisterUser both registers and returns a token. FetchToken only retrieves the token for an existing user.