Skip to content

Commit

Permalink
fix: clarify pagination best practices
Browse files Browse the repository at this point in the history
  • Loading branch information
christiannwamba committed Jan 8, 2025
1 parent 9a8f165 commit 7a3ca60
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/guides/pagination.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ better performance and consistency compared to traditional offset-based paginati

![Token pagination illustration](./_static/pagination/token-pagination.png)

### Default behavior and parameters
### Pagination parameters

By default, Ory paginates list data with a page size of 250 items per page. However, you can customize this behavior using two key
parameters:
Ory uses two parameters to paginate through data:

1. `page_size`: Determines the number of items returned per page.
2. `page_token`: Acts as a pointer to a specific page in the dataset.
Expand Down Expand Up @@ -81,6 +80,8 @@ Imagine you have 300 customers in your Ory project, and you want to list them 10
- Always use the tokens provided in the `link` header for navigation. Do not attempt to generate or modify these tokens yourself.
- If you need to start from the beginning, use the `first` link or omit the `page_token` parameter.
- Keep track of the previous/current `next` token to allow for backward pagination through your results.
- Be prepared for the maximum `page_size` to change. Your implementation should handle such changes gracefully.
- Do not attempt to reverse engineer or make assumptions about the `page_token` format, as it may change without notice. Always treat it as an opaque string.

By leveraging token-based pagination, you can efficiently navigate through large datasets in Ory, ensuring consistent and
performant data retrieval.
Expand Down

0 comments on commit 7a3ca60

Please sign in to comment.