> ## 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.

# Get all books

> Retrieves a paginated list of books for the authenticated publisher. If `page` exceeds `totalPages`, the API returns `200 OK` with an empty `books` array.

## v2 changes

- **(breaking change)**: Title sorting has been removed. Use `createdDate` for sorting instead.
- The `sort` parameter now only accepts `createdDate`

## Migration guide

If you were using `sort=title`:

- Replace with `sort=createdDate` (recommended)
- Implement client-side sorting if title ordering is required




## OpenAPI

````yaml GET /books
openapi: 3.0.3
info:
  title: BookHub Publisher API
  description: >
    BookHub's Publisher API enables programmatic management of book inventory on
    the BookHub marketplace. 

    This API uses path-based versioning (v2) and requires authentication via
    JWTs.


    > The interactive "Try it" playground is backed by a mock server: requests
    return documented example responses and don't persist. Enter any value in
    the Authorization field to try a request; for write endpoints, fill the
    required fields shown.
  version: 2.0.1
  contact:
    name: BookHub API Support
    email: api-support@bookhub.com
    url: https://docs.bookhub.com
servers:
  - url: https://bookhub-mock.onrender.com
    description: >-
      Interactive mock — returns live example responses (no real data or
      persistence)
  - url: https://api.bookhub.com/api/v2
    description: Production server - Version 2
  - url: https://api.bookhub.com/api/v1
    description: Production server - Version 1 (legacy)
security:
  - BearerAuth: []
tags:
  - name: Books
    description: Operations for managing book catalog
paths:
  /books:
    description: Endpoints for creating and managing books in the BookHub catalog.
    get:
      tags:
        - Books
      summary: Get all books
      description: >
        Retrieves a paginated list of books for the authenticated publisher. If
        `page` exceeds `totalPages`, the API returns `200 OK` with an empty
        `books` array.


        ## v2 changes


        - **(breaking change)**: Title sorting has been removed. Use
        `createdDate` for sorting instead.

        - The `sort` parameter now only accepts `createdDate`


        ## Migration guide


        If you were using `sort=title`:


        - Replace with `sort=createdDate` (recommended)

        - Implement client-side sorting if title ordering is required
      operationId: getAllBooks
      parameters:
        - $ref: '#/components/parameters/PageParam'
        - $ref: '#/components/parameters/LimitParam'
        - $ref: '#/components/parameters/StatusParam'
        - $ref: '#/components/parameters/SortParam'
        - $ref: '#/components/parameters/OrderParam'
      responses:
        '200':
          description: Successfully retrieved books
          headers:
            X-Total-Count:
              schema:
                type: integer
              description: Total number of books matching the filters
            Link:
              schema:
                type: string
              description: Pagination links (first, prev, next, last)
              example: <https://api.bookhub.com/api/v2/books?page=2>; rel="next"
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - success
                  data:
                    type: object
                    properties:
                      books:
                        type: array
                        items:
                          $ref: '#/components/schemas/BaseBook'
                      pagination:
                        $ref: '#/components/schemas/Pagination'
              example:
                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:
                    currentPage: 1
                    totalPages: 5
                    totalItems: 87
                    itemsPerPage: 20
        '400':
          description: >-
            Bad request (e.g., limit exceeding the maximum of 100 or page below
            1)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                limitOutOfRange:
                  summary: limit exceeds maximum
                  description: Occurs when the limit query parameter exceeds 100.
                  value:
                    status: error
                    message: Validation failed
                    errors:
                      - field: limit
                        error: OUT_OF_RANGE
                        description: limit must be between 1 and 100
                        validation_context:
                          rule: max_value
                          constraint:
                            maximum: 100
                          provided_value: '150'
                pageBelowMinimum:
                  summary: page is less than 1
                  description: Occurs when the page query parameter is less than 1.
                  value:
                    status: error
                    message: Validation failed
                    errors:
                      - field: page
                        error: OUT_OF_RANGE
                        description: page must be 1 or greater
                        validation_context:
                          rule: min_value
                          constraint:
                            minimum: 1
                          provided_value: '0'
                invalidSort:
                  summary: sort parameter is not a supported value
                  description: >-
                    Occurs when the sort query parameter is not createdDate (for
                    example, the v1 sort=title, removed in v2).
                  value:
                    status: error
                    message: Validation failed
                    errors:
                      - field: sort
                        error: INVALID_VALUE
                        description: >-
                          sort must be createdDate. Title sorting was removed in
                          v2.
                        validation_context:
                          rule: allowed_values
                          constraint:
                            allowed:
                              - createdDate
                          provided_value: title
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '429':
          $ref: '#/components/responses/RateLimitError'
components:
  parameters:
    PageParam:
      name: page
      in: query
      description: Page number for pagination
      schema:
        type: integer
        default: 1
        minimum: 1
    LimitParam:
      name: limit
      in: query
      description: Number of items per page
      schema:
        type: integer
        default: 20
        maximum: 100
    StatusParam:
      name: status
      in: query
      description: Filter by book status
      schema:
        type: string
        enum:
          - PENDING
          - ACTIVE
          - INACTIVE
    SortParam:
      name: sort
      in: query
      description: >
        Sort field (v2 only supports createdDate)


        > **Note**: Title sorting has been removed in v2. Use createdDate
        instead.
      schema:
        type: string
        enum:
          - createdDate
    OrderParam:
      name: order
      in: query
      description: Sort order
      schema:
        type: string
        enum:
          - asc
          - desc
        default: desc
  schemas:
    BaseBook:
      type: object
      required:
        - title
        - author
        - description
        - language
        - publisher
        - publishedDate
        - isbn
        - price
        - genres
        - bookFormat
      properties:
        bookId:
          type: string
          description: Unique identifier for the book
          readOnly: true
        title:
          type: string
          maxLength: 255
          description: Book title
          example: The Great Adventure
        author:
          type: string
          maxLength: 255
          description: Primary author name
          example: Jane Smith
        description:
          type: string
          maxLength: 5000
          description: Book description or synopsis
          example: An epic tale of courage and discovery
        publisher:
          type: string
          maxLength: 255
          description: Publisher name
          example: Adventure Books Inc
        publishedDate:
          type: string
          format: date
          description: Original publication date
          example: '2024-01-15'
        isbn:
          type: string
          pattern: >-
            ^(?:ISBN(?:-1[03])?:? )?(?=[0-9X]{10}$|(?=(?:[0-9]+[- ]){3})[-
            0-9X]{13}$|97[89][0-9]{10}$|(?=(?:[0-9]+[- ]){4})[-
            0-9]{17}$)(?:97[89][- ]?)?[0-9]{1,5}[- ]?[0-9]+[- ]?[0-9]+[-
            ]?[0-9X]$
          description: >-
            ISBN-10 or ISBN-13 identifier. Must be unique across the publisher's
            catalog. Duplicate ISBNs return `409 Conflict`.
          example: 978-0-1234-5678-9
        price:
          type: number
          format: decimal
          minimum: 0.01
          description: Base price in USD
          example: 24.99
        status:
          type: string
          enum:
            - PENDING
            - ACTIVE
            - INACTIVE
          default: PENDING
          description: Current publication status. Always set to PENDING on creation.
          readOnly: true
        coverImages:
          type: array
          items:
            type: string
            format: uri
          minItems: 1
          maxItems: 5
          description: URLs to book cover images
        genres:
          type: array
          items:
            type: string
          minItems: 1
          maxItems: 5
          description: Book genres or categories
          example:
            - Fiction
            - Mystery
            - Thriller
        bookFormat:
          type: string
          enum:
            - Paperback
            - Hardcover
            - eBook
          description: Physical or digital format
        createdDate:
          type: string
          format: date-time
          description: When the book was created in the system
          readOnly: true
          example: '2024-12-25T10:30:00Z'
        updatedDate:
          type: string
          format: date-time
          description: When the book was last updated
          readOnly: true
          example: '2024-12-26T15:45:00Z'
    Pagination:
      type: object
      required:
        - currentPage
        - totalPages
        - totalItems
        - itemsPerPage
      properties:
        currentPage:
          type: integer
          minimum: 1
          description: Current page number
          example: 1
        totalPages:
          type: integer
          minimum: 0
          description: Total number of pages available
          example: 5
        totalItems:
          type: integer
          minimum: 0
          description: Total number of items across all pages
          example: 87
        itemsPerPage:
          type: integer
          minimum: 1
          maximum: 100
          description: Number of items per page
          example: 20
    ErrorResponse:
      type: object
      description: >
        Error response returned when an API request fails.

        Note: `validation_context` and `provided_value` use snake_case rather
        than camelCase — 

        this is a known inconsistency that will be addressed in a future
        version.
      required:
        - status
        - message
      properties:
        status:
          type: string
          enum:
            - error
          description: Status indicator
        message:
          type: string
          description: Human-readable error message
          example: Validation failed
        errors:
          type: array
          description: Detailed error information for each failed field
          items:
            type: object
            properties:
              field:
                type: string
                description: Field that caused the error
                example: isbn
              error:
                type: string
                description: Error type
                example: INVALID_FORMAT
              description:
                type: string
                description: Detailed error explanation
                example: ISBN must match the pattern for ISBN-10 or ISBN-13
              validation_context:
                type: object
                description: Additional context about the validation failure
                properties:
                  rule:
                    type: string
                    example: pattern_match
                  constraint:
                    type: object
                    example:
                      pattern: ^[0-9]{13}$
                  provided_value:
                    type: string
                    example: invalid-isbn
  responses:
    UnauthorizedError:
      description: Unauthorized access
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            status: error
            message: Authentication failed
            errors:
              - field: Authorization
                error: INVALID_TOKEN
                description: >-
                  The JWT is missing, malformed, or expired. Obtain a new token
                  and retry.
    RateLimitError:
      description: |
        Rate limit exceeded. Retry after the window resets — see the
        `X-RateLimit-Reset` header for the Unix timestamp when the current
        window closes, and `X-RateLimit-Remaining` for requests left in it.
      headers:
        X-RateLimit-Limit:
          schema:
            type: integer
          description: Maximum requests allowed per minute
        X-RateLimit-Remaining:
          schema:
            type: integer
          description: Requests remaining in current window
        X-RateLimit-Reset:
          schema:
            type: integer
            format: unix-timestamp
          description: Unix timestamp when rate limit resets
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            status: error
            message: >-
              Rate limit exceeded. Retry after the window resets (see
              X-RateLimit-Reset header).
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT obtained from the authentication endpoint

````

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