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

# Authentication

SwitchWallet uses our authentication credentials to Identify who's making API calls

{% hint style="info" %}
**NB**: For every API call, You be required to pass in either API Key Or Bearer Token to the request Header
{% endhint %}

**SwitchWallet** has two(2) methods of Authentication

1. API Key
2. Bearer's Token

## **API Key**

This is gotten from the settings page of your dashboard, Click [`Here`](broken://pages/j2B56D0c7blzkKJX5Pog)

## **Bearer Token**

{% hint style="info" %}
[BaseUrl](/getting-started/environment.md#environments-and-their-respective-url-s): You will have to change the value of the [baseUrl](/getting-started/environment.md#environments-and-their-respective-url-s) below base on  the [Environment ](/getting-started/environment.md)you want to interact with
{% endhint %}

## Login

<mark style="color:green;">`POST`</mark> `BaseUrl/api/v2/auth/login`

#### Request Body

| Name                                       | Type   | Description                      |
| ------------------------------------------ | ------ | -------------------------------- |
| email<mark style="color:red;">\*</mark>    | String | <merchant-email-addess@mail.com> |
| password<mark style="color:red;">\*</mark> | String | Merchant-Pa$$word1               |

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

```javascript
{
    "data": {
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InhlbmRmaW5hbmNlQGdtYWlsLmNvbSIsInN1YiI6ImI0M2UwNjcyLWI4MjItNDUwOS05ZmFlLTk0YTRlYThlMDU3ZiIsImp0aSI6IjM2M2I2N2YyLTgyODUtNDc4Ni04NDFkLTdmYzU0MmE3ZWZlOCIsImlhdCI6IjE2NzA1NjYwMzI1MTIuNDY1NiIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWVpZGVudGlmaWVyIjoiYjQzZTA2NzItYjgyMi00NTA5LTlmYWUtOTRhNGVhOGUwNTdmIiwiZXhwIjoxNjczMTU4MDMyLCJpc3MiOiJTd2l0Y2hXYWxsZXQiLCJhdWQiOiJTd2l0Y2hXYWxsZXRNZXJjaGFudHMifQ.J6pzMHsXew2qEuQXHK3vK52DX7aFxd434QulO4MG-3w",
    "refreshToken": "hbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9=-eyJlbWFpbCI",
    "expiresAtTimestamp": 1673158032512,
    "email": "Merchant-email-address@mail.com",
    "businessName": "Merchant"
  },
  "isSuccessful": true,
  "message": "",
  "httpStatusCode": 200 Response
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
  "data": null,
  "isSuccessful": false,
  "message": "Invalid Login Credentials",
  "httpStatusCode": 400
}
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
**NB:** Bearer Token expires every 2 hours
{% endhint %}
