# Strategies

Strategies define the input token, the amount, the output tokens and frequency of each recurring buy. You can create a strategy using the web app.

## Get a list of strategies

<mark style="color:blue;">`GET`</mark> `https://api.8pay.network/v1/:chain/dollar-cost-average/strategies`

#### Path Parameters

| Name  | Type   | Description                                                   |
| ----- | ------ | ------------------------------------------------------------- |
| chain | string | [chain identifier](https://docs.8pay.network/overview#chains) |

#### Query Parameters

| Name  | Type   | Description                                                 |
| ----- | ------ | ----------------------------------------------------------- |
| admin | string | filter by admin                                             |
| from  | number | filter by `createdAt` (default 0)                           |
| to    | number | filter by `createdAt` (default current timestamp)           |
| sort  | string | `asc` or `desc` (default `desc`), sort based on `createdAt` |

#### Headers

| Name          | Type   | Description       |
| ------------- | ------ | ----------------- |
| Authorization | string | Bearer \<api-key> |

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

```
{
    "data": [
        {
            "id": "0x57b2059e526841b3dfd964144513359c9fcfd6d91040b6c47f589c1e032b6bf7",
            "name": "My investment plan",
            "admin": "0xe42fD8a58A82fDF624A8a94dA03a0e44F9934Dff",
            "status": "ACTIVE",
            "start": 1685285340,
            "frequency": 2592000,
            "nextExecution": 1685285340,
            "inputAmount": "100",
            "inputToken": "USDT",
            "createdAt": 1684766721,
            "transactionHash": "0x54587230024701c54878c32ca0951c070666f2afccec09ddc1d6921d584cca3c",
            "transactionStatus": "confirmed",
            "outputTokens": [
                {
                    "token": "8PAY",
                    "percentage": 100
                }
            ]
        }
    ],
    "limit": 100,
    "offset": 0,
    "total": 1
}
```

{% endtab %}
{% endtabs %}

## Get a strategy

<mark style="color:blue;">`GET`</mark> `https://api.8pay.network/v1/:chain/dollar-cost-average/strategies/:strategyId`

#### Path Parameters

| Name       | Type   | Description                                                   |
| ---------- | ------ | ------------------------------------------------------------- |
| strategyId | string | ID of the strategy                                            |
| chain      | string | [chain identifier](https://docs.8pay.network/overview#chains) |

#### Headers

| Name          | Type   | Description       |
| ------------- | ------ | ----------------- |
| Authorization | string | Bearer \<api-key> |

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

```
{
    "id": "0x57b2059e526841b3dfd964144513359c9fcfd6d91040b6c47f589c1e032b6bf7",
    "name": "My investment plan",
    "admin": "0xe42fD8a58A82fDF624A8a94dA03a0e44F9934Dff",
    "status": "ACTIVE",
    "start": 1685285340,
    "frequency": 2592000,
    "nextExecution": 1685285340,
    "inputAmount": "100",
    "inputToken": "USDT",
    "createdAt": 1684766721,
    "transactionHash": "0x54587230024701c54878c32ca0951c070666f2afccec09ddc1d6921d584cca3c",
    "transactionStatus": "confirmed",
    "outputTokens": [
        {
            "token": "8PAY",
            "percentage": 100
        }
    ]
}
```

{% endtab %}
{% endtabs %}
