Skip to main content
Documentation

Pagination, errors & retries

A useful client handles more than the happy path. Treat authorization failures, rate limits, and empty pages as explicit states.

Paginate pinned introductions​

GET /introductions uses zero-based page and pageSize (maximum 100). Responses include page, pageSize, and totalCount. Fetch the next page while (page + 1) * pageSize < totalCount.

const base = 'https://api.vieu.com/api/v2';
let page = 0;

while (true) {
const url = new URL(`${base}/introductions`);
url.searchParams.set('page', String(page));
url.searchParams.set('pageSize', '100');
const response = await fetch(url, {
headers: { 'x-api-key': process.env.VIEU_API_KEY },
});
const body = await response.json();
if (!response.ok) throw new Error(JSON.stringify(body));
console.log(body); // Process this page in your integration.
if ((body.page + 1) * body.pageSize >= body.totalCount) break;
page += 1;
}

Search endpoints and saved-list endpoints have different response shapes. Do not apply this pagination loop to every route.

Choose your response to each error​

StatusWhat to do
400Fix the parameters; resending the same request will not help.
401Check or rotate the key.
403Request the missing scope.
404Verify the ID and tenant; the resource may be unavailable.
429Honor Retry-After when present, then retry with bounded backoff.
500Retry eligible reads with bounded exponential backoff and jitter.

Limits apply per tenant. Read the RateLimit response header rather than hardcoding a request rate. See rate limits.

Put bounds on retries​

Use a timeout for each request and a maximum number of attempts. Do not automatically retry writes unless the operation’s duplicate behavior is understood. A network timeout does not prove a write failed.

For person contact details, a successful response can include tryLater: true while email resolution is in progress. Retry no more often than every 15 seconds; see the contact reference.

Practice failure states​

Choose 401 or 429 in the inline example’s demo response scenarios. These are labeled simulations backed by local JSON fixtures, so no live key or rate-limit exhaustion is needed.