# Loan Request

## Creating a new loan request

create a loan request from your server

## Create Loan request

<mark style="color:green;">`POST`</mark> `https://configure-abierta-test.herokuapp.com/api/v1/loan_request`

Creates a new Loan request

#### Headers

| Name                                            | Type   | Description           |
| ----------------------------------------------- | ------ | --------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer `YOUR_API_KEY` |

#### Request Body

| Name                                      | Type   | Description             |
| ----------------------------------------- | ------ | ----------------------- |
| amount<mark style="color:red;">\*</mark>  | float  | The amount requested    |
| purpose<mark style="color:red;">\*</mark> | string | The purpose of the Loan |

{% tabs %}
{% tab title="200 Loan request created successfully" %}

```javascript
{
    "status": "success",
    "message": "success",
    "data": {
        "id": 172,
        "user_id": 103,
        "org_id": 62,
        "product_id": 92,
        "product_name": "Trial",
        "product_slug": "trial",
        "lender_name": "Spleet Inc",
        "reference": "5dnpDwwn3dDwD14i",
        "fullname": "Daniel Osineye",
        "amount": 2000000,
        "purpose": "House Rent",
        "terms": {
            "approved_amount": 0,
            "rate": 0,
            "tenure": 0,
            "tenured_in": "",
            "rate_type": "",
            "grace_period": 0,
            "exclude_weekends": false,
            "zero_interest": false,
            "estimated_repayment": 0,
            "note": ""
        },
        "status": "saved",
        "active": true,
        "lender_status": "saved",
        "debit_mandate_next_step": "setup",
        "declined_at": "0001-01-01T00:00:00Z",
        "final_approval_date": "0001-01-01T00:00:00Z",
        "approved_at": "0001-01-01T00:00:00Z",
        "user_status": "saved",
        "user_accepted_date": "0001-01-01T00:00:00Z",
        "user_declined_date": "0001-01-01T00:00:00Z",
        "archived_date": "0001-01-01T00:00:00Z",
        "unarchived_at": "0001-01-01T00:00:00Z",
        "disbursed_at": "0001-01-01T00:00:00Z",
        "submitted_at": "0001-01-01T00:00:00Z",
        "deleted_at": "0001-01-01T00:00:00Z",
        "created_at": "2022-01-11T01:04:46.623484Z",
        "updated_at": "0001-01-01T00:00:00Z"
    }
}
```

{% endtab %}

{% tab title="200: OK Product ID is required" %}

```javascript
{
    "status": "error",
    "message": "Product ID is required"
}
```

{% endtab %}

{% tab title="200: OK Invalid User ID" %}

```javascript
{
    "status": "no-access",
    "message": "You do not have access to this user, please verify the user-id"
}
```

This would usually happen when you try to access a user that does not exist in your organization
{% endtab %}
{% endtabs %}

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

```bash
curl --location --request POST 'http://localhost:6000/api/v1/user/1/loan_request?product-id=1' \
--header 'Authorization: Bearer ' \
--header 'Content-Type: application/json' \
--data-raw '{
    "amount": 20000,
    "purpose": "House Rent"
}'
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "http://localhost:6000/api/v1/user/1/loan_request?product-id=1"
  method := "POST"

  payload := strings.NewReader(`{
    "amount": 20000,
    "purpose": "House Rent"
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Authorization", "Bearer ")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```

{% endtab %}

{% tab title="NodeJS" %}

```javascript
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'http://localhost:6000/api/v1/user/1/loan_request?product-id=1',
  'headers': {
    'Authorization': 'Bearer ',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({"amount":20000,"purpose":"House Rent"})

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
```

{% endtab %}
{% endtabs %}

## Fetching a loan request

Get the details of a loan request created on your integration

## Fetch a Loan Request

<mark style="color:blue;">`GET`</mark> `https://configure-abierta-test.herokuapp.com/loan_request`

Fetches a loan request &#x20;

#### Query Parameters

| Name                                         | Type   | Description                                                     |
| -------------------------------------------- | ------ | --------------------------------------------------------------- |
| product-id<mark style="color:red;">\*</mark> | string | The product id to identify products loan request                |
| direction                                    | string | Filter loan request by ascending `ASC` and decsending `DESC` id |
| cursor                                       | int    | Cursor to determine last returned                               |
| limit                                        | String | The amount of loan request to return per request                |

#### Headers

| Name          | Type   | Description           |
| ------------- | ------ | --------------------- |
| Authorization | String | Bearer `YOUR_API_KEY` |

{% tabs %}
{% tab title="200: OK Fetch Loan Request" %}

```javascript
{
    "status": "success",
    "message": "Loan Requests Retrieved Successfully",
    "data": {
        "loan_requests": [
            {
                "id": 1,
                "user_id": 1,
                "org_id": 1,
                "product_id": 1,
                "product_name": "EC Personal Loan",
                "product_slug": "ec-personal-loan",
                "lender_name": "Evolve Credit Lending Services",
                "reference": "H-sDIdUl9VsfHedM",
                "fullname": "Daniel Osineye",
                "amount": 1000,
                "purpose": "Vibes & Insha Allah",
                "terms": {
                    "approved_amount": 0,
                    "rate": 2,
                    "tenure": 2,
                    "tenured_in": "",
                    "rate_type": "",
                    "grace_period": 0,
                    "exclude_weekends": false,
                    "zero_interest": false,
                    "estimated_repayment": 0,
                    "note": ""
                },
                "status": "pending",
                "active": true,
                "progress": "7",
                "lender_status": "approved",
                "debit_mandate_next_step": "setup",
                "offer_letter": "november62022",
                "declined_at": "0001-01-01T00:00:00Z",
                "final_approval_date": "2021-09-28T20:58:17.614616Z",
                "approved_by_id": 1,
                "approved_by": "Daniel Osineye",
                "approved_at": "2021-09-28T20:58:17.614616Z",
                "user_status": "submitted",
                "user_accepted_date": "0001-01-01T00:00:00Z",
                "user_declined_date": "0001-01-01T00:00:00Z",
                "archived_date": "0001-01-01T00:00:00Z",
                "unarchived_at": "0001-01-01T00:00:00Z",
                "disbursed_at": "0001-01-01T00:00:00Z",
                "submitted_at": "2022-02-04T13:48:02.335331Z",
                "deleted_at": "0001-01-01T00:00:00Z",
                "created_at": "2021-09-21T09:29:44.238127Z",
                "updated_at": "2022-02-04T13:48:02.335331Z"
            },
            {
                "id": 2,
                "user_id": 1,
                "org_id": 1,
                "product_id": 1,
                "product_name": "EC Personal Loan",
                "product_slug": "ec-personal-loan",
                "lender_name": "Evolve Credit Lending Services",
                "reference": "kVAV3D92af64T6l2",
                "fullname": "Daniel Osineye",
                "amount": 1000,
                "purpose": "Another Vibes & Insha Allah",
                "terms": {
                    "approved_amount": 0,
                    "rate": 1,
                    "tenure": 1,
                    "tenured_in": "",
                    "rate_type": "",
                    "grace_period": 0,
                    "exclude_weekends": false,
                    "zero_interest": false,
                    "estimated_repayment": 0,
                    "note": ""
                },
                "status": "saved",
                "active": true,
                "progress": "end",
                "lender_status": "approved",
                "mono_ids": [
                    "614a2dfc76d76d67b94e72eb"
                ],
                "mono_tokenized": true,
                "debit_mandate_next_step": "setup",
                "offer_letter": "november62022",
                "declined_at": "0001-01-01T00:00:00Z",
                "final_approval_date": "2021-09-21T10:16:50.416199Z",
                "approved_by_id": 1,
                "approved_by": "Daniel Osineye",
                "approved_at": "2021-09-21T10:16:50.416199Z",
                "user_status": "submitted",
                "user_accepted_date": "0001-01-01T00:00:00Z",
                "user_declined_date": "0001-01-01T00:00:00Z",
                "disbursed_by": "Daniel Osineye",
                "disbursed": true,
                "manually_disbursed": true,
                "archived_date": "0001-01-01T00:00:00Z",
                "unarchived_at": "0001-01-01T00:00:00Z",
                "disbursed_at": "2021-09-21T10:20:52.22093Z",
                "submitted_at": "2021-09-21T19:09:50.934576Z",
                "deleted_at": "0001-01-01T00:00:00Z",
                "created_at": "2021-09-21T09:31:28.354668Z",
                "updated_at": "2021-11-06T22:13:11.987966Z"
            },
            {
                "id": 13,
                "user_id": 6,
                "org_id": 1,
                "product_id": 1,
                "product_name": "EC Personal Loan",
                "product_slug": "ec-personal-loan",
                "lender_name": "Evolve Credit Lending Services",
                "reference": "VhlFgw5k3hhdjN-d",
                "fullname": "Collins Ogbuzuru",
                "amount": 300000,
                "purpose": "to buy a car for uber",
                "terms": {
                    "approved_amount": 0,
                    "rate": 0,
                    "tenure": 0,
                    "tenured_in": "",
                    "rate_type": "",
                    "grace_period": 0,
                    "exclude_weekends": false,
                    "zero_interest": false,
                    "estimated_repayment": 0,
                    "note": ""
                },
                "status": "saved",
                "active": true,
                "lender_status": "saved",
                "debit_mandate_next_step": "setup",
                "declined_at": "0001-01-01T00:00:00Z",
                "final_approval_date": "0001-01-01T00:00:00Z",
                "approved_at": "0001-01-01T00:00:00Z",
                "user_status": "saved",
                "user_accepted_date": "0001-01-01T00:00:00Z",
                "user_declined_date": "0001-01-01T00:00:00Z",
                "archived_date": "0001-01-01T00:00:00Z",
                "unarchived_at": "0001-01-01T00:00:00Z",
                "disbursed_at": "0001-01-01T00:00:00Z",
                "submitted_at": "0001-01-01T00:00:00Z",
                "deleted_at": "0001-01-01T00:00:00Z",
                "created_at": "2021-09-21T19:27:30.991807Z",
                "updated_at": "0001-01-01T00:00:00Z"
            }
        ],
        "cursor": 13
    }
}
```

{% endtab %}

{% tab title="400: Bad Request Direction Not Specified" %}

```javascript
{
    "status": "error",
    "message": "Direction not specified"
}
```

{% endtab %}
{% endtabs %}

## Updating a Loan Request

Update the information of a loan request

## Update a Loan Request

<mark style="color:orange;">`PUT`</mark> `https://configure-abierta-test.herokuapp.com/api/v1/loan_request/{lrID}`

Updates a loan request

#### Path Parameters

| Name                                   | Type   | Description                       |
| -------------------------------------- | ------ | --------------------------------- |
| lrID<mark style="color:red;">\*</mark> | String | ID for loan request to be updated |

#### Query Parameters

| Name       | Type   | Description           |
| ---------- | ------ | --------------------- |
| product-id | String | ID of the loanprdutco |

#### Headers

| Name          | Type   | Description             |
| ------------- | ------ | ----------------------- |
| Authorization | String | Bearer `YOUR_API_TOKEN` |

#### Request Body

| Name    | Type   | Description          |
| ------- | ------ | -------------------- |
| purpose | String | Purpose for the loan |

{% tabs %}
{% tab title="200: OK Loan Request Updated Successfully" %}

```javascript
{
   "purpose":"somethhing else"
}
```

{% endtab %}
{% endtabs %}

## Delete Loan Request

Delete a loan request from your server

## Delete Loan Request

<mark style="color:red;">`DELETE`</mark> `https://configure-abierta-test.herokuapp.com/api/v1/loan_request/{lrID}`

Deletes Loan Request

#### Path Parameters

| Name                                   | Type   | Description                      |
| -------------------------------------- | ------ | -------------------------------- |
| lrID<mark style="color:red;">\*</mark> | String | ID of the loan request to delete |

#### Query Parameters

| Name       | Type   | Description                               |
| ---------- | ------ | ----------------------------------------- |
| product-id | String | product ID for the specified loan request |

#### Headers

| Name                                            | Type   | Description           |
| ----------------------------------------------- | ------ | --------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer `YOUR_API_KEY` |

## Tokenize Mono

<mark style="color:green;">`POST`</mark> `https://configure-abierta-test.herokuapp.com/api/v1/loan_request/{ID}/tokenize_mono`

#### Path Parameters

| Name | Type   | Description            |
| ---- | ------ | ---------------------- |
| ID   | String | ID of the loan request |

#### Headers

| Name          | Type   | Description           |
| ------------- | ------ | --------------------- |
| Authorization | String | Bearer `YOUR_API_KEY` |

{% tabs %}
{% tab title="500: Internal Server Error Unable to Tokenize Mono" %}

```javascript
{
    "status": "error",
    "message": "Something went wrong. Please try again_UnblTTknzeMn"
}
```

{% endtab %}
{% endtabs %}

## Document Upload

## Upload Document

<mark style="color:green;">`POST`</mark> `https://configure-abierta-test.herokuapp.com/api/v1/loan_request/{ID}/upload`

Uploads a Document

#### Query Parameters

| Name                                         | Type   | Description                    |
| -------------------------------------------- | ------ | ------------------------------ |
| product-id<mark style="color:red;">\*</mark> | String | Product ID of the loan request |

#### Headers

| Name                                            | Type   | Description              |
| ----------------------------------------------- | ------ | ------------------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer `YOUR_ACCESS_KEY` |

#### Request Body

| Name                                            | Type   | Description                   |
| ----------------------------------------------- | ------ | ----------------------------- |
| type<mark style="color:red;">\*</mark>          |        | ID type                       |
| title<mark style="color:red;">\*</mark>         | String | Title of the ID               |
| number<mark style="color:red;">\*</mark>        | String | number of the ID type         |
| document\_url<mark style="color:red;">\*</mark> | String | The url to the document image |

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

```javascript
{
    "status": "success",
    "message": "Upload Succesful",
    "data": [
        {
            "id": 578,
            "user_id": 1,
            "org_id": 1,
            "loan_request_id": 1,
            "type": "valid-id",
            "title": "Valid ID",
            "reference": "GrT7RU6tX4OfZR",
            "number": "AD34834909",
            "document_url": "url-to-document-on-filestack-or-s3",
            "has_custom_fields": false,
            "custom_fields": null,
            "created_at": "2022-02-17T09:15:15.605745Z"
        },
        {
            "id": 579,
            "user_id": 1,
            "org_id": 1,
            "loan_request_id": 1,
            "type": "valid-id",
            "title": "Valid ID",
            "reference": "aUjWqb4ViM30kx",
            "number": "AD34834909",
            "document_url": "url-to-document-on-filestack-or-s3",
            "has_custom_fields": false,
            "custom_fields": null,
            "created_at": "2022-02-17T09:15:17.155748Z"
        }
    ],
    "data1": null
}
```

{% endtab %}
{% endtabs %}

## Get Loan Request Progress

## Get Loan Request Progress

<mark style="color:blue;">`GET`</mark> `https://configure-abierta-test.herokuapp.com/api/v1/loan_request/{ID}/progress`

Fetches a loan request progress

#### Path Parameters

| Name | Type   | Description        |
| ---- | ------ | ------------------ |
| ID   | String | ID of loan request |

#### Query Parameters

| Name                                         | Type   | Description                 |
| -------------------------------------------- | ------ | --------------------------- |
| product-id<mark style="color:red;">\*</mark> | String | product id for loan request |

#### Headers

| Name                                            | Type   | Description           |
| ----------------------------------------------- | ------ | --------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer `YOUR_API_KEY` |

{% tabs %}
{% tab title="200: OK Loan Request Progress Retrieved Successfully" %}

```javascript
{
    "status": "success",
    "message": "Loan Request Retrieved Successfully",
    "data": "7"
}
```

{% endtab %}
{% endtabs %}

## Add Business information

## Add Business Information

<mark style="color:green;">`POST`</mark> `https://configure-abierta-test.herokuapp.com/loan_request/{ID}/bank_details`

Add Business Information

#### Path Parameters

| Name                                 | Type   | Description        |
| ------------------------------------ | ------ | ------------------ |
| ID<mark style="color:red;">\*</mark> | String | ID of loan request |

#### Query Parameters

| Name       | Type   | Description                    |
| ---------- | ------ | ------------------------------ |
| product-id | String | Product id of the loan request |

#### Headers

| Name                                            | Type   | Description            |
| ----------------------------------------------- | ------ | ---------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer `API_KEY_TOKEN` |

#### Request Body

| Name                                          | Type   | Description                            |
| --------------------------------------------- | ------ | -------------------------------------- |
| name<mark style="color:red;">\*</mark>        | String | Business name                          |
| org\_id<mark style="color:red;">\*</mark>     | Int    | ID of the organization                 |
| role<mark style="color:red;">\*</mark>        | String | Role in the business organization      |
| industry<mark style="color:red;">\*</mark>    | String | Industry                               |
| description<mark style="color:red;">\*</mark> | String | Business description                   |
| registered<mark style="color:red;">\*</mark>  | Bool   | If the business is registered          |
| registration\_number                          | String | Business registration number           |
| established\_on                               | string | Business established date `yyyy-mm-dd` |
| physical\_location                            | String |                                        |
| number\_of\_locations                         | Int    |                                        |
| location\_status                              | String |                                        |
| average\_monthly\_income                      | Int    |                                        |
| last\_twelve\_months\_income                  | Int    |                                        |
| primary\_payments\_collection\_method         | String |                                        |
| number\_of\_employees                         | String |                                        |
| monthly\_salary\_cost                         | Int    |                                        |
| annual\_rent\_cost                            | Int    |                                        |
| monthly\_electricity\_cost                    | Int    |                                        |
| monthly\_ads\_cost                            | Int    |                                        |
| monthly\_marketing\_cost                      | Int    |                                        |

{% tabs %}
{% tab title="200: OK Business Information Added Successfully" %}

```javascript
{
    "status": "success",
    "message": "Successfully added Business Information",
    "data": {
        "id": 57,
        "user_id": 1,
        "org_id": 1,
        "loan_request_id": 1,
        "name": "Fashistry Fashion School",
        "role": "Founder/CEO",
        "industry": "Fashion & Education",
        "description": "We train young people to become fashion experts",
        "registered": true,
        "registration_number": "AS89349723",
        "established_on": "2020-10-01",
        "physical_location": true,
        "number_of_locations": 4,
        "location_status": "owned",
        "average_monthly_income": 15000000,
        "last_twelve_months_income": 180000000,
        "primary_payments_collection_method": "cash",
        "number_of_employees": 25,
        "monthly_salary_cost": 2000000,
        "annual_rent_cost": 200000,
        "monthly_electricity_cost": 50000,
        "monthly_ads_cost": 1000000,
        "monthly_marketing_cost": 800000,
        "has_custom_fields": false,
        "custom_fields": [
            {
                "label": "",
                "field": "",
                "data_type": "",
                "string_value": "",
                "number_value": 0,
                "boolean_value": false,
                "is_money": false,
                "is_custom": true,
                "created_at": "0001-01-01T00:00:00Z",
                "updated_at": "0001-01-01T00:00:00Z"
            },
            {
                "label": "",
                "field": "",
                "data_type": "",
                "string_value": "",
                "number_value": 0,
                "boolean_value": false,
                "is_money": false,
                "is_custom": true,
                "created_at": "0001-01-01T00:00:00Z",
                "updated_at": "0001-01-01T00:00:00Z"
            },
            {
                "label": "",
                "field": "",
                "data_type": "",
                "string_value": "",
                "number_value": 0,
                "boolean_value": false,
                "is_money": false,
                "is_custom": true,
                "created_at": "0001-01-01T00:00:00Z",
                "updated_at": "0001-01-01T00:00:00Z"
            }
        ],
        "updated_at": "0001-01-01T00:00:00Z",
        "created_at": "2022-02-17T09:52:17.265119Z"
    }
}
```

{% endtab %}
{% endtabs %}

## Add Bank Details

<mark style="color:green;">`POST`</mark> `https://configure-abierta-test.herokuapp.com/api/v1/loan_request/{ID}/bank_details`

Adds Bank Details

#### Path Parameters

| Name                                 | Type   | Description            |
| ------------------------------------ | ------ | ---------------------- |
| ID<mark style="color:red;">\*</mark> | String | ID of the loan request |

#### Query Parameters

| Name                                         | Type   | Description                    |
| -------------------------------------------- | ------ | ------------------------------ |
| product-id<mark style="color:red;">\*</mark> | String | product id of the loan request |

#### Request Body

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| code<mark style="color:red;">\*</mark>          | String | Bank code           |
| account\_name<mark style="color:red;">\*</mark> | String | Bank account name   |
| account\_number                                 | String | Bank account number |
| bank\_name                                      | String | Bank name           |

{% tabs %}
{% tab title="200: OK Bank Details added successfully" %}

```javascript
{
    "status": "success",
    "message": "Loan Request Updated",
    "data": null,
    "data1": {
        "id": 1,
        "user_id": 1,
        "org_id": 1,
        "product_id": 1,
        "product_name": "EC Personal Loan",
        "product_slug": "ec-personal-loan",
        "lender_name": "Evolve Credit Lending Services",
        "reference": "H-sDIdUl9VsfHedM",
        "fullname": "Daniel Osineye",
        "amount": 1000,
        "purpose": "Vibes & Insha Allah",
        "terms": {
            "approved_amount": 0,
            "rate": 2,
            "tenure": 2,
            "tenured_in": "",
            "rate_type": "",
            "grace_period": 0,
            "exclude_weekends": false,
            "zero_interest": false,
            "estimated_repayment": 0,
            "note": ""
        },
        "status": "pending",
        "active": true,
        "progress": "7",
        "lender_status": "approved",
        "debit_mandate_next_step": "setup",
        "offer_letter": "november62022",
        "declined_at": "0001-01-01T00:00:00Z",
        "final_approval_date": "2021-09-28T20:58:17.614616Z",
        "approved_by_id": 1,
        "approved_by": "Daniel Osineye",
        "approved_at": "2021-09-28T20:58:17.614616Z",
        "user_status": "submitted",
        "user_accepted_date": "0001-01-01T00:00:00Z",
        "user_declined_date": "0001-01-01T00:00:00Z",
        "archived_date": "0001-01-01T00:00:00Z",
        "unarchived_at": "0001-01-01T00:00:00Z",
        "disbursed_at": "0001-01-01T00:00:00Z",
        "submitted_at": "2022-01-29T12:20:44.44083492+01:00",
        "deleted_at": "0001-01-01T00:00:00Z",
        "created_at": "2021-09-21T09:29:44.238127Z",
        "updated_at": "2022-01-29T12:20:44.440835061+01:00"
    }
}
```

{% endtab %}
{% endtabs %}

## Get Bank Details

<mark style="color:blue;">`GET`</mark> `https://configure-abierta-test.herokuapp.com`

#### Path Parameters

| Name | Type   | Description            |
| ---- | ------ | ---------------------- |
| ID   | String | ID of the loan request |

#### Query Parameters

| Name                                         | Type   | Description                    |
| -------------------------------------------- | ------ | ------------------------------ |
| product-id<mark style="color:red;">\*</mark> | String | Product ID of the loan request |

#### Headers

| Name                                            | Type   | Description           |
| ----------------------------------------------- | ------ | --------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer `YOUR_API_KEY` |

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

```javascript
{
    "status": "success",
    "message": "success",
    "data": [
        {
            "id": 17,
            "user_id": 1,
            "org_id": 1,
            "loan_request_id": 1,
            "credit_order_id": 0,
            "code": "058",
            "account_number": "0571449452",
            "account_name": "OSINEYE DANIEL IYANUOLUWA",
            "bank_name": "058",
            "is_deleted": false,
            "has_custom_fields": false,
            "custom_fields": null,
            "created_at": "2021-09-24T08:27:25.361448Z",
            "updated_at": "0001-01-01T00:00:00Z"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Submit Loan request

## Submit Loan Request

<mark style="color:orange;">`PUT`</mark> `https://configure-abierta-test.herokuapp.com/api/v1/loan_request/{ID}/bank_details`

#### Path Parameters

| Name                                 | Type   | Description        |
| ------------------------------------ | ------ | ------------------ |
| ID<mark style="color:red;">\*</mark> | String | ID of loan request |

#### Query Parameters

| Name                                         | Type   | Description                    |
| -------------------------------------------- | ------ | ------------------------------ |
| product-id<mark style="color:red;">\*</mark> | String | Product ID of the loan request |

#### Headers

| Name                                            | Type   | Description           |
| ----------------------------------------------- | ------ | --------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer `YOUR_API_KEY` |

{% tabs %}
{% tab title="200: OK Successfully submitted Loan Request" %}

```javascript
{
    "status": "success",
    "message": "Loan Request Updated",
    "data": null,
    "data1": {
        "id": 1,
        "user_id": 1,
        "org_id": 1,
        "product_id": 1,
        "product_name": "EC Personal Loan",
        "product_slug": "ec-personal-loan",
        "lender_name": "Evolve Credit Lending Services",
        "reference": "H-sDIdUl9VsfHedM",
        "fullname": "Daniel Osineye",
        "amount": 1000,
        "purpose": "Vibes & Insha Allah",
        "terms": {
            "approved_amount": 0,
            "rate": 2,
            "tenure": 2,
            "tenured_in": "",
            "rate_type": "",
            "grace_period": 0,
            "exclude_weekends": false,
            "zero_interest": false,
            "estimated_repayment": 0,
            "note": ""
        },
        "status": "pending",
        "active": true,
        "progress": "7",
        "lender_status": "approved",
        "debit_mandate_next_step": "setup",
        "offer_letter": "november62022",
        "declined_at": "0001-01-01T00:00:00Z",
        "final_approval_date": "2021-09-28T20:58:17.614616Z",
        "approved_by_id": 1,
        "approved_by": "Daniel Osineye",
        "approved_at": "2021-09-28T20:58:17.614616Z",
        "user_status": "submitted",
        "user_accepted_date": "0001-01-01T00:00:00Z",
        "user_declined_date": "0001-01-01T00:00:00Z",
        "archived_date": "0001-01-01T00:00:00Z",
        "unarchived_at": "0001-01-01T00:00:00Z",
        "disbursed_at": "0001-01-01T00:00:00Z",
        "submitted_at": "2022-02-04T14:48:02.335330873+01:00",
        "deleted_at": "0001-01-01T00:00:00Z",
        "created_at": "2021-09-21T09:29:44.238127Z",
        "updated_at": "2022-02-04T14:48:02.335331053+01:00"
    }
}
```

{% endtab %}
{% endtabs %}

## Add Guarantor&#x20;

## Add a guarantor to a loan request

<mark style="color:green;">`POST`</mark> `https://configure-abierta-test.herokuapp.com/api/v1/loan_request/{ID}/guarantor`

Adds a guarantor to a loan request

#### Path Parameters

| Name                                 | Type   | Description            |
| ------------------------------------ | ------ | ---------------------- |
| ID<mark style="color:red;">\*</mark> | String | ID of the loan request |

#### Query Parameters

| Name                                         | Type   | Description                    |
| -------------------------------------------- | ------ | ------------------------------ |
| product-id<mark style="color:red;">\*</mark> | String | Product ID of the loan request |

#### Headers

| Name                                           | Type   | Description           |
| ---------------------------------------------- | ------ | --------------------- |
| Auhorization<mark style="color:red;">\*</mark> | String | Bearer `YOUR_API_KEY` |

#### Request Body

| Name                                           | Type   | Description                         |
| ---------------------------------------------- | ------ | ----------------------------------- |
| firstname<mark style="color:red;">\*</mark>    | String | Guarantor's first name              |
| gender<mark style="color:red;">\*</mark>       | String | Guarantor's gender                  |
| relationship<mark style="color:red;">\*</mark> | String | Borrowers relationship to guarantor |
| email<mark style="color:red;">\*</mark>        | String | Guarantor's email address           |
| lastname<mark style="color:red;">\*</mark>     | String | Guarantor's last name               |
| phone<mark style="color:red;">\*</mark>        | String | Guarantor's phone number            |

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

```javascript
{
    "status": "success",
    "message": "Your entry has been successfully recorded",
    "data": [
        {
            "id": 66,
            "user_id": 1,
            "org_id": 1,
            "loan_request_id": 1,
            "firstname": "Sure",
            "lastname": "Man",
            "email": "sure.man@gmail.com",
            "phone": "+2348182791196",
            "relationship": "Employer",
            "created_at": "2022-02-04T13:40:38.506125Z",
            "updated_at": "0001-01-01T00:00:00Z"
        },
        {
            "id": 66,
            "user_id": 1,
            "org_id": 1,
            "loan_request_id": 1,
            "firstname": "Sure",
            "lastname": "Man",
            "email": "sure.man@gmail.com",
            "phone": "+2348182791196",
            "relationship": "Employer",
            "created_at": "2022-02-04T13:40:38.506125Z",
            "updated_at": "0001-01-01T00:00:00Z"
        }
    ],
    "data1": null
}
```

{% endtab %}
{% endtabs %}

## Get Guarantor

## Get loan request guarantor information

<mark style="color:blue;">`GET`</mark> `https://configure-abierta-test.herokuapp.com/api/v1/loan_request/{ID}/guarantor`

#### Path Parameters

| Name                                 | Type   | Description            |
| ------------------------------------ | ------ | ---------------------- |
| ID<mark style="color:red;">\*</mark> | String | ID of the loan request |

#### Query Parameters

| Name                                         | Type   | Description                    |
| -------------------------------------------- | ------ | ------------------------------ |
| product-id<mark style="color:red;">\*</mark> | String | Product ID of the loan request |

#### Headers

| Name                                            | Type   | Description           |
| ----------------------------------------------- | ------ | --------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer `YOUR_API_KEY` |

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

```javascript
{
    "status": "success",
    "message": "success",
    "data": [
        {
            "id": 2,
            "user_id": 1,
            "org_id": 1,
            "loan_request_id": 1,
            "firstname": "Sure",
            "lastname": "Guy",
            "email": "sure.guy@gmail.com",
            "phone": "+2348182791196",
            "relationship": "Employer",
            "created_at": "2021-10-12T14:29:50.46615Z",
            "updated_at": "0001-01-01T00:00:00Z"
        },
        {
            "id": 3,
            "user_id": 1,
            "org_id": 1,
            "loan_request_id": 1,
            "firstname": "Oluwadara",
            "lastname": "Gbenle",
            "email": "daniel.osineye@gmail.com",
            "phone": "08182791196",
            "created_at": "2021-10-13T07:55:05.625258Z",
            "updated_at": "0001-01-01T00:00:00Z"
        },
        {
            "id": 13,
            "user_id": 1,
            "org_id": 1,
            "loan_request_id": 1,
            "firstname": "Oluwadara",
            "lastname": "Gbenle",
            "email": "isongjosiah@gmail.com",
            "phone": "08182791196",
            "created_at": "2021-11-19T14:03:34.410278Z",
            "updated_at": "0001-01-01T00:00:00Z"
        },
        {
            "id": 14,
            "user_id": 1,
            "org_id": 1,
            "loan_request_id": 1,
            "firstname": "Oluwadara",
            "lastname": "Gbenle",
            "email": "isongjosiah@gmail.com",
            "phone": "08182791196",
            "created_at": "2021-11-19T14:05:50.378272Z",
            "updated_at": "0001-01-01T00:00:00Z"
        },
        {
            "id": 46,
            "user_id": 1,
            "org_id": 1,
            "loan_request_id": 1,
            "firstname": "Odun",
            "lastname": "Osineye",
            "email": "odunosineye@gmail.com",
            "phone": "08182791196",
            "created_at": "2021-11-23T14:18:36.374262Z",
            "updated_at": "0001-01-01T00:00:00Z"
        },
        {
            "id": 47,
            "user_id": 1,
            "org_id": 1,
            "loan_request_id": 1,
            "firstname": "Odun",
            "lastname": "Osineye",
            "email": "odunosineye@gmail.com",
            "phone": "08182791196",
            "created_at": "2021-11-23T14:19:16.734397Z",
            "updated_at": "0001-01-01T00:00:00Z"
        },
        {
            "id": 58,
            "user_id": 1,
            "org_id": 1,
            "loan_request_id": 1,
            "firstname": "Sure",
            "lastname": "Guy",
            "email": "sure.guy@gmail.com",
            "phone": "+2348182791196",
            "relationship": "Employer",
            "created_at": "2022-01-25T21:12:09.890528Z",
            "updated_at": "0001-01-01T00:00:00Z"
        },
        {
            "id": 59,
            "user_id": 1,
            "org_id": 1,
            "loan_request_id": 1,
            "firstname": "Sure",
            "lastname": "Man",
            "email": "sure.man@gmail.com",
            "phone": "+2348182791196",
            "relationship": "Employer",
            "created_at": "2022-01-25T21:12:17.998877Z",
            "updated_at": "0001-01-01T00:00:00Z"
        },
        {
            "id": 60,
            "user_id": 1,
            "org_id": 1,
            "loan_request_id": 1,
            "firstname": "Sure",
            "lastname": "Guy",
            "email": "sure.guy@gmail.com",
            "phone": "+2348182791196",
            "relationship": "Employer",
            "created_at": "2022-01-26T03:08:39.010985Z",
            "updated_at": "0001-01-01T00:00:00Z"
        },
        {
            "id": 61,
            "user_id": 1,
            "org_id": 1,
            "loan_request_id": 1,
            "firstname": "Sure",
            "lastname": "Man",
            "email": "sure.man@gmail.com",
            "phone": "+2348182791196",
            "relationship": "Employer",
            "created_at": "2022-01-26T03:08:42.580573Z",
            "updated_at": "0001-01-01T00:00:00Z"
        },
        {
            "id": 65,
            "user_id": 1,
            "org_id": 1,
            "loan_request_id": 1,
            "firstname": "Sure",
            "lastname": "Guy",
            "email": "sure.guy@gmail.com",
            "phone": "+2348182791196",
            "relationship": "Employer",
            "created_at": "2022-02-04T13:40:35.737743Z",
            "updated_at": "0001-01-01T00:00:00Z"
        },
        {
            "id": 66,
            "user_id": 1,
            "org_id": 1,
            "loan_request_id": 1,
            "firstname": "Sure",
            "lastname": "Man",
            "email": "sure.man@gmail.com",
            "phone": "+2348182791196",
            "relationship": "Employer",
            "created_at": "2022-02-04T13:40:38.506125Z",
            "updated_at": "0001-01-01T00:00:00Z"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Add Employment Information

## Add Employment Information&#x20;

<mark style="color:green;">`POST`</mark> `https://configure-abierta-test.herokuapp.com/api/v1/loan_request/{ID}/employment`

Adds employment information to a loan request

#### Path Parameters

| Name                                 | Type   | Description            |
| ------------------------------------ | ------ | ---------------------- |
| ID<mark style="color:red;">\*</mark> | String | ID of the loan request |

#### Query Parameters

| Name                                         | Type   | Description                     |
| -------------------------------------------- | ------ | ------------------------------- |
| product-id<mark style="color:red;">\*</mark> | String | Product ID for the loan request |

#### Headers

| Name                                            | Type   | Description           |
| ----------------------------------------------- | ------ | --------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer `YOUR_API_KEY` |

#### Request Body

| Name                                               | Type   | Description                        |
| -------------------------------------------------- | ------ | ---------------------------------- |
| status<mark style="color:red;">\*</mark>           | String | Current employment status          |
| company\_name<mark style="color:red;">\*</mark>    | String | Name of the company                |
| company\_address<mark style="color:red;">\*</mark> | String | Address of the company             |
| position<mark style="color:red;">\*</mark>         | String | Position held at company           |
| salary<mark style="color:red;">\*</mark>           | Int    |                                    |
| manager<mark style="color:red;">\*</mark>          | String | Borrower's manager name at company |
| manager\_phone<mark style="color:red;">\*</mark>   | String | Manager's phone number             |
| manager\_email<mark style="color:red;">\*</mark>   | String | Manager's email address            |

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

```javascript
{
    "status": "success",
    "message": "Employment Information Saved",
    "data": {
        "id": 106,
        "user_id": 1,
        "loan_request_id": 224,
        "status": "employed",
        "company_name": "Evolve Credit",
        "company_address": "18 Akin Leigh Cresent, Lekki Ph 1",
        "position": "Chief Technology Officer",
        "salary": 100000,
        "manager": "Daniel Osineye",
        "manager_phone": "08182791196",
        "manager_email": "d@evolvecredit.co",
        "has_custom_fields": false,
        "custom_fields": [
            {
                "label": "",
                "field": "",
                "data_type": "",
                "string_value": "",
                "number_value": 0,
                "boolean_value": false,
                "is_money": false,
                "is_custom": true,
                "created_at": "0001-01-01T00:00:00Z",
                "updated_at": "0001-01-01T00:00:00Z"
            },
            {
                "label": "",
                "field": "",
                "data_type": "",
                "string_value": "",
                "number_value": 0,
                "boolean_value": false,
                "is_money": false,
                "is_custom": true,
                "created_at": "0001-01-01T00:00:00Z",
                "updated_at": "0001-01-01T00:00:00Z"
            }
        ],
        "updated_at": "0001-01-01T00:00:00Z",
        "created_at": "2022-02-04T14:38:52.573521Z"
    }
}
```

{% endtab %}

{% tab title="500: Internal Server Error Employment Information Already Exists" %}

```javascript
{
    "status": "error",
    "message": "Employment Information Entry Added: You can only update it."
}
```

{% endtab %}
{% endtabs %}

## Get Employment Information

## Gets Employment Information

<mark style="color:blue;">`GET`</mark> `https://configure-abierta-test.herokuapp.com`

#### Path Parameters

| Name                                 | Type   | Description            |
| ------------------------------------ | ------ | ---------------------- |
| ID<mark style="color:red;">\*</mark> | String | ID of the loan request |

#### Query Parameters

| Name                                         | Type   | Description                    |
| -------------------------------------------- | ------ | ------------------------------ |
| product-id<mark style="color:red;">\*</mark> | String | Product ID of the loan request |

#### Headers

| Name                                            | Type   | Description           |
| ----------------------------------------------- | ------ | --------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer `YOUR_API_KEY` |

{% tabs %}
{% tab title="200: OK Successfully fetched employment Information" %}

```javascript
{
    "status": "success",
    "message": "Employment Information Retrieved",
    "data": {
        "id": 9,
        "user_id": 1,
        "loan_request_id": 1,
        "status": "employed",
        "company_name": "Evolve Credit",
        "company_address": "Rhodes Box, Lekki",
        "position": "CTO",
        "salary": 100000,
        "manager": "Daniel Osineye",
        "manager_phone": "08182791196",
        "manager_email": "d@evolvecredit.co",
        "has_custom_fields": false,
        "custom_fields": null,
        "updated_at": "0001-01-01T00:00:00Z",
        "created_at": "2021-09-24T08:28:03.423013Z"
    }
}
```

{% endtab %}
{% endtabs %}
