> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get authenticated user token

> Get the authenticated user token from the Insights API Client state.

**Required ACL:** `search`

Use this method to retrieve the `authenticatedUserToken` provided by you.
For more information, see [User token](/doc/guides/sending-events/concepts/usertoken).

## Examples

For more information about initializing the Insights client `aa`,
see [Initialize the Insights client](/doc/libraries/search-insights/init).

```js JavaScript icon=code theme={"system"}
// Set the authenticated user token
aa("setAuthenticatedUserToken", "YourUserID");

// Get the authenticated user token
aa("getAuthenticatedUserToken", {}, (err, authenticatedUserToken) => {
  if (err) {
    console.error(err);
    return;
  }

  console.log(authenticatedUserToken); // 'YourUserID'
});
```

## Parameters

<ParamField body="callback" type="(err: Error, authenticatedUserToken: string) => void">
  The function called with a possible error and the authenticated user token.
</ParamField>

<ParamField body="options" type="object">
  The options for retrieving the user token.

  Pass an empty object, since this argument isn't used.
  The options to retrieve the authenticated user token.
</ParamField>
