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

Both list endpoints report the total matching records across all pages, including when the requested page is empty.

EndpointOrdercount
List propertiesLast updated first, unless sort is setTotal matching properties, across all pages
List leadsNewest firstTotal contacts, across all pages

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/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

Stop when the offset reaches the total:

Python
import os

import requests

def list_all_leads():
    leads, limit, offset = [], 100, 0
    while True:
        response = requests.get(
            "https://api.vestta.app/v1/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 offset + limit >= page["count"]:
            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.