# Authentication

## Api Key (Public key)

After your account has been approved, you can find your public key on the dashboard (screenshot below). Ensure to include this in all request headers as value for  `x-auth-token`  where it's required.

> Dashboard → Settings → Generate API Keys  → Merchant public key&#x20;

<img src="https://257545343-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNw4nU37LIEg41plxXG5u%2Fuploads%2FvBXI8QATrncq17zlRm1P%2Fdashboad-klasha-settings.png?alt=media&#x26;token=1ebaf2b3-7e99-4490-9ede-a660c8d0035c" alt="" data-size="original">

## Bearer Token

The token generated here should be used as a value of the `Authorization` header (Bearer token) for api requests where it is required.

> <mark style="color:yellow;">**POST**</mark> <mark style="color:$primary;">-</mark> <mark style="color:$primary;"></mark><mark style="color:$primary;">`{{env_url}}/auth/account/v2/login`</mark>

#### Request body

| Name                                       | Type   | Description        |
| ------------------------------------------ | ------ | ------------------ |
| username<mark style="color:red;">\*</mark> | String | Your account email |
| password<mark style="color:red;">\*</mark> | String | account password   |

#### Response

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

```json
{
    "message": "success",
    "error": null,
    "data": {
        "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.KMUFsIDTnFmyG3nMiGM6H9FNFUROf3wh7SmqJp-QV30"
    }
}
```

{% endtab %}

{% tab title="400" %}

```json
{
    "message": "Invalid email or password.",
    "error": "wrong login details",
    "data": null
}
```

{% endtab %}
{% endtabs %}
