Skip to main content
REST API

API Pagination

Efficiently retrieve large datasets with cursor-based pagination.

Overview

List endpoints return paginated results to ensure optimal performance. The Infodeck API uses cursor-based pagination with limit and lastEvaluatedKey parameters.


Request Parameters

ParameterTypeDefaultDescription
limitinteger20Number of items per page (max: 100)
lastEvaluatedKeystringCursor for the next page (from previous response)

Response Structure

{
"data": [...],
"lastEvaluatedKey": "eyJpZCI6ImEtMTIzNDU2In0="
}
FieldDescription
dataArray of items for the current page
lastEvaluatedKeyCursor to fetch the next page. null or absent when no more pages exist.

Example: Fetching All Work Orders

First Request

curl "https://app.infodeck.io/api/organizations/{orgId}/work-orders?limit=50" \
-H "X-API-Key: idt_live_your_api_key_here"
const API_KEY = 'idt_live_your_api_key_here';
const ORG_ID = 'your-organization-id';

const response = await fetch(
`https://app.infodeck.io/api/organizations/${ORG_ID}/work-orders?limit=50`,
{
headers: { 'X-API-Key': API_KEY }
}
);

const { data, lastEvaluatedKey } = await response.json();
import requests

API_KEY = 'idt_live_your_api_key_here'
ORG_ID = 'your-organization-id'

response = requests.get(
f'https://app.infodeck.io/api/organizations/{ORG_ID}/work-orders',
params={'limit': 50},
headers={'X-API-Key': API_KEY}
)

result = response.json()
data = result['data']
last_key = result.get('lastEvaluatedKey')

Subsequent Requests

Pass the lastEvaluatedKey from the previous response to get the next page:

curl "https://app.infodeck.io/api/organizations/{orgId}/work-orders?limit=50&lastEvaluatedKey=eyJpZCI6ImEtMTIzNDU2In0=" \
-H "X-API-Key: idt_live_your_api_key_here"
// Continue fetching until no more pages
let cursor = lastEvaluatedKey;

while (cursor) {
const nextResponse = await fetch(
`https://app.infodeck.io/api/organizations/${ORG_ID}/work-orders?limit=50&lastEvaluatedKey=${encodeURIComponent(cursor)}`,
{
headers: { 'X-API-Key': API_KEY }
}
);

const result = await nextResponse.json();
data.push(...result.data);
cursor = result.lastEvaluatedKey;
}
# Fetch all pages
all_data = data.copy()

while last_key:
response = requests.get(
f'https://app.infodeck.io/api/organizations/{ORG_ID}/work-orders',
params={'limit': 50, 'lastEvaluatedKey': last_key},
headers={'X-API-Key': API_KEY}
)
result = response.json()
all_data.extend(result['data'])
last_key = result.get('lastEvaluatedKey')

Best Practices

  1. Use reasonable page sizes — Start with limit=50 for most use cases
  2. Don't store cursors long-term — Cursors may expire; use them immediately
  3. Handle empty pages — A response with empty data and no lastEvaluatedKey means you've reached the end
  4. Implement retry logic — Network issues can interrupt pagination; track your position

Endpoints Supporting Pagination

Most list endpoints support pagination:

  • GET /organizations/{orgId}/work-orders
  • GET /organizations/{orgId}/assets
  • GET /organizations/{orgId}/locations
  • GET /organizations/{orgId}/forms
  • GET /organizations/{orgId}/decks
  • GET /organizations/{orgId}/api-keys

Need help? Contact Support

Was this page helpful?