Skip to content

List All Withdrawals

Returns a paginated list of withdrawal objects related to the current authenticated account. The list is sorted, with the most recent withdrawal appearing first by default.

Required scope: view-withdrawals

Parameters

ParameterTypeDescription
sort_fieldstring optionalField you want to sort by. Defaults to created_at.
sort_orderstring optionalSorting order, asc or desc. Defaults to desc.
pageinteger optionalPage number. Defaults to 1.
limitinteger optionalPage size. Defaults to 10, capped at 50.
qstring optionalFree-text search term.
filtersarray optionalAn array of filter criteria where each entry has the following keys.
filters[].fieldstringField you want to filter by.
filters[].valuestringThe value to compare by.
filters[].operatorstringComparison operator. Accepted values: = (default), is, is_not, !=, <, <=, >, >=, in, like, not like.

Returns

Returns a paginated collection of withdrawal objects. If no withdrawals are found, returns an empty collection.

Request

Endpoint: https://youcanpay.com/api/v2/withdrawalsMethod: GET

bash
$ curl --location -g --request GET 'https://youcanpay.com/api/v2/withdrawals' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer YOUR_TOKEN_eyJpc3...'

Request with Filters

bash
$ curl --location -g --request GET 'https://youcanpay.com/api/v2/withdrawals?sort_field=amount&sort_order=asc&filters[0][field]=amount&filters[0][value]=100' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer YOUR_TOKEN_eyJpc3...'

Response

json
{
  "object": "v2.withdrawal",
  "data": [
    {
      "object": "v2.withdrawal",
      "id": "756e502e-d363-42f1-85f0-0b6b43f4d486",
      "processor": "cashplus",
      "status": "pending",
      "amount": {
        "amount": "500.00",
        "currency": "MAD",
        "localized": "MAD 500.00"
      },
      "fee": {
        "amount": "10.00",
        "currency": "MAD",
        "localized": "MAD 10.00"
      },
      "is_paid": false,
      "rejection_reason": null,
      "metadata": [],
      "bank_account_id": null,
      "approved_at": null,
      "created_at": "2024-01-31 15:11:50"
    }
  ],
  "pagination": {
    "current_page": 1,
    "per_page": 10,
    "total": 6,
    "last_page": 1
  }
}

See the Withdrawal object for a description of each field.