# Authentication

{% hint style="info" %}
Before authenticating , ensure you White list your IP before hand using the [Whitelist IP Guide](/yogupay-payout-api/business-dashboard/whitelist-your-ips.md)
{% endhint %}

## Auth Login

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

The `POST` request is used to authenticate and login to YoguPay. Credentials are provided to business accounts by YoguPay

**Headers**

| Name         | Value              |
| ------------ | ------------------ |
| Content-Type | `application/json` |
| Token        | token              |

{% hint style="info" %}
The token to be used above will be obtained from the response (expires after 30minutes requires a refresh)
{% endhint %}

**Body**

| Name       | Type   | Description           |
| ---------- | ------ | --------------------- |
| `username` | string | User name of the user |
| `password` | string | Password of the user  |

### Request and Response Example

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

```json
{
  "password": "1",
  "username": "user@yogupay.com"
}
```

{% endtab %}

{% tab title="Successful Response" %}

```json
{
    "status": "1",
    "message": "Login successful",
    "image": "https://tumapay.com/tp/images/avatar.png",
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTAwOTAsInVzZXJuYW1lIjoiZXJyb2xAeW9ndXBheS5jb20iLCJlbnZpcm9ubWVudCI6InN0YWdpbmciLCJpcF9hZGRyZXNzIjoiOjpmZmZmOjQxLjkwLjExNi4xNjEiLCJpYXQiOjE3MzAxMDU2MTAsImV4cCI6MTczMDEwNzQxMH0.HP9SGLNJsXW7DgGK0AYq6CYJjTc1YXLQbRekxK-dsR8",
    "username": "user@yogupay.com",
    "is_verified": 1,
    "country_code": "GB",
    "phone_number": 254712345678,
    "full_name": "Demo Account",
    "number_of_transactions": 0
}
```

{% endtab %}

{% tab title="Failed Response" %}

```json

{
    "status": "0",
    "message": "Invalid Login Details"
}

```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
The token obtained from the response above will be used to authenticate subsequent pages
{% endhint %}


---

# 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://yogupay.gitbook.io/yogupay-payout-api/developers/editor.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.
