limit
and offset
query parameters.
The Miru API paginates results to efficiently manage large datasets, returning a subset of items along with metadata to help you retrieve additional pages.
Currently, the Miru API uses offset-based pagination, with support for cursor-based pagination coming soon.
limit
and offset
query parameters.
limit
specifies the maximum number of items which can be returned in a single request.
The default is 10 while the maximum is 100.
offset
specifies the starting position of the current page.
The default is 0.
limit
and offset
query parameters to the list endpoint URL.
The following request specifies a limit of 10 and an offset of 0 by appending ?limit=10&offset=0
to the list endpoint URL.
object
is always a string with the value “list” to indicate that it is a list response.
Total Count
total_count
is the total number of items matching the query. By default, the total count is not computed (and thus set to -1
) to avoid the performance cost of counting all items.
To get the total count, you must explicitly request it using the expand[]=total_count
parameter. While useful, the total count is typically not needed and can incur significant performance costs, so please use judiciously. See the total_count
expansion documentation for more information about retrieving the total count.
limit
specifies the number of items returned in the response.
If a valid value is provided (e.g., 10
), the response will reflect that value.
If an invalid value is provided (e.g., 1001
), the closest valid value will be used instead (in this case, 100
).
offset
indicates the starting index of the returned items.
If a valid value is provided (e.g., 5
), the response will reflect that value.
If an invalid value is provided (e.g., -3
), the closest valid value will be used instead (0
in this case).
has_more
is a boolean that indicates whether more items exist beyond the current page.
If true
, you can fetch the next page by increasing the offset
by the limit
.
data
is an array of the actual items returned by the query.
The number of items in the array will be less than or equal to the specified limit
.
has_more
is false
. The next page uses the same limit
but the offset
is increased by the limit
.
First, let’s make a request with a limit of 10 and an offset of 0.
has_more
is false
, there are no more items after the current page. If has_more
is true
, more items exist after the current page. The next pagination request uses the same limit
but the offset
is increased by the limit
: offset = offset + limit
.
This gives us an offset of 10 and a limit of 10. Simply repeat this process until has_more
is false
. The next request would use an offset of 20 and a limit of 10, then 30 and 10, and so on.