AurionAI Docs

Pagination

Paginate through list results using offset-based pagination.

Pagination

The primary list endpoints (GET /api/v1/tickets, GET /api/v1/calls) return paginated results using offset-based pagination via limit and offset query parameters. A few other list endpoints differ slightly — see Endpoints that differ below.

Query Parameters

ParameterTypeDefaultConstraintsDescription
limitinteger201100Number of results per page. Out-of-range values return 422.
offsetinteger0>= 0Number of results to skip. Out-of-range values return 422.

Response Envelope

List responses use a resource-named array key (matching the resource being listed — tickets, calls, …), not a generic data key, plus pagination metadata:

{
  "tickets": [
    { "id": "tkt_1", "subject": "Ticket A" },
    { "id": "tkt_2", "subject": "Ticket B" }
  ],
  "total": 142,
  "limit": 20,
  "offset": 0
}

The GET /api/v1/calls envelope is identical except the array key is calls:

{
  "calls": [ /* ... */ ],
  "total": 142,
  "limit": 20,
  "offset": 0
}
FieldTypeDescription
<resource>arrayThe page of results (tickets for the tickets endpoint, calls for the calls endpoint)
totalintegerTotal number of matching results
limitintegerPage size used
offsetintegerOffset used

Paginating Through Results

Fetch the first page:

curl "https://apps.aurionai.net/api/v1/tickets?limit=20&offset=0" \
  -H "X-API-Key: itsm_sk_live_xxxx"

Fetch the next page by incrementing offset by limit:

curl "https://apps.aurionai.net/api/v1/tickets?limit=20&offset=20" \
  -H "X-API-Key: itsm_sk_live_xxxx"

Iterating All Pages

Python
import requests

def get_all_tickets(api_key: str) -> list:
    tickets = []
    offset = 0
    limit = 100

    while True:
        response = requests.get(
            "https://apps.aurionai.net/api/v1/tickets",
            headers={"X-API-Key": api_key},
            params={"limit": limit, "offset": offset},
        )
        page = response.json()
        tickets.extend(page["tickets"])

        if offset + limit >= page["total"]:
            break
        offset += limit

    return tickets
TypeScript
async function getAllTickets(apiKey: string) {
  const tickets = [];
  let offset = 0;
  const limit = 100;

  while (true) {
    const response = await fetch(
      `https://apps.aurionai.net/api/v1/tickets?limit=${limit}&offset=${offset}`,
      { headers: { "X-API-Key": apiKey } }
    );
    const page = await response.json();
    tickets.push(...page.tickets);

    if (offset + limit >= page.total) break;
    offset += limit;
  }

  return tickets;
}

Endpoints that differ

Not every list endpoint follows the tickets/calls envelope above. When integrating with these endpoints, do not assume a total/limit/offset envelope:

EndpointDefault limitMax limitEnvelope
GET /api/v1/tickets20100{ "tickets": [...], "total", "limit", "offset" }
GET /api/v1/calls20100{ "calls": [...], "total", "limit", "offset" }
GET /api/v1/usage/details50200{ "events": [...], "groups": [...], "total", "limit", "offset" } — the result array is events or groups depending on group_by; the pagination fields may be null.
GET /api/v1/webhooksn/an/a{ "webhooks": [...] } — returns the full list with no total/limit/offset.
GET /api/v1/webhooks/{webhook_id}/deliveries50200{ "deliveries": [...] } — accepts a limit query param but returns no total/offset.

Best Practices

  • Use the maximum limit (100 for tickets/calls) when fetching all records to minimize API calls
  • Check total to determine if more pages exist rather than checking for an empty result array (only on endpoints that return total — see the table above)
  • Add filters to reduce result sets — filtering server-side is faster than fetching everything

On this page