Pagination

All list endpoints in the PageGun API support offset-based pagination.

Query Parameters

ParameterTypeDefaultMaxDescription
limitinteger20100Number of items per page
offsetinteger0Number of items to skip

Example Request

curl "https://api.pagegun.com/v1/pages?project_id=PROJECT_ID&limit=20&offset=0" \ -H "Authorization: Bearer pgk_live_xxx"

Response Format

{ "success": true, "data": [ { "id": "page_1", "slug": "intro", "..." : "..." }, { "id": "page_2", "slug": "quick-start", "..." : "..." } ], "has_more": true, "total": 42 }
FieldTypeDescription
dataarrayThe items for the current page
has_morebooleantrue if more items exist beyond this page
totalintegerTotal number of items matching the query

Iterating All Results

TypeScript

async function fetchAllPages(projectId: string) { const allPages = [] let offset = 0 const limit = 100 while (true) { const res = await fetch( `https://api.pagegun.com/v1/pages?project_id=${projectId}&limit=${limit}&offset=${offset}`, { headers: { 'Authorization': 'Bearer pgk_live_xxx' } } ) const json = await res.json() allPages.push(...json.data) if (!json.has_more) break offset += limit } return allPages }

curl + jq

OFFSET=0 LIMIT=100 while true; do RESPONSE=$(curl -s "https://api.pagegun.com/v1/pages?project_id=PROJECT_ID&limit=$LIMIT&offset=$OFFSET" \ -H "Authorization: Bearer pgk_live_xxx") echo "$RESPONSE" | jq '.data[]' HAS_MORE=$(echo "$RESPONSE" | jq '.has_more') [ "$HAS_MORE" = "false" ] && break OFFSET=$((OFFSET + LIMIT)) done
© 2026 PageGun. All rights reserved.