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

# Data Ingestion

## Upload Transactions

<mark style="color:green;">`POST`</mark> `{{BASE_URL}}/mfi/v1.1/data`

This endpoint allows you to upload historical transactional record for a user/merchant so that they can get a **credit score**. A credit score is used to determine the user's loan limits.\
\
The **MAX** number of transactions allowed in the transactions array is **200 records**.  It is important that at least **6 months** worth of data be uploaded when a user is registered so that they can be able to get a loan offer. This can be done in a **background job** once a user has been registered.\
\
The **other\_details** section will be used to upload any additional information requested by the credit scoring team.

#### Headers

| Name                                             | Type   | Description                                                    |
| ------------------------------------------------ | ------ | -------------------------------------------------------------- |
| Authentication<mark style="color:red;">\*</mark> | string | Authentication token to track down who is emptying our stocks. |

#### Request Body

| Name                                           | Type   | Description                                                            |
| ---------------------------------------------- | ------ | ---------------------------------------------------------------------- |
| transactions.other\_details                    | array  | Key Value pair for additional fields requested by Credit Scoring Team  |
| transactions.transaction\_time                 | string | Time of transaction                                                    |
| transactions.face\_amount                      | number | Amount                                                                 |
| transactions.merchant\_id                      | string | Merchant ID                                                            |
| transactions.transaction\_id                   | string | Transaction ID                                                         |
| transactions<mark style="color:red;">\*</mark> | array  | An array containing multiple transaction records                       |
| channel<mark style="color:red;">\*</mark>      | string | Client Name provided by Pezesha during account setup (**Capitalized**) |

{% tabs %}
{% tab title="200  Data has been uploaded successfully" %}

```javascript
{
   "status": 200,
   "response_code": 0,
   "error": false,
   "message": "Request processed successfully"
}

```

{% endtab %}

{% tab title="400 Could not process request." %}

```
{
   "status": 400,
   "response_code": 0,
   "error": true,
   "message": "Unable to process request"
}

```

{% endtab %}
{% endtabs %}

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

```javascript
{
   "channel": "Partner Name",
   "transactions":[
      {
         "transaction_id": "TR12356",
         "merchant_id": "MC12356",
         "face_amount": 400,
         "transaction_time": "2021-01-03 19:12:34",
         "other_details": [
            {
               "key": "location",
               "value": "Nairobi"
            },
            {
               "key": "category",
               "value": "OILS"
            }
         ]
      }
   ]
}

```

{% endtab %}
{% endtabs %}
