ArchFindrDevelopers

Pagination

Page through list endpoints with page and perPage.

List endpoints return one page at a time. Ask for a page with two query parameters:

ParameterTypeDefaultNotes
pageinteger11-based, minimum 1.
perPageinteger25Between 1 and 100.
curl "https://api.archfindr.com/api/v1/key/requests?page=2&perPage=50" \
  -H "Authorization: Bearer $ARCHFINDR_API_KEY"

The response wraps the items in data and describes the page in metadata:

{
  "data": [{ "id": "0198a1f2-7c3e-7d4b-9a10-5b6c8e2f1a34", "reference": "RQ-10482" }],
  "metadata": {
    "total": 134,
    "perPage": 50,
    "currentPage": 2,
    "lastPage": 3,
    "firstPage": 1,
    "firstPageUrl": "/?page=1",
    "lastPageUrl": "/?page=3",
    "nextPageUrl": "/?page=3",
    "previousPageUrl": "/?page=1"
  }
}
FieldMeaning
totalNumber of items across all pages.
perPagePage size used for this response.
currentPageThe page returned.
lastPageThe last page with items.
nextPageUrlThe next page, or null on the last page.
previousPageUrlThe previous page, or null on the first page.

Build the next URL yourself

The *PageUrl fields are relative and carry only the page number. Build the next request from the endpoint, your perPage and currentPage + 1.

Walking every page

let page = 1
let lastPage = 1
do {
  const res = await fetch(`https://api.archfindr.com/api/v1/key/products?page=${page}&perPage=100`, {
    headers: { Authorization: `Bearer ${process.env.ARCHFINDR_API_KEY}` },
  })
  const { data, metadata } = await res.json()
  for (const product of data) handle(product)
  lastPage = metadata.lastPage
  page += 1
} while (page <= lastPage)

Lists are ordered newest first, so items added while you page can shift later pages. For a continuous sync, page once and then rely on webhooks for changes.

On this page