# Enable Pagination

### Video

{% embed url="<https://www.youtube.com/watch?t=1s&v=lm4GUQ6mIxM>" %}

You can configure an API flow to paginate response data from the *Response* object.

Pagination is a process that is used to divide large data into smaller discrete pages, thus allowing for less clutter and better readability. It also means that server request processing will be faster as a small subset is to be returned. Hence, improving the overall API performance and readability.

For our use case, we have an API flow that is configured to retrieve a collection of order items using a database lookup along with filter and sort functionalities enabled. Now, let us see how pagination can be configured in this flow.

![](/files/wNkkR1OgwarhWXtObbJy)

1. Right-click on the *Response* object and select *Properties* from the context menu.

![](/files/hIGogVdDQJC7ZkxGz9JF)

This will open the *Properties* window.

![](/files/p7J0GA20d20XcZGQ4Zf3)

2. Click *Next* until you reach the *Response Configuration* window.

This is where you can set up pagination options to better structure the response data fetched for a successful 200-OK request.

![](/files/q6IjbKXZGuRvRQDW1mh9)

*Enable Cursor Pagination:* Checking this box lets the incoming data be paginated by a cursor. Cursor-based pagination works by returning a pointer to the last item in the dataset page, using which the client can make successive requests to read the next set of records iteratively. Once all records have been read, the cursor value becomes null, thus indicating that no more records are left to be read.

*Page Size:* This counter determines the number of records returned in a single requested page.

3. Click *OK* and the *Response* object will be configured in accordance with the cursor pagination and page size.

![](/files/X7FHo07MVEOnw7zKCKwe)

{% hint style="info" %}
**Note:** Any request made to this endpoint will return the first n (page size) records along with a ‘cursor’ field in the response payload. This cursor field can then be reiterated in the next request as a Query Parameter named ‘Cursor’ to fetch the next n (page size) records.
{% endhint %}

At runtime, these paginated calls are cached on the server. To learn more about it, click [here.](/api-flow/api-consumption/consume/pagination.md)<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://documentation.astera.com/api-flow/api-publishing/develop/enable-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.
