{
  "openapi": "3.1.0",
  "info": {
    "title": "MyBooksIndex read-only catalog API",
    "version": "1.1.0",
    "description": "Public read-only JSON API. No API key or account is required. Search by title, author, genre or reading occasion. Collection endpoints support limit and offset. Rankings are editorial and promotional relationships are disclosed."
  },
  "servers": [
    {
      "url": "https://www.mybooksindex.com"
    }
  ],
  "security": [],
  "paths": {
    "/api/v1/catalog.json": {
      "get": {
        "operationId": "getCatalog",
        "summary": "Retrieve the complete book and list catalog",
        "responses": {
          "200": {
            "description": "JSON resource",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "books": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Book"
                      }
                    },
                    "lists": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/List"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Request error with recovery guidance",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Request error with recovery guidance",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Request error with recovery guidance",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/books.json": {
      "get": {
        "operationId": "getBooks",
        "summary": "Retrieve all books",
        "responses": {
          "200": {
            "description": "JSON resource",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "books": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Book"
                      }
                    },
                    "limit": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 100
                    },
                    "offset": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "next_offset": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Request error with recovery guidance",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Request error with recovery guidance",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Request error with recovery guidance",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum items to return. Default 100.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Zero-based offset. Stop when next_offset is null.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ]
      }
    },
    "/api/v1/lists.json": {
      "get": {
        "operationId": "getLists",
        "summary": "Retrieve all reading lists",
        "responses": {
          "200": {
            "description": "JSON resource",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "lists": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/List"
                      }
                    },
                    "limit": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 100
                    },
                    "offset": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "next_offset": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Request error with recovery guidance",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Request error with recovery guidance",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Request error with recovery guidance",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum items to return. Default 100.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Zero-based offset. Stop when next_offset is null.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ]
      }
    },
    "/api/v1/books/{id}.json": {
      "get": {
        "operationId": "getBook",
        "summary": "Retrieve one book",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "the-wager",
                "fck-im-40",
                "project-hail-mary",
                "a-walk-in-the-woods",
                "the-thursday-murder-club",
                "book-lovers",
                "the-flatshare",
                "pride-and-prejudice",
                "beach-read",
                "seven-days-in-june",
                "before-the-coffee-gets-cold",
                "all-systems-red",
                "convenience-store-woman",
                "remarkably-bright-creatures",
                "a-man-called-ove",
                "anxious-people"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Book"
                }
              }
            }
          },
          "400": {
            "description": "Request error with recovery guidance",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Request error with recovery guidance",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Request error with recovery guidance",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/lists/{id}.json": {
      "get": {
        "operationId": "getList",
        "summary": "Retrieve one reading list",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "best-book-gifts-for-husbands-and-dads",
                "best-romance-books",
                "best-books-to-read-on-the-train",
                "funny-books-for-adults",
                "feel-good-books"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/List"
                }
              }
            }
          },
          "400": {
            "description": "Request error with recovery guidance",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Request error with recovery guidance",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Request error with recovery guidance",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/search": {
      "get": {
        "operationId": "searchCatalog",
        "summary": "Search books and lists by title, author, genre or occasion",
        "description": "Case-insensitive token matching. All query tokens must match. Does not generate text or search external sites.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum items to return. Default 100.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Zero-based offset. Stop when next_offset is null.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matching catalog entries, possibly empty",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "q",
                    "results",
                    "total",
                    "limit",
                    "offset",
                    "next_offset"
                  ],
                  "properties": {
                    "q": {
                      "type": "string"
                    },
                    "limit": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 100
                    },
                    "offset": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "next_offset": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "$ref": "#/components/schemas/Book"
                          },
                          {
                            "$ref": "#/components/schemas/List"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Request error with recovery guidance",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Request error with recovery guidance",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Book": {
        "type": "object",
        "required": [
          "id",
          "title",
          "author",
          "url",
          "summary",
          "source",
          "promotional_connection"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "author": {
            "type": "string"
          },
          "genre": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "summary": {
            "type": "string"
          },
          "take": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "format": "uri"
          },
          "isbn": {
            "type": "string"
          },
          "pages": {
            "type": "integer"
          },
          "promotional_connection": {
            "type": "boolean"
          },
          "recommendation_basis": {
            "type": "string"
          },
          "memberships": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "asset": {
            "type": "string"
          },
          "edition": {
            "type": "string"
          },
          "best": {
            "type": "string"
          },
          "tone": {
            "type": "string"
          },
          "fit": {
            "type": "string"
          },
          "consider": {
            "type": "string"
          },
          "cover": {
            "type": "string"
          },
          "source_checked": {
            "type": "string"
          },
          "purchase_url": {
            "type": "string"
          },
          "subtitle": {
            "type": "string"
          },
          "buy": {
            "type": "string"
          },
          "kindle": {
            "type": "string"
          },
          "connected": {
            "type": "boolean"
          },
          "extra": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "translator": {
            "type": "string"
          }
        }
      },
      "List": {
        "type": "object",
        "required": [
          "id",
          "title",
          "items",
          "ranking_basis"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "ranking_basis": {
            "type": "string"
          },
          "promotional_note": {
            "type": [
              "string",
              "null"
            ]
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "position",
                "book_id",
                "url"
              ],
              "properties": {
                "position": {
                  "type": "integer"
                },
                "book_id": {
                  "type": "string"
                },
                "url": {
                  "type": "string",
                  "format": "uri"
                },
                "reason": {
                  "type": "string"
                }
              }
            }
          },
          "label": {
            "type": "string"
          },
          "short": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "intro": {
            "type": "string"
          },
          "answer": {
            "type": "string"
          },
          "color": {
            "type": "string"
          },
          "ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "faqs": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        }
      },
      "Problem": {
        "type": "object",
        "required": [
          "type",
          "title",
          "status",
          "detail",
          "instance",
          "code"
        ],
        "properties": {
          "type": {
            "type": "string",
            "format": "uri"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "instance": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "help": {
            "type": "string",
            "format": "uri"
          }
        }
      }
    }
  }
}