# Authenticate a merchant

This API allows the merchant to login into the RKFL system. After the successful login, API returns the "access token" and "refresh token". The access token would be used as a Bearer token for the subsequent API calls, while the refresh token will generate a new access token if the existing access token expires.

The concept of the refresh token usually works in a mobile application where users stay login for a long time. The use of the refresh token is subject to the policy of the integrated platform.

> The current expiry time of the access token is 30 min

{% hint style="info" %}
This API should be used for Server <-> Server communication only.
{% endhint %}

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

#### Request Body

| Name         | Type   | Description                                                                                                                                          |
| ------------ | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| encryptedReq | String | Encrypted data containing email<mark style="color:red;">\*</mark>, password<mark style="color:red;">\*</mark>, deviceId, deviceToken, fcmToken, totp |

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

```javascript
{
    "ok": true,
    "result": {
        "access": ""eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImZlNWNjODU0LWUxMzYtNDZiNy04OGRjLTRhMzNkZDdjMzFhMSIsImlhdCI6MTY1NDE2NDg3OCwiZXhwIjoxNjU0MTY2Njc4fQ.TqURCCKw8bjHv1hYKE6PAJgNdpvU-wD3zH3tPefhZP8"",
        "refresh": ""eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImZlNWNjODU0LWUxMzYtNDZiNy04OGRjLTRhMzNkZDdjMzFhMSIsImlhdCI6MTY1NDE2NDg3OCwiZXhwIjoxNjU0MTY3Mjc4fQ.2MCHnI_ONxt9Yxg-po9lfe9I827IKPiANs2eO8neNsU"",
        "status": 1
    }
}
```

{% endtab %}

{% tab title="401: Unauthorized Invalid credentials" %}

```javascript
{
  "ok": false,
  "statusCode": 401,
  "data": {
    
  },
  "message": "Incorrect email and password pair"
}
```

{% endtab %}

{% tab title="500: Internal Server Error Server unavailable or server error" %}

```javascript
{
  "ok": false,
  "statusCode": 500,
  "message": "Internal Server Error"
}
```

{% 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://docs.rocketfuel.inc/developer-guides/api-reference/payins/authentication/authenticate-a-merchant.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.
