> ## Documentation Index
> Fetch the complete documentation index at: https://docs.leen.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Cursor Pagination

> The Leen API supports cursor-based pagination to help you efficiently navigate through large datasets. Follow these steps to implement pagination using our API.

## Step 1: Understand the Response

The API response includes two keys:

* `next_cursor`: The cursor for the next page.
* `previous_cursor`: The cursor for the previous page.

Here’s an example response:

```json theme={null}
{
  "items": [
    { ... },
    { ... }
  ],
  "next_cursor": "eyJvZmZzZXQiOjJ9",
  "previous_cursor": "eyJvZmZzZXQiOjB9"
}
```

***

## Step 2: Use Cursors for Navigation

To navigate between pages, pass the appropriate cursor value in the `cursor` query parameter:

* **Next Page**: Use `next_cursor` from the response.
* **Previous Page**: Use `previous_cursor` from the response.

<Warning>If you include the `updatedSince` filter in your first request, **do not** include the `updatedSince` query parameter in subsequent requests that use a `cursor` query parameter. Combining these parameters will cause the API to return a 422 error.</Warning>

### Example Request

```bash theme={null}
curl -X GET "https://api.leen.dev/v1/vms/vulnerabilities" -d "enableCursor=true" -d "cursor=eyJvZmZzZXQiOjJ9"
```

***

## Step 3: Handle Edge Cases

* If `next_cursor` is `null`, you’ve reached the end of the dataset.
* If `previous_cursor` is `null`, you’re at the beginning of the dataset.

***

By following these steps, you can seamlessly implement pagination in your application using the Leen API.

<Note>The `limit` parameter is unchanged and can still be used with cursor pagination to control the page size.</Note>
