AI92 đã ra mắt - chương trình ra mắt thử nghiệm toàn cầu của chúng tôi đang diễn ra: nền tảng đầy đủ mở cửa trên toàn thế giới trong 30 ngày đầu tiên.
Menu tài liệu

Các tài liệu dành cho nhà phát triển này hiện chỉ có bằng tiếng Anh. Mã và hành vi API giống hệt nhau ở mọi khu vực.

Pagination

List endpoints return results in pages using cursor-based pagination. Cursors are stable under inserts and deletes (unlike page numbers), so you never skip or double-read rows while paging through a moving dataset.

The scheme

Two query parameters:

ParameterTypeMeaning
limitintegerMax items to return in this page.
cursorstringOpaque pointer to the next page. Omit it on the first request.

And a consistent response envelope:

json
{
  "items": [ ... ],
  "next_cursor": "1718971801.482"
}
FieldMeaning
itemsThe page of results (newest-first for time-ordered lists).
next_cursorPass this back as cursor to fetch the next page. null means you've reached the end.

Fetching the first page

bash
curl "https://api.ai92.ai/v1/account/usage/log?limit=50" \
  -H "Authorization: Bearer ai92_live_YOUR_KEY"
json
{
  "items": [
    {
      "request_id": "b2c1...",
      "ts": "2026-06-21T10:14:22Z",
      "method": "POST",
      "endpoint": "/v1/contacts/reveal",
      "service": "contacts",
      "status": 200,
      "credits": 3,
      "latency_ms": 142,
      "trace_id": "7f3c...",
      "backend_module": "module-H"
    }
  ],
  "next_cursor": "1718966062.117"
}

Fetching the next page

Pass next_cursor from the previous response as cursor:

bash
curl "https://api.ai92.ai/v1/account/usage/log?limit=50&cursor=1718966062.117" \
  -H "Authorization: Bearer ai92_live_YOUR_KEY"

Keep going until next_cursor is null.

Looping through every page

python
import httpx

API = "https://api.ai92.ai/v1"
headers = {"Authorization": "Bearer ai92_live_YOUR_KEY"}

def iter_usage(limit=100):
    cursor = None
    while True:
        params = {"limit": limit}
        if cursor:
            params["cursor"] = cursor
        page = httpx.get(f"{API}/account/usage/log", headers=headers, params=params).json()
        yield from page["items"]
        cursor = page.get("next_cursor")
        if not cursor:
            break

for row in iter_usage():
    print(row["ts"], row["endpoint"], row["credits"])
javascript
const API = "https://api.ai92.ai/v1";
const headers = { Authorization: "Bearer ai92_live_YOUR_KEY" };

async function* iterUsage(limit = 100) {
  let cursor = null;
  do {
    const url = new URL(`${API}/account/usage/log`);
    url.searchParams.set("limit", String(limit));
    if (cursor) url.searchParams.set("cursor", cursor);
    const page = await (await fetch(url, { headers })).json();
    yield* page.items;
    cursor = page.next_cursor;
  } while (cursor);
}

for await (const row of iterUsage()) {
  console.log(row.ts, row.endpoint, row.credits);
}

Notes

  • Treat cursor as opaque. It encodes position; don't parse, construct, or persist meaning into it. Just echo it back.
  • next_cursor: null is the only end signal. Don't infer "done" from a short page — request until the cursor is null.
  • Filters compose with pagination. Endpoints that accept filters (e.g. service, status_class on the usage log) keep them stable across pages — keep passing the same filters alongside the cursor.
  • Pick a limit that fits your throughput. Larger pages mean fewer round-trips; the activity log defaults to 50.