> For the complete documentation index, see [llms.txt](https://docs.advancly.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.advancly.com/aggregator-investment-api-integration/aggregator-investment-api-for-metal.md).

# Aggregator Investment

## Introduction

See Aggregator Investment API endpoints below.

## Create a new Customer (Corporate)

<mark style="color:green;">`POST`</mark> `{{BaseUrl}}api/v1/account/aggregator_signup_customer`

Endpoint to onboard a new corporate customer.

#### Request Body

| Name                                               | Type   | Description                                                                                                                                                                         |
| -------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| first\_name<mark style="color:red;">\*</mark>      | string | customer first name                                                                                                                                                                 |
| last\_name<mark style="color:red;">\*</mark>       | string | customer last name                                                                                                                                                                  |
| phone\_number<mark style="color:red;">\*</mark>    | string | customer phone number                                                                                                                                                               |
| email<mark style="color:red;">\*</mark>            | string | email address                                                                                                                                                                       |
| biz\_name<mark style="color:red;">\*</mark>        | string | Business name                                                                                                                                                                       |
| gender                                             | string | gender                                                                                                                                                                              |
| funder\_type\_id<mark style="color:red;">\*</mark> | number | Funder type id for corporate (2)                                                                                                                                                    |
| country\_code<mark style="color:red;">\*</mark>    | string | Country code                                                                                                                                                                        |
| bank\_id                                           | string | Bank Id                                                                                                                                                                             |
| bank\_account\_number                              | string | Bank Account Number                                                                                                                                                                 |
| bank\_account\_name                                | string | Bank Account Name                                                                                                                                                                   |
| bank\_name                                         | string | Bank Name                                                                                                                                                                           |
| routing\_number                                    | string | Routing Number                                                                                                                                                                      |
| swift\_code                                        | string | Swift Code                                                                                                                                                                          |
| biz\_email                                         | string | Business Email                                                                                                                                                                      |
| Address                                            | string | Address                                                                                                                                                                             |
| business\_unique\_identifier                       | string | A unique identification number for the business                                                                                                                                     |
| postal\_code                                       | string | Area Postal Code                                                                                                                                                                    |
| City<mark style="color:red;">\*</mark>             | string | City                                                                                                                                                                                |
| next\_of\_kin\_first\_name                         | string | First name of Next of Kin                                                                                                                                                           |
| next\_of\_kin\_last\_name                          | string | Last name of Next of Kin                                                                                                                                                            |
| next\_of\_kin\_email                               | string | Email of Next of Kin                                                                                                                                                                |
| next\_of\_kin\_phone\_number                       | string | Phone number of Next of Kin                                                                                                                                                         |
| next\_of\_kin\_gender                              | string | Gender of Next of Kin                                                                                                                                                               |
| relationship\_with\_next\_kin                      | string | Customer relationship with Next of Kin                                                                                                                                              |
| next\_of\_kin\_dial\_code                          | string | Next of Kin dial code                                                                                                                                                               |
| next\_of\_kin\_street                              | string | Next of Kin street                                                                                                                                                                  |
| next\_of\_kin\_city                                | string | Next of Kin City                                                                                                                                                                    |
| next\_of\_kin\_state                               | string | Next of kin state                                                                                                                                                                   |
| next\_of\_kin\_country                             | string | Next of kin Country                                                                                                                                                                 |
| effective\_date                                    | string | Effective date of customer account                                                                                                                                                  |
| funder\_documents                                  | Array  | <p>Array of documents to be uploaded during signup eg \[{<br>   "document\_type\_code": "",<br>   "base64\_file\_string": "",</p><p>   "filename\_with\_extension": "png"<br>}]</p> |

{% tabs %}
{% tab title="201: Created " %}

```javascript
{
    //response
}
```

{% endtab %}
{% endtabs %}

## Create a new Customer (Individual)

<mark style="color:green;">`POST`</mark> `{{BaseUrl}}api/v1/account/aggregator_signup_customer`

Endpoint to onboard a new individual customer.

#### Query Parameters

| Name                                               | Type   | Description                                                                                                                                                                               |
| -------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| country\_code                                      | string | Customer's country code eg: NG, KE                                                                                                                                                        |
| first\_name<mark style="color:red;">\*</mark>      | string | Customer first name                                                                                                                                                                       |
| last\_name<mark style="color:red;">\*</mark>       | string | Customer last name                                                                                                                                                                        |
| phone\_number<mark style="color:red;">\*</mark>    | string | Customer phone number                                                                                                                                                                     |
| email<mark style="color:red;">\*</mark>            | string | Customer email                                                                                                                                                                            |
| gender<mark style="color:red;">\*</mark>           | string | Customer gender                                                                                                                                                                           |
| funder\_type\_id<mark style="color:red;">\*</mark> | number | Funder type id for individual customer (1)                                                                                                                                                |
| bank\_id                                           | number | Bank Id                                                                                                                                                                                   |
| bank\_account\_number                              | string | Customer's  Bank Account Number                                                                                                                                                           |
| bank\_account\_name                                | string | Customer's  Bank Account Name                                                                                                                                                             |
| bank\_name                                         | string | Bank Name                                                                                                                                                                                 |
| routing\_number                                    | string | Routing number for foreign banks                                                                                                                                                          |
| swift\_code                                        | string | Swift Code                                                                                                                                                                                |
| address                                            | string | Address of Customer                                                                                                                                                                       |
| customer\_unique\_identifier                       | string | Customer's unique identifier                                                                                                                                                              |
| postal\_code                                       | string | Postal Code                                                                                                                                                                               |
| city                                               | string | City of residence                                                                                                                                                                         |
| next\_of\_kin\_first\_name                         | string | First name of customer's next of kin                                                                                                                                                      |
| next\_of\_kin\_last\_name                          | string | Last name of customer's next of kin                                                                                                                                                       |
| next\_of\_kin\_email                               | string | Email of customer's next of kin                                                                                                                                                           |
| next\_of\_kin\_phone\_number                       | string | Phone number of customer's next of kin                                                                                                                                                    |
| next\_of\_kin\_gender                              | string | Gender of customer's next of kin                                                                                                                                                          |
| relationhip\_with\_next\_kin                       | string | Customer's relationship with next of kin                                                                                                                                                  |
| next\_of\_kin\_dial\_code                          | string | Dial  code of customer's next of kin                                                                                                                                                      |
| next\_of\_kin\_street                              | string | Street of customer's next of kin                                                                                                                                                          |
| next\_of\_kin\_city                                | string | City of customer's next of kin                                                                                                                                                            |
| next\_of\_kin\_state                               | string | State of customer's next of kin                                                                                                                                                           |
| next\_of\_kin\_country                             | string | Country of customer's next of kin                                                                                                                                                         |
| effective\_date                                    | string | Effective date of customer's account                                                                                                                                                      |
| funder\_documents                                  | Array  | <p>Array of documents to be uploaded during signup eg \[{<br>   "document\_type\_code": "",<br>   "base64\_file\_string": "",</p><p>   "filename\_with\_extension": "alexa.png"<br>}]</p> |

{% tabs %}
{% tab title="201: Created " %}

```
{
    "data": {
            "id": number,
            "name": " string",
            "slug": "string",
            "code": "string",
            "longcode": "string",
            "vigipay_bank_id": "string",
            "country_code": "string"
        },
    "message": "Success",
    "status": true,
    "status_code": 201
}
```

{% endtab %}
{% endtabs %}

## Get Customers

<mark style="color:blue;">`GET`</mark> `{{BaseUrl}}/api/v1/account/query_funder`

Endpoint to get all customers.

#### Query Parameters

| Name         | Type   | Description        |
| ------------ | ------ | ------------------ |
| FunderType   | number | Funder Type id     |
| from\_date   | Date   | Start date         |
| to\_date     | Date   | End Date           |
| FunderName   | string | Funder name        |
| FunderId     | number | Funder Id          |
| AggregatorId | number | Aggregator Id      |
| Page         | number | Page to fetch      |
| PageSize     | number | Page size to fetch |

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

```
{
  "data": [
    //customer
  ],
  "message": "Success",
  "status": true,
  "status_code": 200
}
```

{% endtab %}
{% endtabs %}

## Get Customer Wallet Balance

<mark style="color:blue;">`GET`</mark> `{{BaseUrl}}/api/v1/account/get_funder_wallet_balance`

Get customer wallet balance

#### Query Parameters

| Name            | Type   | Description                    |
| --------------- | ------ | ------------------------------ |
| savingsWalletId | number | Wallet Id of a savings account |
| funderId        | number | Funder Id                      |

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

```
{
    "data": [
      {
        //wallet 
      },
      "message": "Success",
      "status": true,
      "status_code": 200
  ]
}
```

{% endtab %}
{% endtabs %}

## Get Customer Wallet Transactions

<mark style="color:blue;">`GET`</mark> `{{BaseUrl}}/api/v1/account/get_funder_wallet_transactions`

#### Query Parameters

| Name            | Type   | Description                                |
| --------------- | ------ | ------------------------------------------ |
| savingsWalletId | number | Wallet Id of the customer's saving account |
| funderId        | number | Customer's Id                              |
| page            | number | Page to return                             |
| pageSize        | number | Page size to return                        |

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

```
{
    "data": [
      {
        //wallet Transaction
      },
      "message": "Success",
      "status": true,
      "status_code": 200
  ]
}
```

{% endtab %}
{% endtabs %}

## Retrieve investment products per aggregator

<mark style="color:blue;">`GET`</mark> `{{BaseUrl}}/api/v1/eco/aggregator/investment_products`

Endpoint to fetch investment products by aggregator

#### Query Parameters

| Name         | Type   | Description   |
| ------------ | ------ | ------------- |
| aggregatorId | number | aggregator id |

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

```
{
  "data": {
    //investment product
    },
  "message": "Success",
  "status": true,
  "status_code": 200
}
```

{% endtab %}
{% endtabs %}

## Get investor's document types

<mark style="color:blue;">`GET`</mark> `{{BaseUrl}}/api/v1/document/investor_document_types`

Endpoint to get investor's document types

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

```javascript
{
  "data": [
   {
    //investment document types
    }
  ],
  "message": "Success",
  "status": true,
  "status_code": 200
}
```

{% endtab %}
{% endtabs %}

## Get genders by country

<mark style="color:blue;">`GET`</mark> `{{BaseUrl}}/api/v1/account/get_genders`

This endpoints get genders supported in a country

#### Query Parameters

| Name        | Type   | Description                |
| ----------- | ------ | -------------------------- |
| countryCode | string | Country Code eg NG, KE etc |

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

```javascript
{
  "data": [
   {
    //genders
    }
  ],
  "message": "Success",
  "status": true,
  "status_code": 200
}
```

{% endtab %}
{% endtabs %}

## Create a customer's investment

<mark style="color:green;">`POST`</mark> `{{baseUrl}}/api/v1/account/aggregator/create_customer_investment`

#### Request Body

| Name                                                      | Type   | Description                                   |
| --------------------------------------------------------- | ------ | --------------------------------------------- |
| principal\_amount<mark style="color:red;">\*</mark>       | number | Principal amount                              |
| tenure                                                    | number | Investment tenure eg  30, 90 etc              |
| currency<mark style="color:red;">\*</mark>                | string | Currency of the investment eg NGN, USD        |
| base64\_file\_string                                      | string | A base 64 image string                        |
| filename\_with\_extension                                 | string | File name with extension                      |
| interest\_repayment\_type                                 | string | Investment interest repayment type eg Monthly |
| payment\_gateway\_reference                               | string | A reference to a payment gateway              |
| funder\_id<mark style="color:red;">\*</mark>              | number | Funder id                                     |
| investment\_product\_id<mark style="color:red;">\*</mark> | number | Id of the investment product                  |

{% tabs %}
{% tab title="201: Created " %}

```javascript
{
    "data": [
        {
            //data
        },
    "message": "Success",
    "status": true,
    "status_code": 201
}
```

{% endtab %}
{% endtabs %}

## Get aggregator's investments

<mark style="color:blue;">`GET`</mark> `{{baseUrl}}/api/v1/account/get_aggregator_investments`

#### Query Parameters

| Name                                           | Type   | Description     |
| ---------------------------------------------- | ------ | --------------- |
| aggregatorId<mark style="color:red;">\*</mark> | number | Aggregator's Id |

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

```javascript
{
  "data": [
   {
    //investments
    }
  ],
  "message": "Success",
  "status": true,
  "status_code": 200
}
```

{% endtab %}
{% endtabs %}

## Get a Customer's investments

<mark style="color:blue;">`GET`</mark> `{{baseUrl}}/api/v1/account/get_funder_investments`

#### Query Parameters

| Name                                                  | Type   | Description           |
| ----------------------------------------------------- | ------ | --------------------- |
| funderId<mark style="color:red;">\*</mark>            | number | Funder Id             |
| walletAccountId<mark style="color:red;">\*</mark>     | number | Customer's wallet Id  |
| investmentProductId<mark style="color:red;">\*</mark> | number | Investment product id |

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

```javascript
{
  "data": {
    //investments
    },
  "message": "Success",
  "status": true,
  "status_code": 200
}
```

{% endtab %}
{% endtabs %}

## Aggregator investment interest calculator.

<mark style="color:blue;">`GET`</mark> `{{baseUrl}}/api/v1/account/aggregator_investment_interest_calculator`

#### Query Parameters

| Name                                                     | Type     | Description               |
| -------------------------------------------------------- | -------- | ------------------------- |
| PrincipalAmount<mark style="color:red;">\*</mark>        | number   | Principal amount          |
| Tenure<mark style="color:red;">\*</mark>                 | number   | Investment tenure         |
| StartDate<mark style="color:red;">\*</mark>              | dateTime | Investment start date     |
| InterestRepaymentType<mark style="color:red;">\*</mark>  | string   | Investment repayment type |
| InvestmentProductId<mark style="color:red;">\*</mark>    | number   | Investment product Id     |
| InvestmentCurrencyType<mark style="color:red;">\*</mark> | string   | Investment currency type  |

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

```javascript
{
  "data": {
    //investment interest
    },
  "message": "Success",
  "status": true,
  "status_code": 200
}
```

{% endtab %}
{% endtabs %}

## Get funder's investment

<mark style="color:blue;">`GET`</mark> `{{baseUrl}} ​/api​/v1​/account​/get_funder_investment_by_id`

#### Query Parameters

| Name               | Type   | Description              |
| ------------------ | ------ | ------------------------ |
| funderInvestmentId | number | Customer's investment Id |

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

```javascript
{
  "data": {
    //investment
    },
  "message": "Success",
  "status": true,
  "status_code": 200
}
```

{% endtab %}
{% endtabs %}

## Withdraw aggregator funds

<mark style="color:green;">`POST`</mark> `{{baseUrl}}/api/v1/account/aggregator_withdraw_funds`

This endpoint enables an aggregator to withdraw fund.

#### Request Body

| Name                                         | Type   | Description                  |
| -------------------------------------------- | ------ | ---------------------------- |
| wallet\_id<mark style="color:red;">\*</mark> | number | Wallet Id                    |
| funder\_id<mark style="color:red;">\*</mark> | number | Funder Id                    |
| amount<mark style="color:red;">\*</mark>     | number | Amount to withdraw           |
| narration                                    | string | Narration on the withdrawals |

{% tabs %}
{% tab title="201: Created " %}

```javascript
{
    "data": {
            //data
        },
    "message": "Success",
    "status": true,
    "status_code": 201
}
```

{% endtab %}
{% endtabs %}
