{
  "components": {
    "headers": {
      "API-Version": {
        "description": "Version of the API that served the response.",
        "schema": {
          "example": "1.1.0",
          "type": "string"
        }
      },
      "Deprecation": {
        "description": "RFC 9745 deprecation timestamp when an endpoint is scheduled for replacement.",
        "schema": {
          "type": "string"
        }
      },
      "RateLimit-Limit": {
        "description": "Maximum number of requests permitted in the current rate-limit window.",
        "schema": {
          "minimum": 1,
          "type": "integer"
        }
      },
      "RateLimit-Policy": {
        "description": "IETF RateLimit policy declaration (for example `600;w=60`).",
        "schema": {
          "type": "string"
        }
      },
      "RateLimit-Remaining": {
        "description": "Number of requests remaining in the current rate-limit window.",
        "schema": {
          "minimum": 0,
          "type": "integer"
        }
      },
      "RateLimit-Reset": {
        "description": "Seconds until the rate-limit quota resets.",
        "schema": {
          "minimum": 0,
          "type": "integer"
        }
      },
      "Retry-After": {
        "description": "Seconds to wait before retrying after a 429 Too Many Requests response.",
        "schema": {
          "minimum": 1,
          "type": "integer"
        }
      },
      "Sunset": {
        "description": "RFC 8594 HTTP-date after which a deprecated endpoint will be removed (at least 90 days notice).",
        "schema": {
          "type": "string"
        }
      }
    },
    "parameters": {
      "ApiVersion": {
        "description": "Requested API version label (defaults to the current stable version).",
        "in": "header",
        "name": "API-Version",
        "required": false,
        "schema": {
          "default": "1.1.0",
          "type": "string"
        }
      }
    },
    "schemas": {
      "ProblemDetails": {
        "properties": {
          "code": {
            "description": "Machine-readable error code.",
            "type": "string"
          },
          "detail": {
            "description": "Explanation of this specific error.",
            "type": "string"
          },
          "hint": {
            "description": "Actionable recovery guidance for callers.",
            "type": "string"
          },
          "status": {
            "description": "HTTP status code.",
            "type": "integer"
          },
          "title": {
            "description": "Short summary of the error.",
            "type": "string"
          },
          "type": {
            "description": "Stable URI identifying the error class.",
            "type": "string"
          }
        },
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "oauth2": {
        "description": "Least-privilege OAuth 2.1 scopes for authenticated operations; public read operations also accept anonymous requests.",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://books.ferrite.run/oauth/authorize",
            "scopes": {
              "apps:discover": "Discover available operations, schemas, and public metadata.",
              "apps:read": "Read-only access to declared GET and read-only operations."
            },
            "tokenUrl": "https://books.ferrite.run/oauth/token"
          }
        },
        "type": "oauth2"
      }
    }
  },
  "info": {
    "description": "NextBooks is a searchable catalogue built from the UCSD Goodreads book graph. Use it to find books by title, narrow them by publication year, rating, length, language or curated list, and read one book's authors, publisher, ISBN, description and ratings. Every operation is a read and runs the same cached queries as the website.\n\nVersioning and deprecation policy: endpoints are versioned via URL path and the optional `API-Version` header (current version: 1.1.0). Deprecated endpoints emit RFC 9745 `Deprecation` and RFC 8594 `Sunset` response headers at least 90 days before removal. Rate limits are communicated via IETF `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset`, `RateLimit-Policy`, and `Retry-After` headers.",
    "title": "next-books",
    "version": "1.1.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/api/v1/books": {
      "get": {
        "operationId": "list_books",
        "parameters": [
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "description": "next_cursor from the previous page; leave out for the first page",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "language",
            "required": false,
            "schema": {
              "description": "language of the edition",
              "enum": [
                "en",
                "spa",
                "ita",
                "ara",
                "fre",
                "ger",
                "ind",
                "por"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "list",
            "required": false,
            "schema": {
              "description": "a curated list to choose from",
              "enum": [
                "popular",
                "classics",
                "sci-fi-fantasy"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "description": "page number, starting at one; cursor is the usual way to continue",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "pages",
            "required": false,
            "schema": {
              "description": "greatest number of pages to include",
              "examples": [
                300
              ],
              "maximum": 1000,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "rating",
            "required": false,
            "schema": {
              "description": "lowest average rating to include, out of five",
              "examples": [
                4
              ],
              "maximum": 5.0,
              "minimum": 0.0,
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "search",
            "required": false,
            "schema": {
              "description": "words that must all appear in the title; accents and word endings are ignored",
              "examples": [
                "rich"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "year",
            "required": false,
            "schema": {
              "description": "latest publication year to include; books from 1950 up to it match",
              "examples": [
                2000
              ],
              "maximum": 2023,
              "minimum": 1950,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "getBooksPage(query).",
                  "properties": {
                    "books": {
                      "items": {
                        "description": "Upstream BookSummary.",
                        "properties": {
                          "id": {
                            "type": "integer"
                          },
                          "image_url": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "thumbhash": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "title": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "title"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "has_more": {
                      "description": "Whether another page may follow.",
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "description": "Pass as cursor to read the next page; null on the last one.",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "books",
                    "has_more",
                    "next_cursor"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "Browse the catalogue or search it by title, 28 books a page in id order, with the website's filters. Use it to find book ids; with no arguments it returns the shelf the home page opens with. Returns each book's id, title and cover, plus next_cursor.",
        "x-idempotent": true,
        "x-read-only": true
      }
    },
    "/api/v1/books/count": {
      "get": {
        "operationId": "count_books",
        "parameters": [
          {
            "in": "query",
            "name": "language",
            "required": false,
            "schema": {
              "description": "language of the edition",
              "enum": [
                "en",
                "spa",
                "ita",
                "ara",
                "fre",
                "ger",
                "ind",
                "por"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "list",
            "required": false,
            "schema": {
              "description": "a curated list to choose from",
              "enum": [
                "popular",
                "classics",
                "sci-fi-fantasy"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "pages",
            "required": false,
            "schema": {
              "description": "greatest number of pages to include",
              "examples": [
                300
              ],
              "maximum": 1000,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "rating",
            "required": false,
            "schema": {
              "description": "lowest average rating to include, out of five",
              "examples": [
                4
              ],
              "maximum": 5.0,
              "minimum": 0.0,
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "search",
            "required": false,
            "schema": {
              "description": "words that must all appear in the title; accents and word endings are ignored",
              "examples": [
                "rich"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "year",
            "required": false,
            "schema": {
              "description": "latest publication year to include; books from 1950 up to it match",
              "examples": [
                2000
              ],
              "maximum": 2023,
              "minimum": 1950,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "getBooksCount(filters).",
                  "properties": {
                    "total": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "total"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "Count the books that match a title search and filters. Use it to learn how large a result is before paging through list_books, or to compare two filters. Returns the total.",
        "x-idempotent": true,
        "x-read-only": true
      }
    },
    "/api/v1/books/{id}": {
      "get": {
        "operationId": "get_book",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "the book id, from list_books or a book page's address",
              "examples": [
                1007
              ],
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "Upstream BookDetails (BookSummary & {...}), flattened.",
                  "properties": {
                    "authors": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "average_rating": {
                      "description": "numeric(3,2) travels as its decimal string, exactly as upstream's Drizzle decimal column does (\"4.00\").",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "type": "integer"
                    },
                    "image_url": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "isbn": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "language_code": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "num_pages": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "publication_year": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "publisher": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "ratings_count": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "thumbhash": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "title": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "title",
                    "authors"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "Read one book's full record. Use it after list_books, or when you already have an id from a book page's address. Returns the title, authors, description, publisher, year, pages, language, ISBN, average rating and rating count; a detail the catalogue lacks is null.",
        "x-idempotent": true,
        "x-read-only": true
      }
    },
    "/api/v1/catalog": {
      "get": {
        "operationId": "get_catalog",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What is loaded, from where, and how much of it.",
                  "properties": {
                    "authors_accepted": {
                      "type": "integer"
                    },
                    "authors_sha256": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "books_accepted": {
                      "type": "integer"
                    },
                    "books_sha256": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "browse_rows": {
                      "type": "integer"
                    },
                    "built_at_unix": {
                      "description": "a 64-bit integer, carried as a decimal string because it exceeds Number.MAX_SAFE_INTEGER",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "generation": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "loaded": {
                      "type": "boolean"
                    },
                    "schema_version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "schema_version",
                    "loaded",
                    "browse_rows",
                    "books_accepted",
                    "authors_accepted"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "Describe the catalogue being served. Use it to learn how many books and authors are held, or to notice that a new import has replaced the data. Returns the counts, the import's name and the checksums of its source files.",
        "x-idempotent": true,
        "x-read-only": true
      }
    }
  },
  "security": [
    {},
    {
      "oauth2": [
        "apps:discover",
        "apps:read"
      ]
    }
  ],
  "servers": [
    {
      "url": "https://books.ferrite.run"
    }
  ],
  "x-agent-card": "https://books.ferrite.run/.well-known/agent-card.json",
  "x-ard-catalog": "https://books.ferrite.run/.well-known/ard.json",
  "x-llms-txt": "https://books.ferrite.run/llms.txt",
  "x-mcp-endpoint": "https://books.ferrite.run/mcp",
  "x-webmcp": "https://books.ferrite.run/.well-known/webmcp.js"
}