# Harvest Finance

### /getbalance

{% hint style="warning" %}
For **/getbalance**, the user can either pass the tokenAddress or the vaultAddress and poolAddress along with the required parameters.
{% endhint %}

Get balance of the user in a given Vault or Pool&#x20;

<mark style="color:blue;">`GET`</mark> `https://api.expand.network/yieldaggregator/getbalance`

#### Query Parameters

| Name                                                | Type   | Description                                                                       |
| --------------------------------------------------- | ------ | --------------------------------------------------------------------------------- |
| rpc                                                 | String | Remote procedural call URL                                                        |
| address<mark style="color:red;">\*</mark>           | String | Public Address of the owner.                                                      |
| tokenAddress                                        | String | The address of the token.                                                         |
| poolAddress                                         | String | The address of the pool.                                                          |
| yieldAggregatorId<mark style="color:red;">\*</mark> | String | Refer to the [Yield Aggregator ID](/ids/yield-aggregator-id.md) page for details. |
| vaultAddress                                        | String | The address of the vault.                                                         |

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

#### With tokenAddress:

```
https://api.expand.network/yieldaggregator/getbalance?address=0xC7565379C190014449eE83CF9FD7475206E59f9e&tokenAddress=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&yieldAggregatorId=5100
```

#### With vaultAddress and poolAddress:

```url
https://api.expand.network/yieldaggregator/getbalance?address=0xC7565379C190014449eE83CF9FD7475206E59f9e&vaultAddress=0xFE09e53A81Fe2808bc493ea64319109B5bAa573e&yieldAggregatorId=5100&poolAddress=0x3DA9D911301f8144bdF5c3c67886e5373DCdff8e
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "vaultBalance": "0",
        "poolBalance": "0"
    }
}
```

{% endtab %}
{% endtabs %}

### /getvaults

Get the number of the vaults along with the respective vault APY.

<mark style="color:blue;">`GET`</mark> `https://api.expand.network/yieldaggregator/getvaults`

#### Query Parameters

| Name                                                | Type   | Description                                                                       |
| --------------------------------------------------- | ------ | --------------------------------------------------------------------------------- |
| rpc                                                 | String | Remote procedural call URL                                                        |
| tokenAddress<mark style="color:red;">\*</mark>      | String | The address of the token.                                                         |
| yieldAggregatorId<mark style="color:red;">\*</mark> | String | Refer to the [Yield Aggregator ID](/ids/yield-aggregator-id.md) page for details. |

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

```url
https://api.expand.network/yieldaggregator/getvaults?tokenAddress=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&yieldAggregatorId=5100
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "tokenVaults": [
            {
                "vaultAddress": "0xFE09e53A81Fe2808bc493ea64319109B5bAa573e",
                "apy": "4.08",
                "poolAddress": "0x3DA9D911301f8144bdF5c3c67886e5373DCdff8e"
            }
        ]
    }
}
```

{% endtab %}
{% endtabs %}

### /depositvault

{% hint style="warning" %}
For **/depositvault**, the user can either pass the tokenAddress or the vaultAddress along with the required parameters.
{% endhint %}

Trigger the deposit transaction for the given vault.

<mark style="color:green;">`POST`</mark> `https://api.expand.network/yieldaggregator/depositvault`

#### Request Body

| Name                                                | Type   | Description                                                                       |
| --------------------------------------------------- | ------ | --------------------------------------------------------------------------------- |
| amount<mark style="color:red;">\*</mark>            | String | The amount of token to deposit.                                                   |
| tokenAddress                                        | String | The address of the token.                                                         |
| from<mark style="color:red;">\*</mark>              | String | Address of the sender of the token.                                               |
| gas                                                 | String | Maximum gas limit provided by the sender, for the transaction.                    |
| vaultAddress                                        | String | The address of the vault.                                                         |
| yieldAggregatorId<mark style="color:red;">\*</mark> | String | Refer to the [Yield Aggregator ID](/ids/yield-aggregator-id.md) page for details. |
| gasPriority                                         | String | low, medium, or high.                                                             |

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

#### With tokenAddress:&#x20;

```json
{ 
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "tokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
    "amount": "500000",
    "gas": "2307200",
    "yieldAggregatorId": "5100"
}
```

#### With vaultAddress:

```json
{
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "vaultAddress": "0xFE09e53A81Fe2808bc493ea64319109B5bAa573e",
    "amount": "500000",
    "gas": "2307200",
    "yieldAggregatorId": "5100"
}
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "chainId": "1",
        "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
        "to": "0xFE09e53A81Fe2808bc493ea64319109B5bAa573e",
        "value": "0",
        "gas": "2307200",
        "data": "0xb6b55f25000000000000000000000000000000000000000000000000000000000007a120",
        "referenceId": "d33bc36f30ff49e385388ba332f67594"
    }
}
```

{% endtab %}
{% endtabs %}

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

#### With gasPriority (medium)-

#### 1. With tokenAddress:

```json
{
    "from": "0xfAE7D9854995E28BEB1B1da864ee2A1E2EC17f07",
    "tokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
    "amount": "10000000",
    "gas": "2307200",
    "gasPriority":"medium",
    "yieldAggregatorId": "5100"
}
```

#### 2. With vaultAddress:

```json
{
    "from": "0xfAE7D9854995E28BEB1B1da864ee2A1E2EC17f07",
    "vaultAddress": "0xFE09e53A81Fe2808bc493ea64319109B5bAa573e",
    "amount": "500000",
    "gas": "2307200",
    "gasPriority":"medium",
    "yieldAggregatorId": "5100"
}
```

{% endtab %}

{% tab title="Sample Response" %}

#### With gasPriority-

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "chainId": "1",
        "from": "0xfAE7D9854995E28BEB1B1da864ee2A1E2EC17f07",
        "to": "0xFE09e53A81Fe2808bc493ea64319109B5bAa573e",
        "value": "0",
        "gas": "2307200",
        "data": "0xb6b55f250000000000000000000000000000000000000000000000000000000000989680",
        "gasPrice": "6690562274",
        "referenceId": "92a80144e7e649bab4815e0edb773cbb"
    }
}
```

{% endtab %}
{% endtabs %}

### /withdrawvault

{% hint style="warning" %}
For **/withdrawvault**, the user can either pass the tokenAddress or the vaultAddress along with the required parameters.
{% endhint %}

Trigger the withdraw transaction for the given vault.

<mark style="color:green;">`POST`</mark> `https://api.expand.network/yieldaggregator/withdrawvault`

#### Request Body

| Name                                                | Type   | Description                                                                       |
| --------------------------------------------------- | ------ | --------------------------------------------------------------------------------- |
| yieldAggregatorId<mark style="color:red;">\*</mark> | String | Refer to the [Yield Aggregator ID](/ids/yield-aggregator-id.md) page for details. |
| amount<mark style="color:red;">\*</mark>            | String | Amount to be withdrawn.                                                           |
| from<mark style="color:red;">\*</mark>              | String | Address of the withdrawer of the token.                                           |
| gas                                                 | String | Maximum gas limit provided by the sender, for the transaction.                    |
| tokenAddress                                        | String | The address of the the token.                                                     |
| vaultAddress                                        | String | The address of the vault.                                                         |
| gasPriority                                         | String | low, medium, or high.                                                             |

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

#### With tokenAddress:

```json
{
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "tokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
    "amount": "500000",
    "gas": "2307200",
    "yieldAggregatorId": "5100"
}
```

#### With vaultAddress:&#x20;

```json
{
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "amount": "4934226",
    "gas": "2307200",
    "vaultAddress": "0xFE09e53A81Fe2808bc493ea64319109B5bAa573e",
    "yieldAggregatorId": "5100"
}
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "chainId": "1",
        "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
        "to": "0xFE09e53A81Fe2808bc493ea64319109B5bAa573e",
        "value": "0",
        "gas": "2307200",
        "data": "0x2e1a7d4d000000000000000000000000000000000000000000000000000000000007a120",
        "referenceId": "7250fb68fbfa4411901e2a77b1e06974"
    }
}
```

{% endtab %}
{% endtabs %}

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

#### With gasPriority (medium)-

#### 1. With tokenAddress:

```json
{
    "from": "0xfAE7D9854995E28BEB1B1da864ee2A1E2EC17f07",
    "tokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
    "amount": "500000",
    "gas": "2307200",
    "gasPriority":"medium",
    "yieldAggregatorId": "5100"
}
```

#### 2. With vaultAddress:

```json
{
    "from": "0xfAE7D9854995E28BEB1B1da864ee2A1E2EC17f07",
    "vaultAddress": "0xFE09e53A81Fe2808bc493ea64319109B5bAa573e",
    "amount": "500000",
    "gas": "2307200",
    "gasPriority":"medium",
    "yieldAggregatorId": "5100"
}
```

{% endtab %}

{% tab title="Sample Response" %}

#### With gasPriority

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "chainId": "1",
        "from": "0xfAE7D9854995E28BEB1B1da864ee2A1E2EC17f07",
        "to": "0xFE09e53A81Fe2808bc493ea64319109B5bAa573e",
        "value": "0",
        "gas": "2307200",
        "data": "0x2e1a7d4d000000000000000000000000000000000000000000000000000000000007a120",
        "gasPrice": "6627449509",
        "referenceId": "c3f3f1465e344a36b88e4cf432bb07e8"
    }
}
```

{% endtab %}
{% endtabs %}

### /depositpool

{% hint style="warning" %}
For **/depositpool**, the user can either pass the tokenAddress or the poolAddress along with the required parameters.
{% endhint %}

Trigger the deposit transaction for the given pool.

<mark style="color:green;">`POST`</mark> `https://api.expand.network/yieldaggregator/depositpool`

#### Request Body

| Name                                                | Type   | Description                                                                       |
| --------------------------------------------------- | ------ | --------------------------------------------------------------------------------- |
| yieldAggregatorId<mark style="color:red;">\*</mark> | String | Refer to the [Yield Aggregator ID](/ids/yield-aggregator-id.md) page for details. |
| amount<mark style="color:red;">\*</mark>            | String | The amount of token to deposit.                                                   |
| from<mark style="color:red;">\*</mark>              | String | Address of the sender of the token.                                               |
| gas                                                 | String | Maximum gas limit provided by the sender, for the transaction.                    |
| tokenAddress                                        | String | The address of the token.                                                         |
| poolAddress                                         | String | The address of the pool.                                                          |
| gasPriority                                         | String | low, medium, or high.                                                             |

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

#### With tokenAddress:

```json
{
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "tokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
    "amount": "4934226",
    "gas": "2307200",
    "yieldAggregatorId": "5100"
}
```

#### With poolAddress:&#x20;

```json
{
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "poolAddress": "0x3DA9D911301f8144bdF5c3c67886e5373DCdff8e",
    "amount": "4934226",
    "gas": "2307200",
    "yieldAggregatorId": "5100"
}
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "chainId": "1",
        "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
        "to": "0x3DA9D911301f8144bdF5c3c67886e5373DCdff8e",
        "value": "0",
        "gas": "2307200",
        "data": "0xa694fc3a00000000000000000000000000000000000000000000000000000000004b4a52",
        "referenceId": "9fdce4b6184e442cbe52d0c3249c7657"
    }
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Sample Request" %}
**With gasPriority (low)**

#### 1. With tokenAddress:

```json
{
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "tokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
    "amount": "4934226",
    "gas": "230720",
    "gasPriority": "low",
    "yieldAggregatorId": "5100"
}
```

#### 2. With poolAddress:

```json
{
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "poolAddress": "0x3DA9D911301f8144bdF5c3c67886e5373DCdff8e",
    "amount": "4934226",
    "gas": "230720",
    "gasPriority": "low",
    "yieldAggregatorId": "5100"
}
```

{% endtab %}

{% tab title="Sample Response" %}
**With gasPriority (low):**&#x20;

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "chainId": "1",
        "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
        "to": "0x3DA9D911301f8144bdF5c3c67886e5373DCdff8e",
        "value": "0",
        "gas": "230720",
        "data": "0xa694fc3a00000000000000000000000000000000000000000000000000000000004b4a52",
        "gasPrice": "2212407039",
        "referenceId": "16319479f0fd4a8aa334abaa2752d983"
    }
}
```

{% endtab %}
{% endtabs %}

### /withdrawpool

{% hint style="warning" %}
For **/withdrawpool**, the user can either pass the tokenAddress or the poolAddress along with the required parameters.
{% endhint %}

Trigger the withdraw transaction for the given pool.

<mark style="color:green;">`POST`</mark> `https://api.expand.network/yieldaggregator/withdrawpool`

#### Request Body

| Name                                                | Type   | Description                                                                       |
| --------------------------------------------------- | ------ | --------------------------------------------------------------------------------- |
| yieldAggregatorId<mark style="color:red;">\*</mark> | String | Refer to the [Yield Aggregator ID](/ids/yield-aggregator-id.md) page for details. |
| amount<mark style="color:red;">\*</mark>            | String | Amount to be withdrawn.                                                           |
| from<mark style="color:red;">\*</mark>              | String | Address of the withdrawer of the token.                                           |
| gas                                                 | String | Maximum gas limit provided by the sender, for the transaction.                    |
| tokenAddress                                        | String | The address of the token.                                                         |
| poolAddress                                         | String | The address of the pool.                                                          |
| gasPriority                                         | String | low, medium, or high.                                                             |

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

#### With tokenAddress:&#x20;

```json
{
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "amount": "4934226",
    "gas": "2307200",
    "tokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
    "yieldAggregatorId": "5100"
}
```

#### With poolAddress:&#x20;

```json
{
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "poolAddress": "0x3DA9D911301f8144bdF5c3c67886e5373DCdff8e",
    "amount": "4934226",
    "gas": "2307200",
    "yieldAggregatorId": "5100"
}
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "chainId": "1",
        "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
        "to": "0x3DA9D911301f8144bdF5c3c67886e5373DCdff8e",
        "value": "0",
        "gas": "2307200",
        "data": "0x2e1a7d4d00000000000000000000000000000000000000000000000000000000004b4a52",
        "referenceId": "cb96c9dc2c9e4ba7804b037f1c799059"
    }
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Sample Request" %}
**With gasPriority (medium)**

#### 1. With tokenAddress:

```json
{
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "amount": "4934226",
    "gas": "230720",
    "gasPriority": "medium",
    "tokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
    "yieldAggregatorId": "5100"
}
```

#### 2. With poolAddress:

```json
{
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "amount": "4934226",
    "gas": "230720",
    "gasPriority": "medium",
    "poolAddress": "0x3DA9D911301f8144bdF5c3c67886e5373DCdff8e",
    "yieldAggregatorId": "5100"
}
```

{% endtab %}

{% tab title="Sample Response" %}
**With gasPriority (medium)**

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "chainId": "1",
        "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
        "to": "0x3DA9D911301f8144bdF5c3c67886e5373DCdff8e",
        "value": "0",
        "gas": "230720",
        "data": "0x2e1a7d4d00000000000000000000000000000000000000000000000000000000004b4a52",
        "gasPrice": "2914164274",
        "referenceId": "9dadcac44a4241419ed09356c1a25060"
    }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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:

```
GET https://docs.expand.network/integrations/yield-aggregators/harvest-finance.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
