> For the complete documentation index, see [llms.txt](https://docs.sodex.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sodex.com/for-developers/api-reference/wealth-api/recurring-buys.md).

# Recurring Buy Plans

Read a wallet's recurring-buy plans and the execution row for each scheduled date. Create a plan and prefund the shared balance on [Recurring Buys](https://docs.sodex.com/for-developers/developers/wealth/recurring-buys.md).

A non-trading day or a failed estimate appears only on the execution list. It does not become a subscription in the [fund ledger](https://docs.sodex.com/for-developers/api-reference/wealth-api/user-fund-history.md). The public weekly simulation, which is not tied to a wallet, is [DCA history](https://docs.sodex.com/for-developers/api-reference/wealth-api/markets.md#dca-history).

## List plans

`GET /users/{address}/recurring-buys`

```bash
curl "https://mainnet-gw.sodex.dev/api/v1/wealth/users/0x1111111111111111111111111111111111111111/recurring-buys?status=active" \
  -H "Accept: application/json"
```

| Name      | Location | Type   | Required | Description                              |
| --------- | -------- | ------ | -------- | ---------------------------------------- |
| `address` | path     | string | Yes      | User EVM address.                        |
| `status`  | query    | string | No       | `active` or `history`. Default `active`. |

`active` includes plans that are running or paused. `history` includes only cancelled plans. Cancelling a plan does not erase its index.

`availableAssets` is the shared deposit balance, not the amount already used by one plan.

| Field             | Type             | Description             |
| ----------------- | ---------------- | ----------------------- |
| `address`         | string           | Wallet address.         |
| `availableAssets` | string, optional | Shared deposit balance. |
| `plans`           | array            | Matching plans.         |

| Plan field                  | Type             | Description                                   |
| --------------------------- | ---------------- | --------------------------------------------- |
| `chainId`                   | string           | Chain id.                                     |
| `dcaAddress`                | string           | DCA contract address.                         |
| `planIndex`                 | string           | Plan index. Stable across cancellation.       |
| `fundId`                    | string, optional | Fund identifier.                              |
| `target`                    | string           | Target token or fund.                         |
| `amount`                    | string           | Amount contributed each period.               |
| `planType`                  | string           | `DAILY`, `WEEKLY`, `BI_WEEKLY`, or `MONTHLY`. |
| `dayOfPeriod`               | integer          | Day within the period.                        |
| `createdAt`                 | string           | Creation time.                                |
| `status`                    | string           | `ACTIVE`, `PAUSED`, or `CANCELLED`.           |
| `successfulExecutionCount`  | integer          | Executions that completed.                    |
| `nextScheduledAt`           | string, optional | Next scheduled time.                          |
| `share`                     | object           | Share token: `coin`, `address`, `decimals`.   |
| `totalBuyAmount`            | string           | Cumulative amount spent.                      |
| `totalBuyShares`            | string           | Cumulative shares bought.                     |
| `avgCost`                   | string, optional | Average cost.                                 |
| `processingAmount`          | string           | Amount currently processing.                  |
| `processingAmountEstimated` | string, optional | Estimated processing amount.                  |
| `statisticsComplete`        | boolean          | Whether the totals are complete.              |
| `totalsAllocated`           | boolean          | Whether totals have been allocated.           |
| `anomalyCount`              | integer          | Count of anomalous executions.                |

## Plan executions

`GET /users/{address}/recurring-buys/{planIndex}/executions`

One row per scheduled local date. Retries on the same day stay on that row. The newest date comes first. When two deployments share a plan index, pass `dcaAddress` to choose one.

```bash
curl "https://mainnet-gw.sodex.dev/api/v1/wealth/users/0x1111111111111111111111111111111111111111/recurring-buys/0/executions?dcaAddress=0x2222222222222222222222222222222222222222" \
  -H "Accept: application/json"
```

| Name         | Location | Type   | Required | Description                                                                       |
| ------------ | -------- | ------ | -------- | --------------------------------------------------------------------------------- |
| `address`    | path     | string | Yes      | User EVM address.                                                                 |
| `planIndex`  | path     | string | Yes      | Plan index from the plan list.                                                    |
| `dcaAddress` | query    | string | No       | DCA contract. Required to choose between two deployments that share a plan index. |

| Field        | Type   | Description           |
| ------------ | ------ | --------------------- |
| `address`    | string | Wallet address.       |
| `chainId`    | string | Chain id.             |
| `dcaAddress` | string | DCA contract address. |
| `planIndex`  | string | Plan index.           |
| `executions` | array  | Newest date first.    |

| Execution field      | Type              | Description                                           |
| -------------------- | ----------------- | ----------------------------------------------------- |
| `scheduledLocalDate` | string            | Scheduled local date.                                 |
| `scheduledAt`        | string, optional  | Scheduled time.                                       |
| `status`             | string            | Execution status.                                     |
| `reasonCode`         | string, optional  | Machine-readable reason.                              |
| `message`            | string, optional  | Reason text.                                          |
| `amount`             | string            | Amount for this date.                                 |
| `attemptedAt`        | string, optional  | When execution was attempted.                         |
| `executedAt`         | string, optional  | When execution completed.                             |
| `txHash`             | string, optional  | Transaction hash.                                     |
| `intentId`           | string, optional  | Intent id.                                            |
| `vaultRequestId`     | string, optional  | Vault request id.                                     |
| `finalSharesRaw`     | string, optional  | Shares received, in the token's native integer units. |
| `destination`        | integer, optional | `0` EVM, `1` SPOT, `2` PERP.                          |
