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
| Parameter | Type | Description |
|---|---|---|
sort_field | string optional | Field you want to sort by. Defaults to created_at. |
sort_order | string optional | Sorting order, asc or desc. Defaults to desc. |
page | integer optional | Page number. Defaults to 1. |
limit | integer optional | Page size. Defaults to 10, capped at 50. |
q | string optional | Free-text search term. |
filters | array optional | An array of filter criteria where each entry has the following keys. |
filters[].field | string | Field you want to filter by. |
filters[].value | string | The value to compare by. |
filters[].operator | string | Comparison 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.