> ## Documentation Index
> Fetch the complete documentation index at: https://docs.masterpiecelabs.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Cash out to a bank account

> Onboard a payout destination with Bridge, then submit an authorized cash-out.

Cash-out moves USDC from the end user's Archer smart wallet to a fiat bank account through Bridge. It has two phases: **onboarding** (KYC and adding a payout account) and **execution** (preparing, authorizing, and submitting a wallet intent).

## 1. Check Bridge status

```ts theme={null}
const status = await client.getBridgeStatus();
// { kyc_status: "approved", tos_status: "accepted", ... }
```

If `kyc_status` is anything other than `"approved"`, kick off verification:

```ts theme={null}
const next = await client.startBridgeVerification({
  full_name: "Jane Doe",
  payout_currency: "usd",
});

if (next.kyc_link) {
  window.open(next.kyc_link, "_blank", "noopener,noreferrer");
}
```

The returned `kyc_link` / `tos_link` open Bridge's hosted flows. Poll `getBridgeStatus()` until both are complete.

## 2. Add a payout account

Once KYC is approved, add an external bank account:

```ts theme={null}
const account = await client.createExternalAccount({
  account_type: "us",
  account: { routing_number: "021000021", account_number: "1234567890" },
  first_name: "Jane",
  last_name: "Doe",
});
```

An end user may have several. List them with `client.listExternalAccounts()`.

## 3. Prepare the cash-out

```ts theme={null}
const prepared = await client.prepareCashOut({
  amount: "25.00",
  usdcAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
  externalAccountId: account.id,
});
```

`prepareCashOut` ensures a liquidation address exists, builds an ERC-20 transfer intent to it, and asks the Archer API to prepare a user operation for the end user's smart wallet.

## 4. Have the host authorize the intent

Archer never signs on behalf of the end user. Your app owns the wallet-authorization surface (typically Privy) and returns a signed payload:

```ts theme={null}
const signed = await signWithHostWallet(prepared);
//    ^ your code: present prepared.intent and prepared.prepared.request_payload
//      to the wallet, produce a user_authorization_signature, and return
//      a SignedPayload object.
```

See [Wallet authorization](/concepts/wallet-authorization) for the exact contract.

## 5. Submit

```ts theme={null}
const result = await client.submitWalletIntent(prepared.intent, signed);
// { tx_hash: "0x...", user_operation_hash: "0x..." }
```

Archer relays the user operation on-chain. Bridge picks up the transfer at the liquidation address and settles fiat to the linked bank account.

## Full example

```ts theme={null}
async function cashOut(amountUsdc: string) {
  const status = await client.getBridgeStatus();
  if (status.kyc_status !== "approved") {
    throw new Error("Complete KYC before cashing out");
  }

  const accounts = await client.listExternalAccounts();
  if (accounts.length === 0) {
    throw new Error("Add a payout account first");
  }

  const prepared = await client.prepareCashOut({
    amount: amountUsdc,
    usdcAddress: USDC_BASE,
    externalAccountId: accounts[0].id,
  });
  const signed = await signWithHostWallet(prepared);
  return client.submitWalletIntent(prepared.intent, signed);
}
```


## Related topics

- [Introduction](/introduction.md)
- [Cash-out flow](/concepts/cash-out.md)
