Audiencelab
Server-Side/Python SDK/Usage

Fetch Creative Token

Retrieve creative token before sending events

Use FetchToken to retrieve the user’s creative token information if you didn’t call RegisterUser.

This step is required before sending any in-app events if the creative token wasn’t already fetched during registration.

fetch_event = FetchToken(client, user_data)
try:
    response = fetch_event.send()
    user_data.set_user_creative_token_info(response)
    print("Creative token info set.")
except Exception as e:
    print("Error fetching creative token:", e)

After this call:

  • The user_data object is updated with the creative token info
  • You're ready to send events like retention, purchase, and ad view

If you already called RegisterUser, you don't need to call FetchToken again.

When to call this?

Call FetchToken only if

  • The user was previously registered, but you didn’t fetch the creative token yet
  • You need to refresh/update the creative token

On this page