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

# Pagination

> Understand how pagination works in the BookHub Publisher API.

The BookHub API limits the number of results per request, so retrieving a full dataset requires multiple requests.

When you request a list (e.g., `GET /v2/books`), the API returns the total number of items, the total number of pages, and the current page. See [Handle pagination](/how-to-guides/how-to-guides-handle-pagination) to learn how to retrieve paginated results from the BookHub Publisher API using `page` and `limit` parameters.

The server automatically calculates `totalPages` from `totalItems` and `itemsPerPage`; you do not need to compute it. For example, if there are 250 books and the page size is 100, `totalPages` will be 3. The first two pages will return 100 items each, and the last page will return the remaining 50 items. If the `page` exceeds `totalPages`, the API returns `200 OK` with an empty `books` array.

```json theme={null}
{
  "status": "success",
  "data": {
    "books": [
      {
        "bookId": "123e4567-e89b-41d4-a716-426614174000",
        "title": "The Great Adventure",
        "author": "Jane Smith",
        "description": "A thrilling adventure story set in the mountains of Peru.",
        "language": "en-US",
        "publisher": "Adventure Books Inc",
        "publishedDate": "2024-01-15",
        "isbn": "978-0-1234-5678-9",
        "price": 24.99,
        "genres": [
          "Fiction",
          "Mystery",
          "Thriller"
        ],
        "bookFormat": "Hardcover",
        "status": "ACTIVE",
        "createdDate": "2024-12-25T10:30:00Z"
      }
    ],
    "pagination": {
      "totalItems": 250,
      "totalPages": 3,
      "currentPage": 1,
      "itemsPerPage": 100
    }
  }
}
```

## Query parameters

The query parameters filter and sort the data to ensure you retrieve the data you need in the right sequence.

The `page`, `limit`, `status`, `sort`, and `order` query parameters control pagination in the response. The `status` query parameter filters the response data by a book's status (`PENDING`, `ACTIVE`, `INACTIVE`). The `sort` query parameter sorts response data by `createdDate`, and the `order` query parameter sorts the data by `asc` (ascending) or `desc` (descending).

```http theme={null}
GET /v2/books?page=2&limit=100&status=INACTIVE&sort=createdDate&order=asc
```

See [Get all books](/api-reference/endpoint/getAllBooks) for the full query parameter reference, including defaults.

## Next steps

Explore related topics:

### How-to guides

* [Handle pagination](/how-to-guides/how-to-guides-handle-pagination) — Learn how to implement pagination logic when fetching data from the BookHub API.

### Reference

* [Get all books](/api-reference/endpoint/getAllBooks) — Retrieve a paginated list of books for the authenticated publisher.
* [API endpoints](/reference/reference-api-endpoints) — Detailed documentation for all API endpoints, parameters, and response formats.

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.