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

# Create Withdrawal

> Create a withdrawal request to transfer funds to your bank or wallet

# Create Withdrawal

Creates a new withdrawal request to transfer funds from your available balance.

<Warning>
  You can only withdraw from your **available balance**. Reserved funds cannot
  be withdrawn until released.
</Warning>

## Request

<ParamField header="Authorization" type="string" required>
  Bearer token with your API key
</ParamField>

<ParamField body="amount" type="number" required>
  Amount to withdraw in dollars (e.g., `50.00`). Must not exceed available
  balance.
</ParamField>

<ParamField body="destinationType" type="string" required>
  Type of withdrawal: `paypal` or `crypto`
</ParamField>

<ParamField body="destinationDetails" type="object" required>
  <Expandable title="properties">
    <ResponseField name="paypalEmail" type="string">
      Required if `destinationType` is `paypal`. The PayPal email address to
      receive funds.
    </ResponseField>

    <ResponseField name="cryptoCoin" type="string">
      Required if `destinationType` is `crypto`. The coin to withdraw (e.g.,
      `USDT`, `USDC`).
    </ResponseField>

    <ResponseField name="cryptoNetwork" type="string">
      Required if `destinationType` is `crypto`. The network (e.g., `ERC20`,
      `TRC20`).
    </ResponseField>

    <ResponseField name="cryptoAddress" type="string">
      Required if `destinationType` is `crypto`. The destination wallet
      address.
    </ResponseField>
  </Expandable>
</ParamField>

<ParamField body="notes" type="string">
  Optional internal notes for the withdrawal.
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Whether the request was successful
</ResponseField>

<ResponseField name="data" type="object">
  <Expandable title="properties">
    <ResponseField name="id" type="string">
      Unique withdrawal identifier (e.g., `wd_abc123`)
    </ResponseField>

    <ResponseField name="amountInCents" type="integer">
      Withdrawal amount in cents
    </ResponseField>

    <ResponseField name="status" type="string">
      Withdrawal status: `pending`, `processing`, `completed`, `failed`,
      `cancelled`
    </ResponseField>

    <ResponseField name="destinationType" type="string">
      Type of withdrawal: `paypal` or `crypto`
    </ResponseField>

    <ResponseField name="destinationDetails" type="string">
      JSON string containing destination details
    </ResponseField>

    <ResponseField name="requestedAt" type="string">
      ISO 8601 creation timestamp
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  # PayPal Withdrawal
  curl -X POST https://api.swiftpay.cx/api/withdrawals \
    -H "Authorization: Bearer mp_live_your_api_key" \
    -H "Content-Type: application/json" \
    -d '{
      "amount": 50.00,
      "destinationType": "paypal",
      "destinationDetails": {
        "paypalEmail": "user@example.com"
      }
    }'

  # Crypto Withdrawal

  curl -X POST https://api.swiftpay.cx/api/withdrawals \
   -H "Authorization: Bearer mp_live_your_api_key" \
   -H "Content-Type: application/json" \
   -d '{
  "amount": 100.00,
  "destinationType": "crypto",
  "destinationDetails": {
  "cryptoCoin": "USDT",
  "cryptoNetwork": "TRC20",
  "cryptoAddress": "Txxxxxxxxxxxxxxxxxxxxxxx"
  }
  }'

  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://api.swiftpay.cx/api/withdrawals", {
     method: "POST",
     headers: {
        Authorization: "Bearer mp_live_your_api_key",
        "Content-Type": "application/json",
     },
     body: JSON.stringify({
        amount: 50.00,
        destinationType: "paypal",
        destinationDetails: {
           paypalEmail: "user@example.com"
        }
     }),
  });

  const withdrawal = await response.json();
  console.log(`Withdrawal ${withdrawal.data.id} created`);
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.swiftpay.cx/api/withdrawals',
      headers={
          'Authorization': 'Bearer mp_live_your_api_key',
          'Content-Type': 'application/json'
      },
      json={
          'amount': 50.00,
          'destinationType': 'paypal',
          'destinationDetails': {
              'paypalEmail': 'user@example.com'
          }
      }
  )

  withdrawal = response.json()
  print(f"Withdrawal {withdrawal['data']['id']} created")
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={null}
  {
    "success": true,
    "data": {
      "id": "wd_abc123",
      "amountInCents": 5000,
      "status": "pending",
      "destinationType": "paypal",
      "destinationDetails": "{\"paypalEmail\":\"user@example.com\"}",
      "requestedAt": "2024-01-15T10:30:00Z"
    }
  }
  ```

  ```json 400 theme={null}
  {
     "success": false,
     "error": {
        "type": "validation_error",
        "message": "Insufficient available balance",
        "requestId": "req_abc123"
     }
  }
  ```

  ```json 400 theme={null}
  {
     "success": false,
     "error": {
        "type": "validation_error",
        "message": "Withdrawal method not found",
        "requestId": "req_abc123"
     }
  }
  ```
</ResponseExample>

## Withdrawal Flow

1. **Pending**: Withdrawal request created, awaiting processing
2. **Processing**: Funds being transferred to your account
3. **Completed**: Funds successfully transferred
4. **Failed**: Transfer failed (contact support)
5. **Cancelled**: Withdrawal cancelled (funds returned to balance)

## Before Withdrawing

<Steps>
  <Step title="Check Available Balance">
    Use the [Balance API](/api-reference/balance/get-balance) to verify
    available funds
  </Step>

  {" "}

  <Step title="Set Up Withdrawal Method">
    Add a PayPal or crypto wallet in your dashboard settings
  </Step>

  <Step title="Create Withdrawal">
    Submit withdrawal request with amount and method
  </Step>
</Steps>

<Note>
  Pending and processing withdrawals reduce your available balance to prevent
  over-withdrawal.
</Note>
