# Initialize JWT Token

## Initialize a new Authentication Token

<mark style="color:green;">`POST`</mark> `/api/token`

This endpoint creates a temporary JWT token to authenticate the Taiki client CDK. It expires in 1 hour for security reasons.&#x20;

Your application should store the `taiki_user_id` for each unique client on your end. In future years, when you Initialize the JWT token, provide the `taiki_user_id`  and Taiki will retrieve the prior year used platforms and documents connected to the `taiki_user_id`.

## Modes

The JWT token will incorporate which of the two [modes-base-urls](https://taiki.gitbook.io/docs/detailed-references/modes-base-urls "mention") you are using. Just [invoke-the-taiki-app](https://taiki.gitbook.io/docs/detailed-references/invoke-the-taiki-app "mention") with the JWT token and the app will automatically use that mode.

**Headers**

<table><thead><tr><th>Name</th><th>Value</th><th>Description</th></tr></thead><tbody><tr><td><pre><code>Content-Type
</code></pre></td><td><pre><code>application/json
</code></pre></td><td>The content type returned.</td></tr></tbody></table>

**Body**

<table><thead><tr><th width="242">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>api_key</code></td><td>string</td><td>The valid UUID provided upon ClientApp creation. <a href="../quickstart">get the api_key</a></td></tr><tr><td><code>api_secret</code></td><td>string</td><td>Secret key of your application. (This field can be regenerated via the dashboard).</td></tr><tr><td><code>taiki_user_id</code></td><td>string</td><td>Optional Taiki user ID. A new user will be created if this field is not present.</td></tr></tbody></table>

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNzI4MjkzNDY0LCJpYXQiOjE3MjQ2OTM0NjQsImp0aSI6ImI3OTgzMjQwNTE4YzRjNTI4Y2UyZGI0ZWNjMjgwMWU0IiwiY2xpZW50X2FwcF9pZCI6IjA2NmNjYjhiLWEyZGYtNzg1MS04MDAwLWRjNDEzYWNlODcyZSIsInRhaWtpX3VzZXJfaWQiOiIwNjZjY2JiZC04ODI0LTc3ZTMtODAwMC0wZGI5YThlMDUwNjcifQ.S2-kuFx-P4JTpyuOszDz_gXRLCHj0EKpUvUft9n3me0",
    "taiki_user_id": "066ccbbd-8824-77e3-8000-0db9a8e05067"
}
```

<table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><pre><code><strong>access_token
</strong></code></pre></td><td>string</td><td>Temporary access token</td></tr><tr><td><pre><code><strong>taiki_user_id
</strong></code></pre></td><td>string</td><td>Taiki's internal user ID to associate the user to their credentials</td></tr></tbody></table>

{% endtab %}

{% tab title="400" %}

```json
{
    "error": "invalid_request",
    "error_description": "No API key or API secret provided"
}
```

{% endtab %}

{% tab title="401" %}

```json
{
    "error": "invalid_client",
    "error_description": "Incorrect API key, API secret, or Taiki user ID provided"
}
```

{% endtab %}
{% endtabs %}
