Pagination
Understanding cursor-based pagination across Mixedbread API endpoints. Learn how to navigate through large result sets efficiently using cursors, handle pagination parameters, and implement robust pagination logic.
Overview
Mixedbread API uses cursor-based pagination for endpoints that return large result sets. This approach provides consistent performance regardless of dataset size and ensures reliable pagination even when data is being modified.
Supported Endpoints
Cursor-based pagination is used for:
Pagination Parameters
Request Parameters
Include these query parameters in your requests:
| Parameter | Type | Description | Default |
|---|---|---|---|
before | string | Cursor for pagination. Returns items before this cursor. | - |
after | string | Cursor for pagination. Returns items after this cursor. | - |
limit | integer | Maximum number of items to return (1-100). | 20 |
Important Notes:
- Use either
beforeORafter, not both - Cursors are opaque strings - don't parse or modify them
- Always include
limitto control result size
Response Format
All paginated responses include:
{
"data": [...],
"pagination": {
"first_cursor": "eyJpZCI6InZzXzEyMyJ9",
"last_cursor": "eyJpZCI6InZzXzQ1NiJ9",
"has_more": true
}
}| Field | Type | Description |
|---|---|---|
data | array | The actual results for the current page |
first_cursor | string | Cursor pointing to the first item in current page |
last_cursor | string | Cursor pointing to the last item in current page |
has_more | boolean | Whether more results are available |
Navigation Patterns
Forward Pagination
Start with no cursor to get the first page:
GET /v1/stores?limit=10Continue with last_cursor from the previous response:
GET /v1/stores?after=eyJpZCI6InZzXzQ1NiJ9&limit=10Backward Pagination
Use first_cursor with before parameter:
GET /v1/stores?before=eyJpZCI6InZzXzEyMyJ9&limit=10GET /v1/stores?limit=4
{
"data": [...],
"pagination": {
"first_cursor": "k2Vd9x",
"last_cursor": "Hy5uBn",
"has_more": true
}
}has_more refers to stores after this page, the direction of this request.
First page: nothing before it
GET /v1/stores?limit=4&after=Hy5uBn
limit=4 so 13 stores span 4 pages; the API default is 20.