Pagination

Page through list endpoints with cursors.

List endpoints such as GET /api/v1/Records are cursor-paginated. Rather than page numbers, you ask for a number of items relative to a cursor, and the response hands you the cursors you need to keep going. This stays stable even while records are being added.

Response shape

A paginated response wraps the results alongside the cursors and a total count:

1{
2 "items": [
3 /* ... */
4 ],
5 "beforeCursor": "0f8c1e2a-...",
6 "afterCursor": "7b3d9a14-...",
7 "totalCount": 248
8}
  • items holds the page of results.
  • afterCursor points at the next page.
  • beforeCursor points at the previous page.
  • totalCount is the total number of matching records.

Request a page

Pass a cursor together with a limit. To move forward, use afterCursor with limitAfter; to move back, use beforeCursor with limitBefore. Omit the cursor on the first request to start from the beginning.

$# First page: the most recent 50 records
$curl "https://api.minikai.com/minikai-public/api/v1/Records?limitAfter=50" \
> -H "Authorization: Bearer sk_live_..."
$
$# Next page: pass the afterCursor from the previous response
$curl "https://api.minikai.com/minikai-public/api/v1/Records?afterCursor=7b3d9a14-...&limitAfter=50" \
> -H "Authorization: Bearer sk_live_..."

Set sortDescending=false to return oldest records first. When afterCursor comes back empty, you have reached the end of the results.