Using API v1? See what changes in v2, or the v1 docs
Pagination
Every list endpoint returns one page of results in data. When more results are available, the response also includes a cursor in meta.nextCursor. To get the next page, send that value as the cursor parameter. On the last page, nextCursor is null.
{
"success": true,
"data": [ { "id": "..." }, { "id": "..." } ],
"meta": { "nextCursor": "cur_4f2a9c1e7b3d4a6f8e0c2b1d5a7c9e3f" },
"provider": "google",
"traceId": "trc_..."
}
// Every event in the window, across every page:
for await (const event of pyas.events.list({ accountId, from, to })) {
console.log(event.title)
}
// Or one page at a time:
const page = await pyas.events.list({ accountId, from, to, limit: 50 })
const next = await page.next() // null after the last page
Rules
- When you send a cursor, send the same query parameters that you sent for the first page. Only
limitcan be different. A cursor that Pyas generates (cur_...) remembers its query, and the API rejects it with a different one. Other cursors don't, so a different query returns the wrong page. - You can reuse a cursor. The same cursor always returns the same page, so it's safe to retry a request.
- Cursors that Pyas generates (
cur_...) are valid for 1 day, so don't store them. To continue later, start again from the first page. limitsets the page size. Each list endpoint has its own default and maximum:
| List | Default | Maximum |
|---|---|---|
| Events, occurrences | 100 | 250 |
Events by metadata (metadata.<key>=) | 50 | 100 |
| Accounts | 50 | 200 |
| Webhook events and deliveries | 50 | 100 |
| Request logs | 50 | 100 |
A page can contain fewer items than limit and still have a next page, because filters can exclude some items from a page. Keep requesting pages until nextCursor is null.
Order
Accounts are returned in the order they were added. Webhook events, deliveries and request logs are returned newest first.
Events from a single calendar are returned in the provider's order. To sort them by start time, use expand=true with sort=start. To sort them by last update, use sort=updated. Events from several accounts are returned as a single timeline, sorted by start time.
To track changes to a calendar instead of paging through it again, use a sync token.