Skip to main content

Pagination

List endpoints in the Agentix API use offset-based pagination. You control how many items to retrieve and where to start in the result set.

Query Parameters

ParameterTypeDefaultMaxDescription
limitinteger20100Number of items to return per page
offsetinteger0Number of items to skip from the beginning

Response Format

Paginated endpoints return an object with an items array and a total count:
{
  "items": [
    { "id": "550e8400-...", "name": "Customer Support Bot" },
    { "id": "6ba7b810-...", "name": "Lead Qualifier" }
  ],
  "total": 47
}
FieldTypeDescription
itemsarrayThe page of results
totalintegerTotal number of matching items across all pages
Use total to calculate the number of pages: Math.ceil(total / limit).

Paginated Endpoints

The following list endpoints support limit and offset:
EndpointDescription
GET /api/contactsList contacts
GET /api/conversationsList conversations
GET /api/runsList workflow runs
GET /api/broadcastsList broadcasts
GET /api/broadcasts/{id}/recipientsList broadcast recipients
GET /api/groups/{id}/contactsList group contacts
Some list endpoints (like GET /api/workflows, GET /api/tags, GET /api/tools) return all items without pagination. These endpoints typically have smaller result sets.

Examples

First Page

cURL
curl "https://api.agentixx.io/api/contacts?limit=20&offset=0" \
  -b cookies.txt \
  -H "x-tenant-id: your-workspace-uuid"
Node.js
const response = await fetch(
  'https://api.agentixx.io/api/contacts?limit=20&offset=0',
  {
    headers: {
      'Cookie': `session_token=${sessionToken}`,
      'x-tenant-id': 'your-workspace-uuid',
    },
  }
);

const { items, total } = await response.json();
console.log(`Showing ${items.length} of ${total} contacts`);

Fetching All Pages

Node.js
async function fetchAllContacts(sessionToken, tenantId) {
  const allContacts = [];
  let offset = 0;
  const limit = 100; // Max per page

  while (true) {
    const response = await fetch(
      `https://api.agentixx.io/api/contacts?limit=${limit}&offset=${offset}`,
      {
        headers: {
          'Cookie': `session_token=${sessionToken}`,
          'x-tenant-id': tenantId,
        },
      }
    );

    const { items, total } = await response.json();
    allContacts.push(...items);

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

  return allContacts;
}