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

# Pagination

> List endpoints in the GoStudio v2 API use cursor-based pagination. This page explains how to traverse pages, filter results, and sort responses.

<Note>
  No Watermark Remover endpoint is paginated — each one returns a single job or a single object. This page documents the convention used by the wider GoStudio v2 API, so that a list endpoint behaves the way you expect when you meet one.
</Note>

## How it works

GoStudio uses **opaque cursor tokens** to mark your position in a result set. Every list response includes a `pagination` object alongside the `data` array:

```json theme={null}
{
  "status": 200,
  "data": {
    "data": [
      { "id": 101, "status": "completed" },
      { "id": 100, "status": "completed" }
    ],
    "pagination": {
      "next_cursor": "MjAyNi0wMS0xNVQxMDozMDowMFo6MTAw",
      "has_more": true
    }
  }
}
```

Pass the `next_cursor` value as the `cursor` query parameter to fetch the next page:

```
GET /api/v2/<list-endpoint>?cursor=MjAyNi0wMS0xNVQxMDozMDowMFo6MTAw
```

Cursors are opaque. Echo the value back verbatim; do not construct, parse, or modify it — its encoding can change without notice.

When `has_more` is `false`, or `next_cursor` is `null`, you have reached the last page.

## Query parameters

All list endpoints support these shared parameters:

| Parameter | Type         | Default           | Max   | Description                                        |
| --------- | ------------ | ----------------- | ----- | -------------------------------------------------- |
| `limit`   | integer      | `20`              | `100` | Number of results per page                         |
| `cursor`  | string       | -                 | -     | Opaque cursor from a previous response             |
| `sort`    | string       | `created_at.desc` | -     | `created_at.asc` or `created_at.desc`              |
| `since`   | ISO datetime | -                 | -     | Return records created at or after this timestamp  |
| `until`   | ISO datetime | -                 | -     | Return records created at or before this timestamp |

## Fetching all pages

The pattern for iterating a full result set:

```javascript theme={null}
async function fetchAll(token, path) {
  const results = [];
  let cursor = null;
  do {
    const url = new URL('https://www.gostudio.ai' + path);
    url.searchParams.set('limit', '100');
    if (cursor) url.searchParams.set('cursor', cursor);
    const res = await fetch(url, {
      headers: { Authorization: 'Bearer ' + token }
    });
    const body = await res.json();
    results.push(...body.data.data);
    cursor = body.data.pagination.next_cursor;
  } while (cursor);
  return results;
}
```

## Filtering

List endpoints support additional filters specific to their resource, combined with the shared parameters above:

```
GET /api/v2/<list-endpoint>?status=completed&media_type=image&limit=50
```

Unknown filter values are ignored rather than rejected, so a typo returns an unfiltered page instead of a `400`. See each endpoint's reference page for the filters it actually accepts.
