> For the complete documentation index, see [llms.txt](https://apidocs.mytravellerschoice.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.mytravellerschoice.com/authentication-api/access-token.md).

# Access token

This section will describe how you will authenticate yourself to the Travellerschoice Online identity services, and receive an access token in return, which you can use to access all the endpoints.

## Request an access token

The first step in Travellerschoice Hotel API gateway interaction is to authenticate with the identity service and obtain an access token. This token grants authority to perform operations on the gateway APIs. Although each token expires after 10 minutes, you can generate a new one at any time using your  Account API key.

## Access token API

<mark style="color:green;">`GET`</mark> `/api/v1/client/tokens/generate`

**Headers**

| Name            | Value              |
| --------------- | ------------------ |
| Content-Type    | `application/json` |
| api-key         | `<Your API Key>`   |
| Accept-Encoding | `gzip`             |

**Response**

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

```json
{
    "access_token": "20ed68855cc183dede3b36fb67e5",
    "expiryDate": "2024-10-13T22:24:09.323Z"
}
```

{% endtab %}

{% tab title="400" %}

```json
{
"errors": [
        {
            "message": "Invalid api key"
        }
    ]
}
```

{% endtab %}
{% endtabs %}
