Skip to main content

Pagination

Dievio uses page-based pagination with _page and _per_page.

Request fields

  • _page: page number (default 1)
  • _per_page: number of rows per page (default 25)
  • max_results: cap on total returned rows (default 500, max 100000)

The API may return fewer rows than _per_page if credits are lower than the requested page size.

Response fields

  • page
  • per_page
  • total_pages
  • total_count
  • has_more
  • next_page (null when has_more is false)

Example loop

let page = 1;
let results = [];

while (true) {
const res = await fetch('https://dievio.com/api/public/search', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.DIEVIO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ _page: page, _per_page: 100, max_results: 1000 }),
});

const data = await res.json();
results = results.concat(data.preview_data || []);

if (!data.has_more) break;
page = data.next_page;
}