Pagination
How every list endpoint pages, searches and reports totals.
Every list endpoint (GET /transactions, GET /invoices, GET /preapprovals) works the same way. You ask for a page by number, optionally search, and get back one page plus the totals you need to build a pager.
Request
| Parameter | Default | Meaning |
|---|---|---|
page |
1 |
Which page, starting at 1. |
limit |
25 |
Results per page, up to 100. |
q |
none | Search. Case-insensitive, matches part of a value. Each endpoint lists the fields it searches. |
Out-of-range values are corrected rather than rejected. A page below 1 becomes 1, a limit above 100 becomes 100, and a missing or invalid limit becomes 25. The limit in the response is always the one that was used.
Results are newest first. Rows created in the same second keep a fixed order, so paging never skips or repeats a row while nothing new is being added.
Response
The data of a list response is always this envelope:
dataarrayrequiredThe rows on this page. An empty array when nothing matches or page is past the last page.
pageintegerrequiredThe page returned.
limitintegerrequiredThe page size used.
totalintegerrequiredHow many rows match the filters and search, across all pages.
total_pagesintegerrequiredHow many pages there are at this limit. 0 when nothing matches.
{
"success": true,
"message": "",
"data": {
"data": [],
"page": 2,
"limit": 25,
"total": 61,
"total_pages": 3
}
}
Reading every page
Start at page=1 and keep going while page < total_pages:
async function allTransactions() {
const rows = [];
for (let page = 1; ; page++) {
const res = await fetch(`https://api.razpay.razonetix.com/v1/transactions?page=${page}&limit=100`, {
headers: { Authorization: `Bearer ${process.env.RAZPAY_API_KEY}` },
});
const { data } = await res.json();
rows.push(...data.data);
if (page >= data.total_pages) return rows;
}
}
New rows are added at the front of the list, so a sync that runs while payments are coming in can see a row twice at a page boundary. De-duplicate by external_reference. To catch up on what changed, prefer webhooks over re-reading the whole list.
