# 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 %}
