# JS SDK

{% embed url="<https://www.npmjs.com/package/@thxnetwork/sdk>" %}
Download @thxnetwork/sdk on NPM
{% endembed %}

The SDK allows for an easy implementation of THX API in both browsers and JavaScript backends. Make sure to obtain your API credentials in your campaign dashboard.

<figure><img src="/files/qVbmBodUpkhUFvQSKMvg" alt=""><figcaption><p>Example of API keys under Account -> Developer -> API</p></figcaption></figure>

### THXAPIClient

```javascript
const { THXAPIClient } = require('@thxnetwork/sdk');

const thx = new THXAPIClient({
    apiKey: '',
});
```

#### Create Identity

Identities are unique codes that you can use to allocate event data to. After connecting the Identity to a THX account your users will be able to complete custom quests for this event data.

```javascript
const identity = await thx.identity.create()
// a6021617-9aab-4194-b2af-a4dd0cc96f84
```

{% content-ref url="/pages/iB5RZgY2ptgY6L6x4zzZ" %}
[Identity](/developers/js-sdk/identity.md)
{% endcontent-ref %}

{% content-ref url="/pages/L8cdBcKnoinBtHSZ1Puh" %}
[Events](/developers/js-sdk/events.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.thx.network/developers/js-sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
