All top-level API resources have support for bulk fetches via "list" API methods. For instance, List Sessions, List Orders, and List Charges. These list API methods share a common structure, taking at least these two parameters: limit and key.
The list APIs will respond to an initial request with the first page of results, and provide a next_key within the response if additional pages of results are available. Subsequent responses will also contain a prev_key to query items from the previous page. To receive all results, this process can be repeated until no next_key is included in the response.
Request parameters
Parameter | Details |
---|---|
limit | Number of items to be fetched |
key | A cursor for use in pagination, can be the prev_key or next_key. key is an object ID that defines your place in the list. For instance, if you make a list request and receive 20 objects, ending with obj_foo, your subsequent call can include key=obj_foo in order to fetch the next page of the list |
Response format
Parameter | Details |
---|---|
total_count | Number of all the items present |
prev_key | Cursor for the previous page |
next_key | Cursor for the next page |
items | Array of items, paginated by any request parameters |
{
"total_count": 1668,
"prev_key": null,
"items": [
{
"id": "sess_R8FNUtuXC7vnBrhkdLvqLq",
"create_date": "2023-03-10T02:59:39.141507+00:00",
"status": "started",
"organization_id": "org_3bysdyt7dvBrZK7kRGQBRg",
"type": "consumer_checkout",
"total_amount": 3300,
"is_valid_consumer": false,
"is_valid_bank_account_selected": false,
"is_sufficient_funds": false,
"consent_text": "I authorize Swifter to debit my bank account and save my authorization for future use with Swifter.",
"fees": 190,
"track_number": "fey5dm",
"marketplace_id": null,
"order_id": null,
"consumer_profile_id": null,
"first_name": "User",
"last_name": "Name",
"email": "[email protected]",
"phone": null
},
{...},
{...}
],
"next_key": "W1siMjAyMy0wMy0wOFQwMDoxNDozOS4yMDI4MzArMDA6MDAiLCAic2Vzc18ySkNTYXJFQUJNTm5wSkZxQjNVc0t3Il0sIGZhbHNlXQ=="
}