# Generate account access token

## Get access token

<mark style="color:green;">`POST`</mark> `https://integrations.mipos.shop/api/oauth/token`

Provide an access token to be used in the calls to all endpoints (Doesn't update the token)

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-Type | string | application/json |

#### Request Body

| Name           | Type   | Description                          |
| -------------- | ------ | ------------------------------------ |
| client\_id     | string | Identifier of the application        |
| client\_secret | string | Secret key for the application       |
| grant\_type    | string | Default value: "client\_credentials" |
| email          | string | The email of the user account        |
| password       | string | The password of the user account     |

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

```javascript
{
    "message": "Access token.",
    "data": {
        "token": "generated_access_token(this is also the refresh token)",
        "token_type": "bearer",
        "expires_in": "1585815796"
    }
}
```

{% endtab %}

{% tab title="409 " %}

```javascript
{
    "message": [
        "Client id not found with this user.",
        "Client secret not found with this user.",
        "Invalid credentials."
    ],
    "data": null
}
```

{% endtab %}

{% tab title="422 " %}

```javascript
{
    "client_id": [
        "The client id field is required.",
        "The selected client id is invalid."
    ],
    "client_secret": [
        "The client secret field is required.",
        "The selected client secret is invalid."
    ],
    "grant_type": [
        "The grant type field is required.",
        "The selected grant type is invalid."
    ],
    "email": [
        "The email field is required.",
        "The selected email is invalid."
    ],
    "password": [
        "The password field is required."
    ]
}
```

{% endtab %}
{% endtabs %}
