# Pagination

All top-level API resources have support for bulk fetches through API methods that respond with a list. These list API methods share a common structure and accept, at a minimum, the following two parameters: `limit` and `offset`.

## Pagination limits and page size

slaOS API uses offset based pagination through the `limit` and `offset` parameters. Both parameters accept an existing object ID value (see below) and return objects in chronological order. The `limit` parameter specifies how many records to fetch per page. The `offset` parameter indicates where to start fetching data or how many records to skip, defining the initial position within the list.

See details on the parameters below [👇](https://emojipedia.org/backhand-index-pointing-down)

| Parameters | Description                                                                                                                                   |
| ---------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| limit      | Limit specifies how many records to fetch per page. Default value is 10.                                                                      |
| offset     | Offset indicates where to start fetching data or how many records to skip, defining the initial position within the list. Default value is 0. |

In the response, you will get the total number of items (`total`) which signifies how many results of data we have for the requested information.

## Example

For example, if you call  `GET https://api.rated.co/v1/slis/` you will get all the SLIs that are currently defined on your workspace.

<details>

<summary>Example of a paginated response</summary>

```json
{
  "total": 100,
  "results": [
    {
      "id": "string",
      "name": "string",
      "type": "value",
      "description": "string",
      "unit_of_measure": "string",
      "queries": {
        "additionalProp1": {
          "select": "string",
          "where": "string",
          "from": "string",
          "limit": 0
        },
        "additionalProp2": {
          "select": "string",
          "where": "string",
          "from": "string",
          "limit": 0
        },
        "additionalProp3": {
          "select": "string",
          "where": "string",
          "from": "string",
          "limit": 0
        }
      },
      "formula": "string",
      "created_at": "2024-12-09T11:08:25.973Z",
      "updated_at": "2024-12-09T11:08:25.973Z"
    }
  ],
  "next": "https://endpoint?limit=100&offset=0",
  "previous": "https://endpoint?limit=100&offset=100"
}
```

</details>

Depending on the request, you can also get more than one page of results. You can navigate between these pages using the `previous` and `next` URLs. Just use the URL in `next` to continue fetching the rest of the data. You will also get a url in `previous` as you navigate throught pages 2,3,4... and so on. When there's no more data left, the API will stop giving you the next link and show `next: null`.<br>


---

# 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://docs.rated.co/api-beta/pagination.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.
