Vidyst API

Pagination

Lists come a page at a time; follow the cursor to get them all.

Endpoints that return lists, such as list webinars, answer one page at a time:

{
  "data": [ … ],
  "nextCursor": "eyJ2IjoyLCJzIjoiLWNyZWF0ZWRBdCJ9",
  "hasMore": true
}
  • limit sets the page size (1–100, default 20). A page can hold fewer, and the last usually does.
  • nextCursor is where the next page starts. Send it back as cursor. It's null on the last page, and then hasMore is false.
  • A cursor is opaque. Don't build or change one, or rely on what's inside.

Getting every page

async function allWebinars(params = {}) {
  const items = [];
  let cursor = null;
  do {
    const query = new URLSearchParams({ ...params, limit: "100", ...(cursor ? { cursor } : {}) });
    const res = await fetch(`https://vapi.vidyst.com/public/v1/webinars?${query}`, {
      headers: { Authorization: `Bearer ${process.env.VIDYST_API_KEY}` },
    });
    if (!res.ok) throw new Error(`${res.status} ${(await res.json()).code}`);
    const page = await res.json();
    items.push(...page.data);
    cursor = page.nextCursor;
  } while (cursor);
  return items;
}

Every request counts against your rate limit, so use the largest limit you can when you need everything.

Cursors and filters

A cursor continues the exact list it came from. Send it with the same filters and the same sort. Changing either while paging is 400 invalid_cursor: start again from the first page instead.

Consistency

Pages are cut by position in the sort order, not by number, so paging stays correct while things change:

  • Nothing is skipped or repeated because something else was created or deleted between two requests.
  • Something created after you started appears only if it sorts after where you are: at the end for createdAt, and not at all for the default newest-first order, which you're already past. Start again to see the newest.
  • A webinar is shown as it is when its page is read. If the field you sort by changes while you page (a webinar rescheduled while you list by scheduledAt), it can move past your position and show up twice, or not at all. Sort by createdAt for a list that never moves under you.

On this page