Skip to main content
The Vook API uses offset-based pagination for all endpoints that return lists of resources. Instead of receiving thousands of records in a single response, you request a window of results by specifying how many items to return and where to start. This keeps responses fast, predictable, and easy to process incrementally.

How Pagination Works

Control the size and position of your result window using two query parameters:
ParameterTypeDefaultMaxDescription
limitinteger20100Number of records to return per page
offsetinteger0Number of records to skip before returning results
For example, to fetch the third page of results with 50 items per page:
GET https://api.vook.ai/v1/resources?limit=50&offset=100
Keep your limit between 20 and 50 for most use cases. Very large pages (close to 100) increase response time and memory usage on both sides.

Pagination Response

Every list endpoint wraps its results in a consistent envelope with a pagination object alongside the data array:
{
  "data": [
    { "id": "res_001", "name": "First Resource" },
    { "id": "res_002", "name": "Second Resource" }
  ],
  "pagination": {
    "total": 250,
    "limit": 20,
    "offset": 0,
    "has_more": true
  }
}
The pagination fields tell you everything you need to know:
FieldTypeDescription
totalintegerTotal number of matching records across all pages
limitintegerThe limit value used for this response
offsetintegerThe offset value used for this response
has_morebooleantrue if more records exist beyond this page
Use has_more as your loop condition — when it’s false, you’ve reached the last page.

Fetching All Pages

To collect every record, loop through pages until has_more is false, incrementing offset by limit on each iteration.
import requests
import os

api_key = os.environ["VOOK_API_KEY"]
base_url = "https://api.vook.ai/v1"

headers = {
    "Authorization": f"Bearer {api_key}",
    "Content-Type": "application/json",
}

def fetch_all_resources():
    all_resources = []
    limit = 50
    offset = 0

    while True:
        response = requests.get(
            f"{base_url}/resources",
            headers=headers,
            params={"limit": limit, "offset": offset},
        )
        response.raise_for_status()
        body = response.json()

        all_resources.extend(body["data"])
        print(f"Fetched {len(all_resources)} / {body['pagination']['total']} resources")

        if not body["pagination"]["has_more"]:
            break

        offset += limit

    return all_resources

resources = fetch_all_resources()
print(f"Done. Total resources fetched: {len(resources)}")

Best Practices

Follow these guidelines to paginate efficiently and avoid unnecessary load on your integration:

Use reasonable page sizes

Aim for 20–50 records per page. This balances network overhead against the cost of many round trips. Only increase toward 100 if you’re doing batch processing offline.

Don't fetch everything unless you need to

If you only need the first few matching records, stop after the first page. Fetching all pages when you only display 10 results wastes bandwidth and counts against your rate limit.

Use filters to reduce result sets

Narrow your query with available filter parameters before paginating. Fewer total records means fewer pages and faster processing.

Respect rate limits between pages

When iterating many pages programmatically, add a small delay between requests or monitor your X-RateLimit-Remaining header to avoid hitting the limit mid-loop.
The total count reflects the number of records matching your query at the time of the first request. If records are created or deleted while you paginate, your final count may differ slightly. For consistency-sensitive workflows, consider processing data in a single session without long pauses between pages.