Server SDKs

Fetch Token

Retrieve the creative token for a registered user

The FetchToken API retrieves attribution details for a user who was previously registered.

Usage

import {
	Client,
	UserData,
	FetchToken,
} from '@geeklab.app/audiencelab_nodejs_sdk';

const client = new Client({
	apiKey: 'YOUR_API_KEY',
	baseUrl: 'https://analytics.geeklab.app',
});

const userData = new UserData()
	.setUserId('user_12345');

const response = await new FetchToken(client, userData).send();
userData.setUserCreativeTokenInfo(response);

After a successful fetch, call userData.setUserCreativeTokenInfo(response) if you want the local UserData object to expose the returned details.

When to Use

Use FetchToken when:

  • You want to verify the current token assignment
  • You need to inspect install dates, device details, whitelisted properties, or cumulative totals
  • You are troubleshooting an integration

For first-time user registration (which also returns a token), use Register User instead.

You do not need to call FetchToken before sending events. Use Purchase, Ad, Custom, or Session directly after registration.

On this page