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

# withdraw

> Withdraw BTC from a Spark wallet to a Bitcoin L1 address (cooperative exit).

<RequestExample>
  ```sh theme={"system"}
  curl --request POST \
    --url https://api.privy.io/v1/wallets/{wallet_id}/rpc \
    --header 'Authorization: Basic <encoded-value>' \
    --header 'Content-Type: application/json' \
    --header 'privy-app-id: <privy-app-id>' \
    --data '{
    "method": "withdraw",
    "network": "MAINNET",
    "params": {
      "onchain_address": "bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4",
      "exit_speed": "FAST",
      "amount_sats": 10000,
      "fee_quote_id": "5c1a...",
      "fee_amount_sats": 250,
      "deduct_fee_from_withdrawal_amount": false
    }
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={"system"}
  {
    "method": "withdraw",
    "data": {
      "id": "9b1f8a2c-3d4e-4f5a-8b6c-7d8e9f0a1b2c",
      "created_at": "2025-07-24T16:43:12.509Z",
      "updated_at": "2025-07-24T16:43:12.509Z",
      "network": "MAINNET",
      "fee": {
        "original_value": 200,
        "original_unit": "SATOSHI"
      },
      "l1_broadcast_fee": {
        "original_value": 50,
        "original_unit": "SATOSHI"
      },
      "status": "PENDING",
      "expires_at": "2025-07-24T17:43:12.509Z",
      "coop_exit_txid": "448f305caf15ec10b2a8286fde6c31ebe2eb30e2018b22a8f7630d3fa2753e49",
      "fee_quote_id": "5c1a...",
      "exit_speed": "FAST"
    }
  }
  ```
</ResponseExample>

### Headers

<ParamField header="privy-app-id" type="string" required>
  ID of your Privy app.
</ParamField>

<ParamField header="privy-authorization-signature" type="string">
  Request authorization signature. If multiple signatures are required, they should be comma
  separated.
</ParamField>

<ParamField header="privy-request-expiry" type="string">
  Request expiry. Value is a Unix timestamp in milliseconds representing the deadline by which the
  request must be processed.
</ParamField>

### Path Parameters

<ParamField path="wallet_id" type="string" required>
  ID of the wallet to get.
</ParamField>

<Info>
  These wallet methods are modeled after the [Spark Wallet
  SDK](https://github.com/buildonspark/spark/tree/main/sdks/js/packages/spark-sdk). For more
  information about this wallet method, check out the [Spark Wallet
  documentation](https://docs.spark.money/wallet/introduction).
</Info>

### Body

<ParamField body="method" type="string" defaultValue="withdraw" required>
  Must be set to `withdraw`.
</ParamField>

<ParamField body="network" type="string" required>
  Blockchain network to use. Options: `MAINNET`, `REGTEST`.
</ParamField>

<ParamField body="params" type="object" required>
  <Expandable title="child attributes" defaultOpen="true">
    <ParamField body="onchain_address" type="string" required>
      The Bitcoin L1 address to withdraw to.
    </ParamField>

    <ParamField body="exit_speed" type="enum<string>" required>
      The exit speed for the withdrawal. Options: `FAST`, `MEDIUM`, `SLOW`.
    </ParamField>

    <ParamField body="amount_sats" type="number">
      The amount of satoshis to withdraw. Withdraws the full balance if not specified.
    </ParamField>

    <ParamField body="fee_amount_sats" type="number">
      The fee amount in satoshis, from a prior `getWithdrawalFeeQuote` call.
    </ParamField>

    <ParamField body="fee_quote_id" type="string">
      The fee quote ID from a prior `getWithdrawalFeeQuote` call.
    </ParamField>

    <ParamField body="deduct_fee_from_withdrawal_amount" type="boolean">
      Whether to deduct the fee from the withdrawal amount. Defaults to false.
    </ParamField>
  </Expandable>
</ParamField>

### Returns

<ResponseField name="method" type="enum<string>" defaultValue="withdraw" required>
  Available options: `withdraw`
</ResponseField>

<ResponseField name="data" type="object" required>
  A `CoopExitRequest` object with the following fields:

  <Expandable title="child attributes" defaultOpen="true">
    <ResponseField name="id" type="string" required>
      The unique identifier of this coop exit request.
    </ResponseField>

    <ResponseField name="created_at" type="string" required>
      The date and time when the request was first created.
    </ResponseField>

    <ResponseField name="updated_at" type="string" required>
      The date and time when the request was last updated.
    </ResponseField>

    <ResponseField name="network" type="string" required>
      The network the coop exit request is on.
    </ResponseField>

    <ResponseField name="fee" type="object" required>
      The fee the user pays for the coop exit, not including the L1 broadcast fee.

      <Expandable title="child attributes" defaultOpen="true">
        <ResponseField name="original_value" type="number" required />

        <ResponseField name="original_unit" type="string" required />
      </Expandable>
    </ResponseField>

    <ResponseField name="l1_broadcast_fee" type="object" required>
      The L1 broadcast fee the user pays for the coop exit.

      <Expandable title="child attributes" defaultOpen="true">
        <ResponseField name="original_value" type="number" required />

        <ResponseField name="original_unit" type="string" required />
      </Expandable>
    </ResponseField>

    <ResponseField name="status" type="string" required>
      The status of this coop exit request.
    </ResponseField>

    <ResponseField name="expires_at" type="string" required>
      The time when the coop exit request expires and the UTXOs are released.
    </ResponseField>

    <ResponseField name="coop_exit_txid" type="string" required>
      The transaction id of the coop exit transaction.
    </ResponseField>

    <ResponseField name="fee_quote_id" type="string">
      The fee quote ID used for this coop exit.
    </ResponseField>

    <ResponseField name="exit_speed" type="enum<string>">
      The exit speed used for this coop exit. Options: `FAST`, `MEDIUM`, `SLOW`.
    </ResponseField>
  </Expandable>
</ResponseField>
