# Account routes: payout, sweep

URL: /code/api/account/verbs · Id: `page:code/api/account/verbs`

> The Account Verbs payout, sweep as api.sb routes, with inputs, result, refusals and an example.

Reference for [Account](/business/nouns/account), one group of [Account routes](/code/api/account).

### Account.payout
Payout sends available cash from the payments balance to the owner’s bank and lists every Transaction the payout carries. [Verb page](/business/nouns/account/payout?interface=api).

```text
POST /{namespace}/accounts/{account}/payout
```

Path: `account`. Body, as JSON: the other inputs. Emits [`Account.paidOut`](/business/events/Account.paidOut).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `account` | [Account](/business/nouns/account) | Yes | The payments balance: the cash Account held at `payments`. |
| `amount` | `money` | No | How much to send. Defaults to everything available. |
| `instant` | `boolean` | No | True to send it within minutes to an eligible debit card or bank, for Stripe’s instant payout cost. |
| `schedule` | `string` | No | Sets the Account’s `payoutSchedule` from now on, in place of sending a payout now. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `account` | [Account](/business/nouns/account) | Yes | The payments balance after the payout. |
| `transaction` | [Transaction](/business/nouns/transaction) | Yes | The payout, a Transaction of kind `payout`. |

**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. | None. |

**Example**

```bash
curl -X POST https://api.sb/leaseline.app/accounts/acct_nV4f0K7dTw/payout \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "account": {
    "$id": "https://api.sb/leaseline.app/accounts/acct_nV4f0K7dTw",
    "$type": "Account",
    "class": "cash"
  },
  "transaction": {
    "$id": "https://api.sb/leaseline.app/transactions/txn_XoxtZe3CQI",
    "$type": "Transaction",
    "kind": "charge",
    "amount": {
      "amount": 29,
      "currency": "USD"
    }
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Account.payout",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

### Account.sweep
Sweep moves cash between two cash Accounts of the same owner, once or on a standing rule, within the Treasurer’s Limit. [Verb page](/business/nouns/account/sweep?interface=api).

```text
POST /{namespace}/accounts/{from}/sweep
```

Path: `from`. Body, as JSON: the other inputs. Emits [`Account.swept`](/business/events/Account.swept).

**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. |

**Returns**

| 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. |

**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. | None. |

**Example**

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

```json
{
  "api": "https://api.sb/leaseline.app",
  "account": {
    "$id": "https://api.sb/leaseline.app/accounts/acct_nV4f0K7dTw",
    "$type": "Account",
    "class": "cash"
  },
  "transaction": {
    "$id": "https://api.sb/leaseline.app/transactions/txn_XoxtZe3CQI",
    "$type": "Transaction",
    "kind": "charge",
    "amount": {
      "amount": 29,
      "currency": "USD"
    }
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Account.sweep",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```