# User Creation (via Authentication Code)

For every user on your platform there must exist an associated user on the Sentiance platform. The process of associating users between the platform is accomplished using the `createUser` method on the Sentiance SDK.

Your mobile application requires an **authentication code** in order to execute the `createUser` SDK method. The below instructions details how you can fetch an authentication code from the Sentiance Platform.

### Generate an authentication code for a user

1. Create a `user_link` API key from the "Insights-Control-Tower > Developer > API Keys"
2. Request a authentication code from <https://api.sentiance.com/users/auth-code> (method: POST)
   1. Use the `user_link` key as the `Authorization Bearer` header
   2. Set the request body as `{"external_id": "<user-id-on-your-platform">}`
3. Retrieve the `authentication_code` for the response body
4. Return the code to your mobile application
5. Use this code in `createUser` method. See [this](https://docs.sentiance.com/sdk/appendix/user-creation#creating-a-user-on-the-device) example.

{% hint style="info" %}
Other endpoints are available for specific regions. For our US customers, please use the \[<https://api.p15.sentiance.com/users/auth-code]\\(https://api.p15.sentiance.com/users/auth-code> endpoint. For our Indian customers, please use the <https://api.r16.sentiance.com/users/auth-code> endpoint
{% endhint %}

Note: An authentication code has a very small expiration (approx 10 mins)

You can find a code reference in our [sample application](https://github.com/sentiance/sample-apps-api/blob/master/src/routes.js#L38).

{% hint style="info" %}
This operation must be performed during the **signup** and **login** workflows of your application.

Similarly execute the "reset" SDK method when a user **logs out** of your application
{% endhint %}


---

# 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.sentiance.com/important-topics/user-registration.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.
