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

# List Withdrawals

> List all withdrawal requests with filtering and pagination

# List Withdrawals

Returns a paginated list of withdrawal requests for your business.

## Request

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

<ParamField query="status" type="string">
  Filter by status: `pending`, `processing`, `completed`, `failed`, `cancelled`
</ParamField>

<ParamField query="page" type="integer" default="1">
  Page number for pagination
</ParamField>

<ParamField query="limit" type="integer" default="20">
  Number of results per page (1-100)
</ParamField>

## Response

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

<ResponseField name="data" type="object">
  <Expandable title="properties">
    <ResponseField name="items" type="array">
      Array of withdrawal objects

      <Expandable title="withdrawal object">
        <ResponseField name="id" type="string">
          Unique withdrawal identifier
        </ResponseField>

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

        <ResponseField name="status" type="string">
          Current status
        </ResponseField>

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

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

        <ResponseField name="completedAt" type="string">
          ISO 8601 completion timestamp
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="meta" type="object">
      <Expandable title="properties">
        <ResponseField name="total" type="integer">
          Total number of withdrawals
        </ResponseField>

        <ResponseField name="page" type="integer">
          Current page number
        </ResponseField>

        <ResponseField name="limit" type="integer">
          Results per page
        </ResponseField>

        <ResponseField name="totalPages" type="integer">
          Total number of pages
        </ResponseField>

        <ResponseField name="hasNextPage" type="boolean">
          Whether a next page exists
        </ResponseField>

        <ResponseField name="hasPreviousPage" type="boolean">
          Whether a previous page exists
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  # List all withdrawals
  curl "https://api.swiftpay.cx/api/withdrawals?page=1&limit=20" \
    -H "Authorization: Bearer mp_live_your_api_key"

  # Filter by status

  curl "https://api.swiftpay.cx/api/withdrawals?status=completed" \
   -H "Authorization: Bearer mp_live_your_api_key"

  ```

  ```javascript JavaScript theme={null}
  // List all withdrawals
  const response = await fetch(
    'https://api.swiftpay.cx/api/withdrawals?page=1&limit=20',
    {
      headers: {
        'Authorization': 'Bearer mp_live_your_api_key'
      }
    }
  );

  const withdrawals = await response.json();

  // Calculate total withdrawn
  const totalWithdrawn = withdrawals.data
    .filter(w => w.status === 'completed')
    .reduce((sum, w) => sum + w.amountInCents, 0);

  console.log(`Total withdrawn: $${(totalWithdrawn / 100).toFixed(2)}`);
  ```

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

  # List completed withdrawals
  response = requests.get(
      'https://api.swiftpay.cx/api/withdrawals',
      headers={'Authorization': 'Bearer mp_live_your_api_key'},
      params={'status': 'completed', 'limit': 50}
  )

  withdrawals = response.json()

  total = sum(w['amountInCents'] for w in withdrawals['data'])
  print(f"Total withdrawn: ${total / 100:.2f}")
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "data": {
      "items": [
        {
          "id": "wd_abc123",
          "amountInCents": 5000,
          "status": "completed",
          "destinationType": "paypal",
          "requestedAt": "2024-01-15T10:30:00Z",
          "completedAt": "2024-01-15T14:00:00Z"
        },
        {
          "id": "wd_def456",
          "amountInCents": 2500,
          "status": "pending",
          "destinationType": "crypto",
          "requestedAt": "2024-01-16T09:00:00Z",
          "completedAt": null
        }
      ],
      "meta": {
        "total": 2,
        "page": 1,
        "limit": 20,
        "totalPages": 1,
        "hasNextPage": false,
        "hasPreviousPage": false
      }
    }
  }
  ```
</ResponseExample>

## Withdrawal Statuses

| Status       | Description                 |
| ------------ | --------------------------- |
| `pending`    | Awaiting processing         |
| `processing` | Funds being transferred     |
| `completed`  | Successfully transferred    |
| `failed`     | Transfer failed             |
| `cancelled`  | Cancelled by user or system |
