# Set a Sweep Policy

For one asset on one EVM chain of the network: the least a sweep moves, what it leaves behind, how often and in which UTC window.

## Overview

- **`chainId`**: an EVM chain of the network — Ethereum, Polygon, Gnosis, BNB Smart Chain, Arbitrum, Optimism, Base, Avalanche, Celo or Flow EVM, by its mainnet or testnet id ([Account Structures](https://docs.aureahub.com/docs/guide-account-structures.md) › Sweep Policies). Any other: `400` `STRUCTURE_CHAIN_UNSUPPORTED`.
- **`asset`**: `native`, or the token's address in any case — kept in lower case. It must be in your tenant's token list of that chain ([Tokens by Chain](https://docs.aureahub.com/docs/tokens-by-chain.md)): `400` `STRUCTURE_ASSET_UNKNOWN` otherwise. Its `symbol` and `decimals` come from that list.
- **The network must be omnibus**: `409` `STRUCTURE_NOT_OMNIBUS` otherwise.
- **The body replaces the policy whole** — a field left out takes its default:

  - `minAmount` (required): the least a sweep moves, above 0, in the asset's smallest unit as text.
  - `leaveBehind`: what a sweep leaves in the collection wallet; default `"0"`. For the native coin, leave the fees of the wallet's next token sweeps: a token sweep without native coin for its fee is skipped (`SWEEP_NO_GAS`).
  - `intervalSeconds` (required): 60 to 2,592,000 — the least time between two sweeps of one wallet and asset, whether made, failed or skipped.
  - `window`: `{ "fromMinute", "toMinute" }`, minutes of the day in UTC (0–1439), from `fromMinute` up to, not including, `toMinute`; `fromMinute` above `toMinute` wraps past midnight, the two equal is refused (`window: an empty window`). Left out or `null`: any time.
  - `enabled`: default `true`. `false`: not swept, its sub-ledger still kept.
- A body written wrong — an amount that is not a whole number as text, a number sent as text, a field the body does not have — answers `400` `STRUCTURE_REQUEST_INVALID` with each problem in `details.errors`.
- `200` with the policy. Sweeps run once the omnibus processing comes ([Account Structures](https://docs.aureahub.com/docs/guide-account-structures.md) › Sweeps). Solana and other non-EVM chains have no sweep policy.
- For `owner`, `tenantadmin` and `non_signing_admin`, on their own tenant, with an access token. Written to your audit trail [Coming soon, upon request](https://docs.aureahub.com/docs/feature-availability.md), as `structure.sweep_policy_set`.

## Endpoint

### `PUT /v1/structures/{network}/sweep-policies/{chainId}/{asset}`

Authentication: bearer token required.

Sets the sweep policy of one asset on one EVM chain of the network.

**Path parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `network` | string | yes | `mainnet` or `testnet` |
| `chainId` | integer | yes | An EVM chain of the network, e.g. `8453` (Base) |
| `asset` | string | yes | `native`, or the token's contract address |

**Request body**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `minAmount` | string | yes | The least a sweep moves — smallest unit, as text; above 0 |
| `leaveBehind` | string | no | What a sweep leaves in the wallet; default `"0"` |
| `intervalSeconds` | integer | yes | 60 to 2,592,000: the least time between two sweeps of one wallet and asset |
| `window` | object \| null | no | `{ "fromMinute", "toMinute" }`, UTC minutes of the day (0–1439); `null`: any time |
| `enabled` | boolean | no | Default `true` |

**Responses**

`200` OK

```json
{
  "chainId": 8453,
  "asset": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
  "symbol": "USDC",
  "decimals": 6,
  "minAmount": "50000000",
  "leaveBehind": "0",
  "intervalSeconds": 3600,
  "windowFromMinute": 1320,
  "windowToMinute": 360,
  "enabled": true,
  "updatedAt": "2026-10-13T09:20:11.402Z"
}
```

`400` Chain

```json
{
  "statusCode": 400,
  "error": "BadRequestError",
  "message": "Chain 84532 is no EVM chain of the mainnet the Hub supports",
  "details": { "code": "STRUCTURE_CHAIN_UNSUPPORTED", "chainId": 84532 }
}
```

`400` Asset

```json
{
  "statusCode": 400,
  "error": "BadRequestError",
  "message": "The asset is not in the tenant's list of the chain: register it first (the asset registry or the token routes)",
  "details": {
    "code": "STRUCTURE_ASSET_UNKNOWN",
    "chainId": 8453,
    "asset": "0x50c5725949a6f0c72e6c4a641f24049a917db0cb"
  }
}
```

`400` Invalid

```json
{
  "statusCode": 400,
  "error": "BadRequestError",
  "message": "Invalid request",
  "details": {
    "code": "STRUCTURE_REQUEST_INVALID",
    "errors": [
      "minAmount: greater than 0",
      "intervalSeconds: Number must be greater than or equal to 60",
      "window: an empty window"
    ]
  }
}
```

`409` Segregated

```json
{
  "statusCode": 409,
  "error": "ConflictError",
  "message": "The tenant's structure on this network is not omnibus",
  "details": { "code": "STRUCTURE_NOT_OMNIBUS", "network": "mainnet" }
}
```

**Example request**

```bash
curl -X PUT https://api.aureahub.com/v1/structures/mainnet/sweep-policies/8453/0x833589fcd6edb6e08f4c7c32d4f71b54bda02913 \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "minAmount": "50000000",
    "intervalSeconds": 3600,
    "window": { "fromMinute": 1320, "toMinute": 360 }
  }'
```

---

Web version: https://docs.aureahub.com/#structures-policy-put
