> 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 %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.pezesha.com/data-ingestion.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
