Skip to main content
All RemitFlex list endpoints return results in pages rather than all at once. RemitFlex uses cursor-based pagination — each response includes an opaque cursor string that points to the next page of results. This approach is more reliable than offset-based pagination for live datasets because it remains consistent even when new records are inserted between requests. This page explains how to read pagination metadata, move through pages, and combine pagination with filters.

Why Cursor-Based Pagination

Offset-based pagination (e.g. ?page=2) shifts when records are created or deleted between requests, causing you to skip or repeat items. Cursors are anchored to a specific position in the dataset, so iterating through pages of payments or transactions always produces a complete and consistent result set.

Query Parameters

Every list endpoint accepts the following pagination parameters as query string arguments:
limit
integer
default:"20"
The number of results to return per page. Must be between 1 and 100 inclusive. Defaults to 20.
cursor
string
An opaque cursor string returned in the previous response’s pagination.cursor field. Omit this parameter to fetch the first page. Pass it on subsequent requests to retrieve the next page.
order
string
default:"desc"
The sort order for results. Accepts asc (oldest first) or desc (newest first). Defaults to desc.

Response Format

Every list response wraps your results in a top-level object with two fields: data containing the array of resource objects, and pagination containing the metadata you need to continue iterating.
{
  "data": [...],
  "pagination": {
    "cursor": "cur_01HX...",
    "has_more": true,
    "total": 142
  }
}
The response has the following top-level fields:
data
array
An array of resource objects for the current page. Each element is a full resource representation (for example, a payment object). The array is empty when there are no results matching your query.
pagination
object
Metadata describing the current page and how to fetch the next one.
Treat cursors as opaque strings. Do not parse, store long-term, or construct cursor values manually — their internal format may change without notice. They are only valid for 24 hours after being issued.

Iterating Through All Pages

When you need to retrieve the complete result set (for example, to export all payments or reconcile transactions), loop until pagination.has_more is false.
async function getAllPayments() {
  const payments = [];
  let cursor = null;
  let hasMore = true;

  while (hasMore) {
    const url = new URL('https://api.remitflex.com/v1/payments');
    url.searchParams.set('limit', '100');
    if (cursor) url.searchParams.set('cursor', cursor);

    const response = await fetch(url, {
      headers: { 'Authorization': 'Bearer rf_live_xxxx' }
    });
    const { data, pagination } = await response.json();

    payments.push(...data);
    cursor = pagination.cursor;
    hasMore = pagination.has_more;
  }

  return payments;
}
Set limit=100 when fetching all pages to minimize the number of round trips. Each request still counts toward your rate limit, so fetching in large pages keeps you well within the 100 requests-per-minute default.

Fetching a Single Page

If you only need the first page — for example, to display the ten most recent payments in a dashboard widget — omit the cursor parameter and set your desired limit:
curl "https://api.remitflex.com/v1/payments?limit=10&order=desc" \
  -H "Authorization: Bearer rf_live_xxxx"

Filtering and Sorting

Most list endpoints support additional query parameters that narrow results before pagination is applied. The total in the response reflects the filtered count, and cursor iteration stays within the filtered result set. Common filter parameters available on list endpoints:
ParameterTypeDescription
created_afterISO 8601 timestampReturn only records created after this time
created_beforeISO 8601 timestampReturn only records created before this time
statusstringReturn only records with the specified status (e.g. completed, pending)
Example — fetch the last 50 completed payments in a date range:
curl "https://api.remitflex.com/v1/payments?limit=50&status=completed&created_after=2024-01-01T00:00:00Z&created_before=2024-02-01T00:00:00Z" \
  -H "Authorization: Bearer rf_live_xxxx"
Do not mix cursors from different queries. If you change filter parameters (e.g. status or created_after) mid-iteration, start from the first page without a cursor — using a cursor from a previous query will produce unpredictable results.