GuidesConventions
Pagination
Long lists come a page at a time. Pass limit for the page size and the previous page’s next_cursor as cursor for the next one.
Cursor pages
| List | limit | Notes |
|---|---|---|
GET /v1/envelopes | 25 by default, up to 100 | Newest first. Filter with status, external_ref and label (repeat it: all must match). |
GET /v1/templates | 25 by default, up to 100 | Every template in the account. |
GET /v1/folders/{id}/children | 100 by default, up to 500 | company for the top of Company files. Live keys only. |
Each page is a list object. While has_more is true, ask again with cursor. Treat the cursor as opaque: a cursor we didn’t give you is 400 invalid_cursor.
{
"object": "list",
"data": [ { "id": "env_4f9c2d7e1b8a4c6f9e2d3b7a1c5e8f02", "object": "envelope", "…": "…" }, { "…": "…" } ],
"has_more": true,
"next_cursor": "NjM4OTc2NDk1MTIwMDAwMDAwfDRmOWMyZDdl…"
}const auth = { Authorization: `Bearer ${process.env.SA_API_KEY}` };
let cursor = null;
do {
const url = new URL("https://api.skanything.io/v1/envelopes");
url.searchParams.set("limit", "100");
if (cursor) url.searchParams.set("cursor", cursor);
const page = await (await fetch(url, { headers: auth })).json();
for (const envelope of page.data) console.log(envelope.id, envelope.status);
cursor = page.has_more ? page.next_cursor : null;
} while (cursor);import os
import requests
auth = {"Authorization": f"Bearer {os.environ['SA_API_KEY']}"}
params = {"limit": 100}
while True:
page = requests.get("https://api.skanything.io/v1/envelopes", headers=auth, params=params).json()
for envelope in page["data"]:
print(envelope["id"], envelope["status"])
if not page["has_more"]:
break
params["cursor"] = page["next_cursor"]using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json;
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SA_API_KEY"));
string? cursor = null;
do
{
var url = "https://api.skanything.io/v1/envelopes?limit=100" + (cursor is null ? "" : "&cursor=" + Uri.EscapeDataString(cursor));
var page = await http.GetFromJsonAsync<JsonElement>(url);
foreach (var envelope in page.GetProperty("data").EnumerateArray())
Console.WriteLine($"{envelope.GetProperty("id")} {envelope.GetProperty("status")}");
cursor = page.GetProperty("has_more").GetBoolean() ? page.GetProperty("next_cursor").GetString() : null;
} while (cursor is not null);Lists that come whole
The other lists answer in one go with has_more: false: an envelope’s documents, recipients, fields and events, and webhook endpoints. Webhook deliveries return the 100 most recent. Grants, links, file requests, file versions and search results come whole too. The change feed pages its own way.