> For the complete documentation index, see [llms.txt](https://docs.maibmerchants.md/request-to-pay/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maibmerchants.md/request-to-pay/getting-started/api-fundamentals/obtain-authentication-token.md).

# Obtain Authentication Token

**POST** `/v2/auth/token`

This endpoint allows obtaining an Access Token required to authorize all subsequent requests to the API.

***

#### Request parameters (body)

| Parameter      | Type          | Required | Description                                   |
| -------------- | ------------- | -------- | --------------------------------------------- |
| `clientId`     | string (guid) | Yes      | Client code provided by **maib**              |
| `clientSecret` | string (guid) | Yes      | The client’s secret key, provided by **maib** |

**Example request (body)**

```json
{
  "clientId": "749c564f-1a65-48e3-a4bf-b7932b6ae3db",
  "clientSecret": "0d922db8-9a2f-4c66-a60d-76a762c9bb04"
}
```

***

####

#### Response parameters

| Field                | Type    | Description                                             |
| -------------------- | ------- | ------------------------------------------------------- |
| `result.accessToken` | string  | The access token to be used in the Authorization header |
| `result.expiresIn`   | integer | The token's lifespan, in seconds                        |
| `result.tokenType`   | string  | The token type (Bearer)                                 |
| `ok`                 | boolean | `true` if the request was successfully processed        |
| `errors`             | array   | List of errors, if `ok = false`                         |

**Example response**

```json
{
  "result": {
    "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "expiresIn": 300,
    "tokenType": "Bearer"
  },
  "ok": true
}
```

***

{% hint style="info" %}
After obtaining the token, it must be included in the header of every request to the API.
{% endhint %}
