Docs
open_in_new Sign in Get API key
Documentation

Pagination

List endpoints in the Klang API are cursor-paginated. Pass the cursor from the previous response back as cursor, stop when has_more is false.

Query parameters

  • limit — page size. Default 25, max 100.
  • cursor — opaque value taken from the previous response's next_cursor. Omit on the first page.

Response envelope

Every list endpoint returns the same envelope. The shape of data depends on the resource.

{
  "data": [ /* resources for this page */ ],
  "next_cursor": "eyJpZCI6Imt3M3BxMm55YXg3bHI5ZCIsInRzIjoiMjAyNi0wNC0yMlQxNTowMDowMFoifQ",
  "has_more": true
}

Iterating every page

# Page 1
GET /api/v1/conversations?limit=50

# Page 2 — pass next_cursor back as cursor
GET /api/v1/conversations?limit=50&cursor=eyJpZCI6Imt3M3BxMm55YXg3bHI5ZCIsInRzIjoiMjAyNi0wNC0yMlQxNTowMDowMFoifQ

# Stop when has_more is false

The official SDKs expose an auto-paginating iterator on every list endpoint, so you rarely need to thread cursors yourself:

for await (const c of klang.conversations.list()) {
  console.log(c.id, c.title);
}

Cursor stability

Cursors are opaque. Don't parse, build, or store them long-term. If a cursor is rejected (because it expired or the underlying data shifted), restart from the first page.