Using the API
View as Markdown

Pagination

Page through list endpoints with limit and offset, and use has_more to tell when you've reached the last page.

Last updated

Every list endpoint pages the same way. You ask for a page with limit and offset, and the response says how many items there are in total and whether another page follows.

Request parameters

ParameterMeaning
limitHow many items to return. Each endpoint has its own default and maximum, listed below.
offsetHow many items to skip before this page. Defaults to 0.

A limit outside the endpoint's range, or a negative offset, answers 400 VALIDATION_ERROR.

Response fields

The items are under a key named for the resource, such as leads or deals. Alongside them, every list response carries:

FieldMeaning
countItems in this page.
totalItems matching the request, across all pages.
limitThe page size that was applied.
offsetItems skipped before this page.
has_moretrue when another page follows.

Page through a list

Request pages until has_more is false, advancing offset by count each time:

async function listAllLeads() {
  const leads = [];
  let offset = 0;
  while (true) {
    const url = new URL("https://api.versionseven.ai/v1/leads");
    url.searchParams.set("limit", "100");
    url.searchParams.set("offset", String(offset));

    const response = await fetch(url, {
      headers: { Authorization: `Bearer ${process.env.VICTORIA_API_KEY}` },
    });
    if (!response.ok) throw new Error(`Request failed with status ${response.status}`);

    const page = await response.json();
    leads.push(...page.leads);
    if (!page.has_more) return leads;
    offset += page.count;
  }
}

Limits by endpoint

EndpointItems keyDefault limitMaximum limit
GET/v1/accountsaccounts500500
GET/v1/leadsleads20100
GET/v1/campaignscampaigns500500
GET/v1/campaigns/{campaign_id}/webhookswebhooks100500
GET/v1/crm/pipelinespipelines100500
GET/v1/crm/dealsdeals50100

Ordering

Results come back in a stable order, with ties broken by id, so paging never repeats or skips an item while the underlying data stays the same. Leads, campaigns and deals are listed newest first, so records created while you page push later pages along. If you need an exact snapshot of a large list, collect the IDs first and fetch details afterwards.

page on the leads list

GET /v1/leads also accepts page, its original way of paging, and returns page in the response. Prefer offset, which works the same on every list endpoint. When a request sends both, offset wins.