Skip to main content

Pagination

List endpoints return paginated results to manage large datasets efficiently.

Pagination Parameters

All list endpoints support these query parameters:

ParameterTypeDefaultDescription
offsetinteger0Number of items to skip
limitinteger25Number of items to return (max 100)

Request Examples

# First page (default)
GET /api/v3/speech-to-text/session

# Skip first 25, get next 25
GET /api/v3/speech-to-text/session?offset=25&limit=25

# Custom page size
GET /api/v3/speech-to-text/session?offset=0&limit=50

# Maximum page size
GET /api/v3/speech-to-text/session?offset=0&limit=100

Response Format

{
"count": 25,
"total_results": 150,
"result": [
{...},
{...}
]
}
FieldTypeDescription
countintegerNumber of items in current response
total_resultsintegerTotal items across all pages
resultarrayArray of items for current page

Examples

Python

import requests

def get_sessions(offset=0, limit=25):
response = requests.get(
'https://api.scriptix.io/api/v3/speech-to-text/session',
headers={'Authorization': 'Bearer YOUR_TOKEN'},
params={'offset': offset, 'limit': limit}
)
return response.json()

# Get first page
data = get_sessions(offset=0, limit=25)
print(f"Showing {data['count']} of {data['total_results']} total")

Iterate All Pages

def get_all_sessions():
offset = 0
limit = 100
all_sessions = []

while True:
data = get_sessions(offset=offset, limit=limit)
all_sessions.extend(data['result'])

# Check if more pages exist
if len(data['result']) < limit:
break

offset += limit

return all_sessions

# Fetch all sessions
sessions = get_all_sessions()
print(f"Retrieved {len(sessions)} total sessions")

JavaScript

async function getAllSessions() {
let offset = 0;
const limit = 100;
let allSessions = [];

while (true) {
const response = await fetch(
`https://api.scriptix.io/api/v3/speech-to-text/session?offset=${offset}&limit=${limit}`,
{
headers: { 'Authorization': 'Bearer YOUR_TOKEN' }
}
);

const data = await response.json();
allSessions = allSessions.concat(data.result);

if (data.result.length < limit) {
break;
}

offset += limit;
}

return allSessions;
}

Calculating Total Pages

data = get_sessions(offset=0, limit=25)

total_results = data['total_results']
limit = 25

total_pages = (total_results + limit - 1) // limit # Ceiling division

print(f"Total pages: {total_pages}")
print(f"Items per page: {limit}")

Paginated Endpoints

These endpoints support pagination with offset and limit:

  • GET /api/v3/speech-to-text/session - List transcription sessions
  • GET /api/v3/folders - List folders
  • GET /api/v3/tokens - List API tokens
  • GET /api/v3/organization/user - List users
  • GET /api/v3/organization/group - List teams
  • GET /api/v3/subscription - List subscriptions
  • GET /api/v3/invoices - List invoices
  • GET /api/v3/custom_models - List custom models
  • GET /api/v4/glossaries - List glossaries

See endpoint-specific documentation for details.

Best Practices

1. Use Maximum Page Size for Batch Operations

For batch operations, use limit=100 to minimize requests:

# ❌ Many requests (40 requests for 1000 items)
for i in range(0, 1000, 25):
data = get_sessions(offset=i, limit=25)

# ✅ Fewer requests (10 requests for 1000 items)
for i in range(0, 1000, 100):
data = get_sessions(offset=i, limit=100)

2. Use Smaller Pages for UI

For user interfaces, use smaller pages for faster load:

# Good for UI pagination
data = get_sessions(offset=0, limit=25)

3. Handle Empty Pages

data = get_sessions(offset=9999, limit=25)  # Beyond last page

if data['count'] == 0:
print("No results on this page")

4. Show Pagination Info to Users

def format_pagination_info(data, offset, limit):
start = offset + 1
end = offset + data['count']
total = data['total_results']

return f"Showing {start}-{end} of {total}"

# Usage
info = format_pagination_info(data, offset=0, limit=25)
# "Showing 1-25 of 150"

Rate Limiting with Pagination

Be mindful of rate limits when paginating:

import time

def get_all_sessions_rate_limited():
offset = 0
limit = 100
all_sessions = []

while True:
data = get_sessions(offset=offset, limit=limit)
all_sessions.extend(data['result'])

if len(data['result']) < limit:
break

offset += limit

# Small delay to avoid rate limits
time.sleep(0.1)

return all_sessions

See Rate Limits for details.

Combining with Filtering & Sorting

# Paginate with search query
GET /api/v3/speech-to-text/session?offset=0&limit=25&q=meeting

# Paginate with sorting
GET /api/v3/folders?offset=0&limit=50&sort=name&direction=desc

# Multiple parameters
GET /api/v3/speech-to-text/session?offset=50&limit=25&q=interview&sort=created_at&direction=desc
# Python example with all parameters
sessions = requests.get(
'https://api.scriptix.io/api/v3/speech-to-text/session',
headers={'Authorization': 'Bearer YOUR_TOKEN'},
params={
'offset': 0,
'limit': 50,
'q': 'meeting',
'sort': 'created_at',
'direction': 'desc'
}
).json()