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

# Deactivate a book

> Changes a book's status from `ACTIVE` to `INACTIVE`, removing it from
customer visibility without deleting it. Deactivation is a required
precondition for deleting a book.




## OpenAPI

````yaml PATCH /books/{bookId}/deactivate
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/{bookId}/deactivate:
    patch:
      tags:
        - Books
      summary: Deactivate a book
      description: |
        Changes a book's status from `ACTIVE` to `INACTIVE`, removing it from
        customer visibility without deleting it. Deactivation is a required
        precondition for deleting a book.
      operationId: deactivateBook
      parameters:
        - name: bookId
          in: path
          required: true
          description: Unique identifier of the book to deactivate
          schema:
            type: string
          example: 123e4567-e89b-41d4-a716-426614174000
      requestBody:
        required: false
        description: Optional deactivation metadata
        content:
          application/json:
            schema:
              type: object
              properties:
                notes:
                  type: string
                  maxLength: 1000
                  description: Internal notes about the deactivation
                  example: Removed due to publisher request
            example:
              notes: Removed due to publisher request
      responses:
        '200':
          description: |
            Book successfully deactivated. If the book is already `INACTIVE`,
            this is a no-op and returns the current state.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - success
                    example: success
                  message:
                    type: string
                    example: Book deactivated successfully
                  data:
                    type: object
                    properties:
                      bookId:
                        type: string
                        example: 123e4567-e89b-41d4-a716-426614174000
                      title:
                        type: string
                        example: The Great Adventure
                      status:
                        type: string
                        enum:
                          - INACTIVE
                        example: INACTIVE
                      updatedDate:
                        type: string
                        format: date-time
                        example: '2024-12-26T15:45:00Z'
        '400':
          description: Bad request (e.g., notes field exceeds 1000 characters)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                status: error
                message: Validation failed
                errors:
                  - field: notes
                    error: MAX_LENGTH_EXCEEDED
                    description: notes must not exceed 1000 characters
                    validation_context:
                      rule: max_length
                      constraint:
                        maxLength: 1000
                      provided_value: <1247 characters>
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '404':
          $ref: '#/components/responses/NotFoundError'
        '429':
          $ref: '#/components/responses/RateLimitError'
components:
  schemas:
    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.
    NotFoundError:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            status: error
            message: Book not found
            errors:
              - field: bookId
                error: NOT_FOUND
                description: >-
                  No book exists with bookId
                  123e4567-e89b-41d4-a716-426614174000
    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.