> For the complete documentation index, see [llms.txt](https://integuru.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://integuru.gitbook.io/docs/detailed-references/initialize-jwt-token.md).

# 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](/docs/detailed-references/modes-base-urls.md) you are using. Just [Invoke the Taiki App](/docs/detailed-references/invoke-the-taiki-app.md) 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="/pages/X3P6QOa9GmBHFUQlpyUp">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 %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://integuru.gitbook.io/docs/detailed-references/initialize-jwt-token.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.
