# sweep

URL: /business/nouns/account/sweep · Id: `verb:Account.sweep` · Call: `await $.Account.sweep({ … })` (SDK) or the `do` tool at `https://api.sb/mcp`. Inputs says what to pass, Outputs what returns, When it waits who approves.

> Sweep moves cash between two cash Accounts of the same owner, once or on a standing rule, within the Treasurer’s Limit.

Sweep moves cash between two cash [Accounts](/business/nouns/account) of the same owner, once or on a standing rule, within the [Treasurer](/agents/finance/treasurer)’s [Limit](/business/nouns/limit).

## Inputs
| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `from` | [Account](/business/nouns/account) | Yes | The cash Account the money leaves. |
| `to` | [Account](/business/nouns/account) | Yes | The cash Account it lands in. |
| `amount` | `money` | No | How much to move. Leave it out and set `keep` to move everything above a floor. |
| `keep` | `money` | No | Leave this much in `from` and move the rest. |
| `repeat` | `string` | No | Turns the move into a standing rule that sweeps on this schedule. |

## Outputs
| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `account` | [Account](/business/nouns/account) | Yes | The `to` Account, with the money landed. |
| `transaction` | [Transaction](/business/nouns/transaction) | Yes | The move, reconciled on both Accounts. |

## Effects
- Emits [`Account.swept`](/business/events/Account.swept).
- Performed by the [Treasurer](/agents/finance/treasurer).
- Two-way: it runs at once, in the `try`, `send` and `do` modes.
- From the payments balance to the card balance, the money lands at once; from a bank it takes up to five business days.
- A standing rule skips a day when the move would leave `from` below `keep`.

## Refuses when
| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | [Account.sweep](/business/nouns/account/sweep) |

## When it waits
| Gate | Default |
| --- | --- |
| Decision class | Low: two-way, nothing at stake |
| [Delay window](/systems/trust-and-governance/controls/one-way-windows) | None: it runs once review passes. |
| Limit | The call [Limit](/business/nouns/limit) of the [Permission](/business/nouns/permission) it runs under. |
| Over the Limit | It waits `pending` for an [Approval](/business/nouns/approval) from the [Founder](/agents/founding/founder). Approved, it runs; refused, it ends `refused` with [`limit-exceeded`](/code/api/errors/limit-exceeded); unanswered by its deadline, it ends `canceled`. |

## Example

**Ask**

```text
Sweep my account.
```

**API**

```bash
curl -X POST https://api.sb/ledgerlark.com/accounts/account_1/sweep \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to":"account_1"}'
```

```json
{
  "api": "https://api.sb/ledgerlark.com",
  "account": {
    "$id": "https://api.sb/ledgerlark.com/accounts/account_1",
    "$type": "Account",
    "class": "cash"
  },
  "transaction": {
    "$id": "https://api.sb/ledgerlark.com/transactions/transaction_1",
    "$type": "Transaction",
    "kind": "charge",
    "amount": {
      "amount": 400,
      "currency": "USD"
    }
  },
  "action": {
    "$id": "https://api.sb/ledgerlark.com/actions/action_1",
    "operation": "Account.sweep",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/ledgerlark.com/actions/action_1"
  }
}
```

**SDK**

```ts
import { $ } from 'startup-builder'

const { account, transaction } = await $.Account.sweep({ from: 'account_1', to: 'account_1' })
```

**CLI**

```bash
npx startup-builder do Account.sweep --json '{"from":"account_1","to":"account_1"}'
```

**MCP**

```json
{
  "name": "do",
  "arguments": {
    "code": "return await $.Account.sweep({ from: 'account_1', to: 'account_1' })"
  }
}
```

Guides that call it: [Move money between accounts](/systems/finance/move-money).