# Pagination and sorting

`pg[limit]`

Defines the maximum number of results to return. For example, `pg[limit]=100`. The default value varies with different resources.

`pg[offset]`

Defines the number of results you want to skip before getting the results you need. For example, `pg[offset]=10`. The default value for most endpoints is `0`.

`pg[sortBy]`

Defines the property by which to sort results. For example, `pg[sortBy]=id`. By default, results are usually sorted by `name` or `id`.

`pg[sortDir]`

Defines the sorting order. Use `asc` for ascending order, use `desc` for descending order. The default ordering direction is usually ascending.

**Example:**

Let’s say we want to retrieve data stores that belong to the team with ID 212.

{% stepper %}
{% step %}
The request URL with the default pagination settings looks as follows:

```
{zone_url}/api/v2/data-stores?teamId=212
```

Where `zone_url` is the URL of your Make zone. For example: `https://eu1.make.com`
{% endstep %}

{% step %}
Add the pagination parameters.

In this case, we want to skip the first 10 results, limit the results to 50 data stores and sort them in ascending order. Use the following query parameters:

```
&pg%5Boffset%5D=10&pg%5BsortDir%5D=asc&pg%5Blimit%5D=50
```

{% endstep %}

{% step %}
The full request URL looks like this:

```
{base_url}/data-stores?teamId=212&pg%5Boffset%5D=10&pg%5BsortDir%5D=asc&pg%5Blimit%5D=50
```

Where `base_url` is `https://eu1.make.com/api/v2`
{% endstep %}
{% endstepper %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.make.com/api-documentation/pagination-sorting-filtering/pagination-and-sorting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
