# 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="/files/LFFicElNA6dWGpxBEdo1" 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 %}


---

# Agent Instructions: 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://developers.klasha.com/overview/authentication.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.
