Search the docs

Pages and API endpoints

Developer dashboard

Pagination

All list endpoints return paginated results. Use page and limit query parameters.

Parameters

ParameterTypeDescription
pagenumberPage number, starting from 1 (default: 1)
limitnumberItems per page (default: 20, max: 100)

Response Format

Paginated Response
{
  "data": [ ... ],
  "total": 156,
  "page": 2,
  "limit": 20
}
ParameterTypeDescription
dataarrayArray of items for the current page
totalnumberTotal number of items matching the query
pagenumberCurrent page number
limitnumberItems per page

Example: Fetching All Pages

Node.js
async function fetchAllInvoices(apiKey) {
  let page = 1;
  let allInvoices = [];
  
  while (true) {
    const res = await fetch(
      `https://api.syncbooksapp.com/api/v1/invoices?page=${page}&limit=100`,
      { headers: { Authorization: `Bearer ${apiKey}` } }
    );
    const { data, total } = await res.json();
    
    allInvoices.push(...data);
    
    if (allInvoices.length >= total) break;
    page++;
  }
  
  return allInvoices; // All invoices
}