> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nixflex.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Build reliable paginated API reads

> Read Nixflex cursor and offset lists without changing their filters, losing message ties or treating an offset scan as a stable snapshot.

**FIXED · account** Inbound and outbound share the account/API-key concurrency budget. Read max\_concurrent for the effective limit.

**NOT OFFERED → do this instead · number** No per-number concurrency reservation exists. Queue or pace each business within the shared account call budget.

**YOU CAN CHANGE · account** Pace submissions. Accepted work may wait for capacity.

**SCOPE · operation** Check the code and details to distinguish refusal, acceptance and unknown outcome before retrying.

[Read the compact AI rules](https://docs.nixflex.com/ai-rules.md#limits-errors)

Build a list adapter for each endpoint’s paging shape, preserving its account, filters and progress until the scan finishes.

Cursor: **Opaque server value** · Offsets: **Not a snapshot** · Progress: **After processing**

**The important part**

* There is no universal page parameter or list envelope.
* Reject repeated cursors and bound long scans.
* Store progress after processing a page; concurrent changes can shift offset rows.

[Business guide](https://docs.nixflex.com/business.md) · [API reference](https://docs.nixflex.com/api-reference/introduction.md) · [Glossary](https://docs.nixflex.com/guides/glossary.md)

## Choose the correct list adapter

| List | Next request | Stop condition |
| - | - | - |
| Phone numbers | Returned `next_cursor` as `cursor`, with unchanged filters and limit | `has_more:false` and no next cursor |
| Agents | Increase offset by returned array length | Empty array or fewer than the requested limit |
| Organisation Activity | Returned `next_cursor` as `before` | No next cursor; a final empty read can be needed |
| Voice catalog | Returned cursor | No next page; restart an expired cursor |
| Inbox messages | Returned `before` and `before_id` together | No next message cursor |

Numbers opt into paging with `limit` from 1–100. Without limit or cursor the response has no cursor fields. Agents return a bare array and accept limit 1–200. Read the route's exact [paging rules](https://docs.nixflex.com/api-reference/pagination.md) before choosing an adapter.

## Read number pages with a bounded loop

This Node example makes safe reads only. Configure the server credential and an approved API base URL privately. The 100-page cap is an application choice, not a server limit.

```javascript theme={"dark"}
const baseUrl = 'https://api.nixflex.com';
const apiKey = process.env.NIXFLEX_API_KEY;
if (!baseUrl || !apiKey) throw new Error('Configure the API connection privately');
const seen = new Set();
let cursor;
const numbers = new Map();
for (let pageIndex = 0; pageIndex < 100; pageIndex++) {
  const url = new URL('/v1/phone-numbers', baseUrl);
  url.searchParams.set('limit', '50');
  if (cursor) url.searchParams.set('cursor', cursor);
  const response = await fetch(url, {
    headers: { Authorization: `Bearer ${apiKey}` },
    signal: AbortSignal.timeout(10000),
    redirect: 'error',
  });
  if (!response.ok) throw new Error(`List read failed: HTTP ${response.status}`);
  const page = await response.json();
  if (!Array.isArray(page.phone_numbers)) throw new Error('Unexpected list response');
  for (const number of page.phone_numbers) numbers.set(number.phone_number, number);
  if (page.has_more === false && page.next_cursor == null) break;
  if (typeof page.next_cursor !== 'string' || seen.has(page.next_cursor)) {
    throw new Error('Missing or repeated cursor; stop the scan');
  }
  seen.add(page.next_cursor);
  cursor = page.next_cursor;
  if (pageIndex === 99) throw new Error('Application scan limit reached');
}
// Use the private map; do not log number configuration or credentials.
```

## Preserve progress and stable filters

Keep the account, base URL, filters and order unchanged. URL-encode an opaque cursor without decoding its contents. In a durable worker, save the next cursor only after processing that page successfully; make processing tolerant of repeated resource IDs.

Offset pages are not a database snapshot. New or removed rows can shift offsets. If a task requires a complete auditable export, use its documented export workflow instead of assuming a long list scan is a frozen report.

## Recover from paging errors

| Result | What to do |
| - | - |
| Empty successful page | Treat it as valid according to that endpoint's stop rule. |
| Expired/stale cursor | Restart with the same intended filters and deduplicate processed IDs. |
| Repeated cursor | Stop and investigate; never spin indefinitely. |
| 429 or temporary read failure | Honour the returned delay and an overall deadline. |
| Message timestamp tie | Supply both cursor fields so equal-time messages are not skipped. |

## Next steps

* [Control request pacing](https://docs.nixflex.com/guides/developer/rate-limits.md)
* [Read inbox conversations](https://docs.nixflex.com/guides/developer/agent-inbox.md)
* [Choose an SDK iterator](https://docs.nixflex.com/sdks/node.md#pagination)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.