> For the complete documentation index, see [llms.txt](https://midatechnologies.gitbook.io/mida-developer-portal/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://midatechnologies.gitbook.io/mida-developer-portal/midacollect/create-loan.md).

# Create loan

To use MidaCollect, you start by creating a loan record.

#### Field description

<table><thead><tr><th width="49">#</th><th width="186">Field </th><th width="340.3671875">Description</th><th width="87.0703125">Type</th><th width="91.76171875" data-type="checkbox">Optional?</th></tr></thead><tbody><tr><td>1</td><td>loanAccountNumber</td><td>Unique loan account identifier from lenders system</td><td>string</td><td>false</td></tr><tr><td>2</td><td>loanAmount</td><td>Total value of the loan in minor</td><td>string</td><td>false</td></tr><tr><td>3</td><td>email</td><td>Lender's client's email</td><td>string</td><td>false</td></tr><tr><td>4</td><td>isNewLoan</td><td>true if loan is a new loan</td><td>boolean</td><td>false</td></tr><tr><td>5</td><td>loanType</td><td>Loan to salary earners ("pl") or loan to non-salary earners, self-employed or businesses ("sel") and corperate("corp")</td><td>enum</td><td>false</td></tr><tr><td>6</td><td>customer</td><td>Lenders client's details</td><td>object</td><td>false</td></tr><tr><td>7</td><td>address</td><td>Lenders client's address details</td><td>object</td><td>false</td></tr><tr><td>8</td><td>nok</td><td>Lenders client's next of kin details</td><td>object</td><td>true</td></tr><tr><td>9</td><td>schedule</td><td>Loan schedule</td><td>array</td><td>false</td></tr><tr><td>10</td><td>directors</td><td>Loan directors</td><td>array</td><td>true</td></tr><tr><td>11</td><td>managementTeam</td><td>Loan management team</td><td>array</td><td>true</td></tr><tr><td>12</td><td>employer</td><td>Employer information of the loan</td><td>object</td><td>true</td></tr><tr><td>13</td><td>isSignedMandate</td><td>Automatically create signed repayment mandate after loan creation</td><td>boolean</td><td>true</td></tr><tr><td>14</td><td>signature</td><td>Base64-encoded signature image (Required if isSignedMandate is true)</td><td>string</td><td>true</td></tr><tr><td>15</td><td>accountNumber</td><td>Bank account number (Required if isSignedMandate is true or if loanType is "sel" or "corp")</td><td>string</td><td>true</td></tr><tr><td>16</td><td>bankCode</td><td>Bank code (Required if isSignedMandate is true or if loanType is "sel" or "corp")</td><td>string</td><td>true</td></tr></tbody></table>

#### Schedule

<table><thead><tr><th width="80">#</th><th width="141">Field</th><th width="315">Description</th><th>Type</th><th data-type="checkbox">Optional</th></tr></thead><tbody><tr><td>1</td><td>dueDate</td><td>Schedule repayment date</td><td>string</td><td>false</td></tr><tr><td>2</td><td>amount</td><td>Total amount due on the schedule (major)</td><td>string</td><td>false</td></tr><tr><td>3</td><td>principal</td><td>Principal component of the schedule  (major)</td><td>string</td><td>true</td></tr><tr><td>4</td><td>interest</td><td>Interest component of the schedule (major)</td><td>string</td><td>true</td></tr><tr><td>5</td><td>fees</td><td>Fees component of the schedule (major)</td><td>string</td><td>true</td></tr><tr><td>6</td><td>status</td><td>Collection status of the schedule ("pending","paid","partially_paid")</td><td>string</td><td>false</td></tr></tbody></table>

#### Director's object (For LoanType "corp")

<table><thead><tr><th width="74">#</th><th width="179">Field</th><th>Description</th><th>Type</th><th width="106" data-type="checkbox">Optional</th></tr></thead><tbody><tr><td>1</td><td>name</td><td>Director's Name</td><td>string</td><td>false</td></tr><tr><td>2</td><td>phoneNumber</td><td>Director's phone number</td><td>string</td><td>false</td></tr><tr><td>3</td><td>email</td><td>Director's Email</td><td>string</td><td>false</td></tr><tr><td>4</td><td>documents</td><td>Director's documents</td><td>array</td><td>true</td></tr></tbody></table>

#### Management Team's Object (For LoanType "corp")

<table><thead><tr><th width="70">#</th><th>Field</th><th width="241">Description</th><th>Type</th><th width="106" data-type="checkbox">Optional</th></tr></thead><tbody><tr><td>1</td><td>name</td><td>Management team's name</td><td>string</td><td>false</td></tr><tr><td>2</td><td>phoneNumber</td><td>Management team's phone number</td><td>string</td><td>false</td></tr><tr><td>3</td><td>email</td><td>Management team's email</td><td>string</td><td>false</td></tr><tr><td>4</td><td>title</td><td>Management team's title</td><td>string</td><td>false</td></tr><tr><td>5</td><td>workEmail</td><td>Management team's email</td><td>string</td><td>false</td></tr><tr><td>6</td><td>workPhoneNumber</td><td>Management team's work phone number</td><td>string</td><td>false</td></tr><tr><td>7</td><td>state</td><td>Management team's state<br>(Abia, Abuja, Adamawa, Akwa Ibom, Anambra, Bauchi, Bayelsa, Benue, Borno, Cross River, Delta, Ebonyi, Edo, Ekiti, Enugu, Gombe, Imo, Jigawa, Kaduna, Kano, Katsina, Kebbi, Kogi, Kwara, Lagos, Nasarawa, Niger, Ogun, Ondo, Osun, Oyo, Plateau, Rivers, Sokoto, Taraba, Yobe, Zamfara)</td><td>enum</td><td>false</td></tr><tr><td>8</td><td>address</td><td>Management team's address</td><td>string</td><td>false</td></tr><tr><td>9</td><td>lga</td><td>Management team's lga</td><td>string</td><td>false</td></tr><tr><td>10</td><td>documents</td><td>Management team's documents</td><td>array</td><td>true</td></tr></tbody></table>

#### Document Object

<table><thead><tr><th width="80">#</th><th>Field</th><th>Description</th><th>Type</th><th data-type="checkbox">Optional</th></tr></thead><tbody><tr><td>1</td><td>name</td><td>Document name</td><td>string</td><td>false</td></tr><tr><td>2</td><td>url</td><td>Document url (A documents needs to be uploaded)</td><td>string</td><td>false</td></tr></tbody></table>

#### Upload  form-data

<table><thead><tr><th width="73.4444580078125"></th><th>Field</th><th>Description</th><th>Type</th><th data-type="checkbox">Optional</th></tr></thead><tbody><tr><td>1</td><td>file</td><td>Select file</td><td>file</td><td>false</td></tr></tbody></table>

#### Customer Object

<table><thead><tr><th width="60">#</th><th width="186">Field </th><th width="288.62109375">Description</th><th width="118.67578125">Type</th><th width="90.08203125" data-type="checkbox">Optional?</th></tr></thead><tbody><tr><td>1</td><td>fullname</td><td>Lender's client's fullname</td><td>string</td><td>false</td></tr><tr><td>2</td><td>BVN</td><td>Lender's client's BVN</td><td>string</td><td>true</td></tr><tr><td>3</td><td>Sex</td><td>Lender's client's Sex</td><td>enum</td><td>true</td></tr><tr><td>4</td><td>phoneNumber</td><td>Lender's client's Phone Number</td><td>string</td><td>false</td></tr><tr><td>5</td><td>DOB</td><td>Lender's date of birth</td><td>string</td><td>false</td></tr></tbody></table>

#### Address Object

<table><thead><tr><th width="60">#</th><th width="134.3125">Field </th><th width="329.609375">Description</th><th>Type</th><th width="90.69140625" data-type="checkbox">Optional?</th></tr></thead><tbody><tr><td>1</td><td>address</td><td>Lender's client's full address</td><td>string</td><td>false</td></tr><tr><td>2</td><td>state</td><td>Lender's client's state of residence<br>(Abia, Abuja, Adamawa, Akwa Ibom, Anambra, Bauchi, Bayelsa, Benue, Borno, Cross River, Delta, Ebonyi, Edo, Ekiti, Enugu, Gombe, Imo, Jigawa, Kaduna, Kano, Katsina, Kebbi, Kogi, Kwara, Lagos, Nasarawa, Niger, Ogun, Ondo, Osun, Oyo, Plateau, Rivers, Sokoto, Taraba, Yobe, Zamfara)</td><td>enum</td><td>true</td></tr><tr><td>3</td><td>lga</td><td>Lender's client's lga of residence</td><td>string</td><td>true</td></tr></tbody></table>

#### **NOK Object**

<table><thead><tr><th width="42.3515625">#</th><th width="169.29296875">Field </th><th width="317.1875">Description</th><th>Type</th><th width="88.74609375" data-type="checkbox">Optional?</th></tr></thead><tbody><tr><td>1</td><td>nokFullname</td><td>Client's next of kin's fullname</td><td>string</td><td>false</td></tr><tr><td>2</td><td>nokBVN</td><td>Client's next of kin's BVN</td><td>string</td><td>true</td></tr><tr><td>3</td><td>nokPhoneNumber</td><td>Client's next of kin's Phone Number</td><td>string</td><td>true</td></tr><tr><td>4</td><td>nokAddress</td><td>Client's next of kin's full address</td><td>string</td><td>true</td></tr><tr><td>5</td><td>nokState</td><td>Client's next of kin's state of residence<br>(Abia, Abuja, Adamawa, Akwa Ibom, Anambra, Bauchi, Bayelsa, Benue, Borno, Cross River, Delta, Ebonyi, Edo, Ekiti, Enugu, Gombe, Imo, Jigawa, Kaduna, Kano, Katsina, Kebbi, Kogi, Kwara, Lagos, Nasarawa, Niger, Ogun, Ondo, Osun, Oyo, Plateau, Rivers, Sokoto, Taraba, Yobe, Zamfara)</td><td>enum</td><td>true</td></tr><tr><td>6</td><td>nokLga</td><td>Client's next of kin's lga of residence</td><td>string</td><td>true</td></tr></tbody></table>

#### Account Object

<table><thead><tr><th width="46.3984375">#</th><th width="149.46875">Field </th><th width="342.89453125">Description</th><th width="118.59375">Type</th><th width="86.859375" data-type="checkbox">Optional?</th></tr></thead><tbody><tr><td>1</td><td>bankName</td><td>Name of bank</td><td>string</td><td>false</td></tr><tr><td>2</td><td>accountNumber</td><td>Clients account number</td><td>string</td><td>false</td></tr><tr><td>3</td><td>accountName</td><td>Name associated with the account number</td><td>string</td><td>false</td></tr></tbody></table>

#### Employer Object

<table><thead><tr><th width="46.3984375">#</th><th width="149.46875">Field </th><th width="342.89453125">Description</th><th width="118.59375">Type</th><th width="86.859375" data-type="checkbox">Optional?</th></tr></thead><tbody><tr><td>1</td><td>name</td><td>Name of employer</td><td>string</td><td>false</td></tr><tr><td>2</td><td>address</td><td>Address of employer</td><td>string</td><td>true</td></tr><tr><td>3</td><td>state</td><td>Employer state</td><td>string</td><td>true</td></tr><tr><td>4</td><td>lga</td><td>Employer lga</td><td>string</td><td>true</td></tr><tr><td>5</td><td>phoneNumber</td><td>Empoyer phone number</td><td>string</td><td>true</td></tr></tbody></table>

#### **Security**

The API security is a bearer token using your organisation's API Key obtained [here](https://app.getmida.com/settings)&#x20;

#### **API url**

{baseUrl}/external/loan

#### Sample Request:

```json
{
 "loanAccountNumber":"423456789",
 "loanAmount": "50000",
 "email": "daveomo@gmail.com",
 "isNewLoan": false,
 "loanType": "pl",
 "isSignedMandate": true,
 "accountNumber": "8378883748",
 "bankCode": "000021",
 "signature": "/9j/4AAQSkZJRgABAQAAAQ2Q==",
 "customer":{
    "fullname": "Dave Omo",
    "BVN": "2323232322",
    "sex": "male",
    "phoneNumber": "08055309113,08055623778",
    "DOB": "1990-01-01"
 },
 "address": {
    "address" : "2a stong iron steet surulere",
    "state" : "lagos",
    "lga" : "lagos mainland"
 },
 "nok": {
    "nokFullname" : "Jane Omo",
    "nokBVN" : "2390857192",
    "nokPhoneNumber" : "0987768899",
    "nokAddress" : "15 maryland avenue, off thomson street.",
    "nokState" : "lagos",
    "nokLga" : "ikeja"
 },
  "directors":[
    {
       "name":"Olajumoke",
       "phoneNumber":"081336887060",
       "email":"korede5@synth.com",
       "documents":[
         {
            "name":"Bank statement.pdf",
            "url":"https://storage.googleapis.com/8062287c-7f7d-491d-a62d-6c60d16348f5"
         }
       ]     
    }
 ],
 "managementTeam":[
   {
       "name":"Olajumoke",
       "phoneNumber":"081336887060",
       "email":"korede5@synth.com",
        "title":"CEO",
        "workEmail":"korede@geysnth.com",
        "workPhoneNumber":"081275757392",
        "state":"Lagos",
        "address":"Lekki phase one",
        "lga":"Eti Osa",
       "documents":[
         {
            "name":"Bank statement.pdf",
            "url":"https://storage.googleapis.com/8065697c-7f7d-491d-a62d-6c60d16348f5"
         }
        ]     
   }
 ],
 "account": {
    "bankName" : "Providus MFB",
    "accountNumber" : "2390857192",
    "accountName" : "John Doe",
 },
  "employer": {
    "name" : "Mida technologies inc",
    "adddress" : "14 Jone doe street",
    "state" : "Lagos",
    "lga" : "Ikeja",
    "phoneNumber" : "080123456789"
 },
 "schedule":[
   {
      "dueDate": "2023-08-01",
      "amount": "15000",
      "principal": "10000",
      "interest": "4000",
      "fees": "1000",
      "status": "pending"
   },{
      "dueDate": "2023-09-01",
      "amount": "15000",
      "principal": "10000",
      "interest": "4000",
      "fees": "1000",
      "status": "pending"
   },{
      "dueDate": "2023-10-01",
      "amount": "15000",
      "principal": "10000",
      "interest": "4000",
      "fees": "1000",
      "status": "pending"
   },{
      "dueDate": "2023-11-01",
      "amount": "15000",
      "principal": "10000",
      "interest": "4000",
      "fees": "1000",
      "status": "pending"
   }
  ]
}
```
