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

# Tokens

## Token exchange

<mark style="color:green;">`POST`</mark> `https://api.finqware.com/v1/tokens`

Exchange a temp-token for an access-token.

#### Request Body

| Name                                             | Type   | Description                                 |
| ------------------------------------------------ | ------ | ------------------------------------------- |
| client\_id<mark style="color:red;">\*</mark>     | string | An identifier for your tenant app.          |
| client\_secret<mark style="color:red;">\*</mark> | string | A tenant app secret.                        |
| temp\_token<mark style="color:red;">\*</mark>    | string | A temporary token that has to be exchanged. |

{% tabs %}
{% tab title="200: OK A pointer to a newly created consent resource, plus its authorization key." %}

```javascript
{
    // A pointer to a newly created consent resource
    "credentials_id": "242a5690-...-b4ed02bebd7f",
    // An authorization key for this particular consent resource
    "access_token": "MDAxNmxvY...iGc_CorFem9_YCg",
    // time (UTC timestamp) when this consent is automatically expired
    "consent_exp": "2020-11-03T11:22:54Z",
    // time (UTC timestamp) when data pointed by this consent is permanently removed from the cache
    "max_data_retention": "2020-12-03T11:22:54Z"
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
// check the errors docs page for details
{
  "id": "uuid",
  "type": "invalid_request",
  "http": 400,
  "code": "invalid_client_id",
  "message": "error message"
}
```

{% 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://docs.finqware.com/api/tokens.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.
