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:
| Parameter | Type | Default | Notes |
|---|---|---|---|
page | integer | 1 | 1-based, minimum 1. |
perPage | integer | 25 | Between 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"
}
}| Field | Meaning |
|---|---|
total | Number of items across all pages. |
perPage | Page size used for this response. |
currentPage | The page returned. |
lastPage | The last page with items. |
nextPageUrl | The next page, or null on the last page. |
previousPageUrl | The 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.