# Exchange for Access Token

Once you have obtained the authorization code, you need to convert it to a long-lived (30 days) access token.&#x20;

## Exchange Authorization Code for Access Token

<mark style="color:green;">`POST`</mark> `https://www.talque.com/oauth2/access-token`

Convert the short-lived authentication code into a long-lived access token. Note that the payload must be `application/x-www-urlencoded` encoded per the OAuth2 specs.

#### Request Body

| Name           | Type   | Description                                        |
| -------------- | ------ | -------------------------------------------------- |
| grant\_type    | string | This field should always be: "authorization\_code" |
| code           | string | The authorization code received in the first step  |
| client\_id     | string | Your API client ID                                 |
| client\_secret | string | Your API client secret                             |

{% tabs %}
{% tab title="200 A successful Access Token request will return a JSON object containing the access token and expiration time, for example:" %}

```javascript
{
    "access_token": "R7pLF7F4oqlWUNrDE9KZWU63eyrg9kSCi10rS0il00bw5ITPAeAJ3FLlDynlFQv0sNzjQjZh",
    "expires": 1542055758351,
}
```

{% endtab %}
{% endtabs %}


---

# 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://talque.gitbook.io/public/sso/oauth2-flow/access-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.
