How to Paginate Results
Learn how to fetch large volumes of data efficiently.
Problem
You need to fetch many results but don't want to overload the API or your application.
Solution
Use the limit parameter to control the number of results per request.
Basic Usage of Limit
curl -X POST https://api-integrations.snackprompt.com/v1/kb/search \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"query": "products",
"filters": {
"tenant_id": "your-tenant-id"
},
"limit": 10
}'Recommended Values
Use Case
Limit
Reason
Chat/RAG
3-5
Focused context, better response
Results list
10-20
Good UX/performance balance
Export
50-100
Higher volume per request
Pagination Strategies
1. Pagination by Relevance (recommended)
Since semantic search orders by relevance, use limit to get the top N most relevant:
2. Filters to Segment
Use filters to "paginate" by categories:
3. Incremental Search
For "load more" interfaces:
Complete Example: List with "See More"
Python Example
Performance Considerations
1. Maximum Recommended Limit
2. Cache Results
3. Debounce for Incremental Searches
Related
Last updated
Was this helpful?