Skip to content

Loading…

Pagination

Page through properties and leads with limit and offset.

On this page

List endpoints return results in pages, controlled by two query parameters:

ParameterDefaultRangeMeaning
limit1001–1000Maximum number of results in the page.
offset0≥ 0Number of results to skip.

A value outside its range returns 422. There are no cursors or next links.

What count means

The two list endpoints report count differently. Write your loop for the endpoint you call.

EndpointOrdercount
List propertiesLast updated first, unless sort is setTotal matching properties, across all pages
List leadsNewest firstNumber of leads in this page

Paging through properties

count is the total, so stop when offset reaches it:

JavaScript
async function listAllProperties() {
  const properties = []
  const limit = 100
  for (let offset = 0; ; offset += limit) {
    const url = `https://api.vestta.app/v1/ext/properties?limit=${limit}&offset=${offset}`
    const response = await fetch(url, { headers: { 'X-Api-Key': process.env.VESTTA_API_KEY } })
    if (!response.ok) throw new Error(`Vestta API ${response.status}`)
    const page = await response.json()
    properties.push(...page.data)
    if (offset + limit >= page.count) return properties
  }
}

Paging through leads

count is the size of the page, so stop at the first page that is not full:

Python
import os

import requests

def list_all_leads():
    leads, limit, offset = [], 100, 0
    while True:
        response = requests.get(
            "https://api.vestta.app/v1/ext/leads",
            headers={"X-Api-Key": os.environ["VESTTA_API_KEY"]},
            params={"limit": limit, "offset": offset},
        )
        response.raise_for_status()
        page = response.json()
        leads.extend(page["data"])
        if page["count"] < limit:
            return leads
        offset += limit

Consistency

Pages are computed when each request arrives. If properties or leads change while you page through them, a result can move between pages and be skipped or returned twice. When you need a complete, exact copy, de-duplicate by id, and run the sync again later rather than relying on a single pass.

Filters are applied before pagination, including the map areas of List properties: count and the pages only contain matching properties.