{
  "openapi": "3.1.0",
  "info": {
    "title": "Shelf Book API",
    "version": "1",
    "description": "Free JSON book API behind shlf.bid: millions of works in 30+ languages, authors, series, ISBNs, tags, covers, similar books and recommendations.\n\n**No API key, no sign-up.** Requests need no `Authorization` header; one that is sent is ignored.\n\n**Rate limit:** the API is rate limited per IP address. Clients that exceed it get HTTP 429 (`rate_limited`); wait and retry, honouring `Retry-After` when present.\n\n**CORS:** `/api/v1/*`, `/openapi.json` and the cover images send `Access-Control-Allow-Origin: *`, so browser apps can call them directly.\n\n**Caching:** successful GET answers are public (`max-age=600, s-maxage=86400`) with an `ETag` that changes with each monthly catalogue release; send `If-None-Match` for 304s. `/api/v1/random` is `no-store`.\n\n**Shape:** JSON leaves out null and empty-text fields. Ids are stable: works are unified work ids (one id for all language editions), authors author numbers, series the work id of their first volume. Old work ids answer 301 to the current one. Every entity carries `url`, its canonical page on shlf.bid. `cover` is the 320 px cover path (relative to https://shlf.bid), `covers` absolute URLs of every width.\n\n**Lists:** `page` (1-50) and `limit` (1-50, default 20) page results; `more` says whether another page follows.\n\n**Errors** look like `{\"error\":{\"code\":\"…\",\"message\":\"…\"}}`: `invalid_parameter` 400, `not_found` 404, `rate_limited` 429, `unavailable` 503 (catalogue loading)."
  },
  "servers": [
    {
      "url": "https://shlf.bid"
    }
  ],
  "tags": [
    {
      "name": "Works",
      "description": "Books: search, details, batches, similar books and recommendations"
    },
    {
      "name": "Authors",
      "description": "Authors and their works"
    },
    {
      "name": "Series",
      "description": "Series in reading order"
    },
    {
      "name": "ISBN",
      "description": "ISBN lookup, validation and conversion"
    },
    {
      "name": "Catalogue",
      "description": "Languages, tags and popular works"
    },
    {
      "name": "Covers",
      "description": "AVIF images"
    },
    {
      "name": "Legacy",
      "description": "Kept for old app versions"
    }
  ],
  "paths": {
    "/api/v1/search": {
      "get": {
        "tags": [
          "Works"
        ],
        "summary": "Search books",
        "description": "Ranked full-text search over titles and authors in every catalogue (typo tolerant); an ISBN finds its book. Filters narrow the best 500 matches.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "description": "Title, author or ISBN",
            "schema": {
              "type": "string"
            },
            "example": "dune"
          },
          {
            "$ref": "#/components/parameters/page"
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/language"
          },
          {
            "$ref": "#/components/parameters/author"
          },
          {
            "$ref": "#/components/parameters/tag"
          },
          {
            "$ref": "#/components/parameters/year_from"
          },
          {
            "$ref": "#/components/parameters/year_to"
          },
          {
            "$ref": "#/components/parameters/cover"
          }
        ],
        "responses": {
          "200": {
            "description": "Matching works",
            "content": {
              "application/json": {
                "example": {
                  "query": "dune",
                  "page": 1,
                  "limit": 20,
                  "more": false,
                  "results": [
                    {
                      "id": 12,
                      "language": "en",
                      "title": "Dune",
                      "authors": [
                        {
                          "id": 101,
                          "name": "Frank Herbert"
                        }
                      ],
                      "year": 1965,
                      "cover": "/b/12/en/320.avif",
                      "covers": {
                        "160": "https://shlf.bid/b/12/en/160.avif",
                        "320": "https://shlf.bid/b/12/en/320.avif",
                        "640": "https://shlf.bid/b/12/en/640.avif"
                      },
                      "url": "https://shlf.bid/b/12/en"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/invalid"
          },
          "429": {
            "$ref": "#/components/responses/limited"
          }
        }
      }
    },
    "/api/v1/suggest": {
      "get": {
        "tags": [
          "Works"
        ],
        "summary": "Autocomplete",
        "description": "Up to 2 matching authors and 6 works for a search box.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "description": "Typed text",
            "schema": {
              "type": "string"
            },
            "example": "harry"
          }
        ],
        "responses": {
          "200": {
            "description": "Suggestions",
            "content": {
              "application/json": {
                "example": {
                  "query": "harry",
                  "suggestions": [
                    {
                      "kind": "author",
                      "id": 100,
                      "label": "J. K. Rowling",
                      "detail": "Author"
                    },
                    {
                      "kind": "work",
                      "id": 10,
                      "language": "en",
                      "label": "Harry Potter and the Philosopher's Stone",
                      "detail": "J. K. Rowling · 1997"
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/limited"
          }
        }
      }
    },
    "/api/v1/works": {
      "get": {
        "tags": [
          "Works"
        ],
        "summary": "Several works at once",
        "description": "Summaries of up to 50 works in the order asked; old ids follow their move, unknown ids are listed in `missing`.",
        "parameters": [
          {
            "name": "ids",
            "in": "query",
            "description": "Comma separated work ids, 1-50",
            "schema": {
              "type": "string"
            },
            "example": "10,12,13",
            "required": true
          },
          {
            "$ref": "#/components/parameters/language"
          }
        ],
        "responses": {
          "200": {
            "description": "Works",
            "content": {
              "application/json": {
                "example": {
                  "results": [
                    {
                      "id": 10,
                      "language": "en",
                      "title": "Harry Potter and the Philosopher's Stone",
                      "authors": [
                        {
                          "id": 100,
                          "name": "J. K. Rowling"
                        }
                      ],
                      "year": 1997,
                      "cover": "/b/10/en/320.avif",
                      "covers": {
                        "160": "https://shlf.bid/b/10/en/160.avif",
                        "320": "https://shlf.bid/b/10/en/320.avif",
                        "640": "https://shlf.bid/b/10/en/640.avif"
                      },
                      "url": "https://shlf.bid/b/10/en"
                    },
                    {
                      "id": 12,
                      "language": "en",
                      "title": "Dune",
                      "authors": [
                        {
                          "id": 101,
                          "name": "Frank Herbert"
                        }
                      ],
                      "year": 1965,
                      "cover": "/b/12/en/320.avif",
                      "covers": {
                        "160": "https://shlf.bid/b/12/en/160.avif",
                        "320": "https://shlf.bid/b/12/en/320.avif",
                        "640": "https://shlf.bid/b/12/en/640.avif"
                      },
                      "url": "https://shlf.bid/b/12/en"
                    }
                  ],
                  "missing": [
                    999
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/invalid"
          },
          "429": {
            "$ref": "#/components/responses/limited"
          }
        }
      }
    },
    "/api/v1/works/{id}": {
      "get": {
        "tags": [
          "Works"
        ],
        "summary": "Get a work",
        "description": "One work with every language it has, description, tags, series with previous/next volume, reader stats, other-language titles and descriptions, contributors, identifiers and editions. Old ids answer 301.",
        "parameters": [
          {
            "$ref": "#/components/parameters/id"
          },
          {
            "$ref": "#/components/parameters/language"
          }
        ],
        "responses": {
          "200": {
            "description": "Work",
            "content": {
              "application/json": {
                "example": {
                  "id": 10,
                  "language": "en",
                  "title": "Harry Potter and the Philosopher's Stone",
                  "authors": [
                    {
                      "id": 100,
                      "name": "J. K. Rowling"
                    }
                  ],
                  "year": 1997,
                  "cover": "/b/10/en/320.avif",
                  "covers": {
                    "160": "https://shlf.bid/b/10/en/160.avif",
                    "320": "https://shlf.bid/b/10/en/320.avif",
                    "640": "https://shlf.bid/b/10/en/640.avif"
                  },
                  "url": "https://shlf.bid/b/10/en",
                  "languages": [
                    {
                      "language": "en",
                      "title": "Harry Potter and the Philosopher's Stone",
                      "url": "https://shlf.bid/b/10/en"
                    },
                    {
                      "language": "de",
                      "title": "Harry Potter und der Stein der Weisen",
                      "url": "https://shlf.bid/b/10/de"
                    }
                  ],
                  "description": {
                    "language": "en",
                    "text": "A boy learns he is a wizard."
                  },
                  "translated": false,
                  "tags": [
                    {
                      "slug": "fantasy",
                      "label": "Fantasy"
                    }
                  ],
                  "series": {
                    "id": 10,
                    "name": "Harry Potter",
                    "position": 1,
                    "next": 11
                  },
                  "stats": {
                    "readers": 12345,
                    "ratings": 1500,
                    "rating": 4.47,
                    "editions": 34
                  },
                  "titles": [
                    {
                      "language": "ja",
                      "text": "ハリー・ポッターと賢者の石"
                    }
                  ],
                  "original_title": "Harry Potter and the Philosopher's Stone",
                  "translators": [],
                  "contributors": [
                    {
                      "role": "illustrator",
                      "name": "Mary GrandPré"
                    }
                  ],
                  "identifiers": [
                    "ol:OL82563W",
                    "wikidata:Q43361"
                  ],
                  "editions": [
                    {
                      "year": 1997,
                      "publisher": "Bloomsbury",
                      "isbn": "9780747532699",
                      "format": 1
                    }
                  ]
                }
              }
            }
          },
          "301": {
            "description": "Moved to the current id"
          },
          "400": {
            "$ref": "#/components/responses/invalid"
          },
          "404": {
            "$ref": "#/components/responses/missing"
          },
          "429": {
            "$ref": "#/components/responses/limited"
          }
        }
      }
    },
    "/api/v1/similar/{id}": {
      "get": {
        "tags": [
          "Works"
        ],
        "summary": "Similar works",
        "description": "Most read books of the work's language ranked by weighted tag similarity and popularity; one per author, never the work's own author.",
        "parameters": [
          {
            "$ref": "#/components/parameters/id"
          },
          {
            "$ref": "#/components/parameters/language"
          },
          {
            "$ref": "#/components/parameters/similar_limit"
          }
        ],
        "responses": {
          "200": {
            "description": "Works",
            "content": {
              "application/json": {
                "example": {
                  "work": 12,
                  "results": [
                    {
                      "id": 13,
                      "language": "en",
                      "title": "Foundation",
                      "authors": [
                        {
                          "id": 102,
                          "name": "Isaac Asimov"
                        }
                      ],
                      "year": 1951,
                      "cover": "/b/13/en/320.avif",
                      "covers": {
                        "160": "https://shlf.bid/b/13/en/160.avif",
                        "320": "https://shlf.bid/b/13/en/320.avif",
                        "640": "https://shlf.bid/b/13/en/640.avif"
                      },
                      "url": "https://shlf.bid/b/13/en"
                    }
                  ]
                }
              }
            }
          },
          "301": {
            "description": "Moved to the current id"
          },
          "400": {
            "$ref": "#/components/responses/invalid"
          },
          "404": {
            "$ref": "#/components/responses/missing"
          },
          "429": {
            "$ref": "#/components/responses/limited"
          }
        }
      }
    },
    "/api/v1/recommend": {
      "get": {
        "tags": [
          "Works"
        ],
        "summary": "Recommendations from several books",
        "description": "Merges the similar books of up to 10 seed works by reciprocal rank, so books close to several seeds lead; seeds themselves are left out, one book per author.",
        "parameters": [
          {
            "name": "ids",
            "in": "query",
            "description": "Comma separated seed work ids, 1-10",
            "schema": {
              "type": "string"
            },
            "example": "10,12",
            "required": true
          },
          {
            "$ref": "#/components/parameters/language"
          },
          {
            "$ref": "#/components/parameters/similar_limit"
          }
        ],
        "responses": {
          "200": {
            "description": "Works",
            "content": {
              "application/json": {
                "example": {
                  "seeds": [
                    10,
                    12
                  ],
                  "results": [
                    {
                      "id": 13,
                      "language": "en",
                      "title": "Foundation",
                      "authors": [
                        {
                          "id": 102,
                          "name": "Isaac Asimov"
                        }
                      ],
                      "year": 1951,
                      "cover": "/b/13/en/320.avif",
                      "covers": {
                        "160": "https://shlf.bid/b/13/en/160.avif",
                        "320": "https://shlf.bid/b/13/en/320.avif",
                        "640": "https://shlf.bid/b/13/en/640.avif"
                      },
                      "url": "https://shlf.bid/b/13/en"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/invalid"
          },
          "429": {
            "$ref": "#/components/responses/limited"
          }
        }
      }
    },
    "/api/v1/random": {
      "get": {
        "tags": [
          "Works"
        ],
        "summary": "A random popular book",
        "description": "One work drawn from the 1000 most read of a catalogue (a random catalogue without `language`), matching the filters. Not cached.",
        "parameters": [
          {
            "$ref": "#/components/parameters/language"
          },
          {
            "$ref": "#/components/parameters/author"
          },
          {
            "$ref": "#/components/parameters/tag"
          },
          {
            "$ref": "#/components/parameters/year_from"
          },
          {
            "$ref": "#/components/parameters/year_to"
          },
          {
            "$ref": "#/components/parameters/cover"
          }
        ],
        "responses": {
          "200": {
            "description": "Work",
            "content": {
              "application/json": {
                "example": {
                  "id": 12,
                  "language": "en",
                  "title": "Dune",
                  "authors": [
                    {
                      "id": 101,
                      "name": "Frank Herbert"
                    }
                  ],
                  "year": 1965,
                  "cover": "/b/12/en/320.avif",
                  "covers": {
                    "160": "https://shlf.bid/b/12/en/160.avif",
                    "320": "https://shlf.bid/b/12/en/320.avif",
                    "640": "https://shlf.bid/b/12/en/640.avif"
                  },
                  "url": "https://shlf.bid/b/12/en"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/invalid"
          },
          "404": {
            "description": "`not_found`: nothing matched the filters"
          },
          "429": {
            "$ref": "#/components/responses/limited"
          }
        }
      }
    },
    "/api/v1/authors": {
      "get": {
        "tags": [
          "Authors"
        ],
        "summary": "Search authors",
        "description": "Authors whose names start with every word of `q`, best known first.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "description": "Author name",
            "schema": {
              "type": "string"
            },
            "example": "herbert"
          },
          {
            "$ref": "#/components/parameters/name_limit"
          }
        ],
        "responses": {
          "200": {
            "description": "Authors",
            "content": {
              "application/json": {
                "example": {
                  "query": "herbert",
                  "results": [
                    {
                      "id": 101,
                      "name": "Frank Herbert",
                      "born": 1920,
                      "works": 42,
                      "url": "https://shlf.bid/a/101",
                      "photo": "/a/101/192.avif"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/invalid"
          },
          "429": {
            "$ref": "#/components/responses/limited"
          }
        }
      }
    },
    "/api/v1/authors/{id}": {
      "get": {
        "tags": [
          "Authors"
        ],
        "summary": "Get an author",
        "description": "Name (in `language` where that catalogue has it), dates, other names, bio, authority ids, photo and all work ids, most read first. Alias numbers join one author.",
        "parameters": [
          {
            "$ref": "#/components/parameters/id"
          },
          {
            "$ref": "#/components/parameters/language"
          }
        ],
        "responses": {
          "200": {
            "description": "Author",
            "content": {
              "application/json": {
                "example": {
                  "id": 100,
                  "name": "J. K. Rowling",
                  "born": 1965,
                  "names": [
                    "Joanne Rowling"
                  ],
                  "bio": "British author.",
                  "identifiers": [
                    "viaf:116796842"
                  ],
                  "url": "https://shlf.bid/a/100",
                  "photo": "/a/100/192.avif",
                  "photos": {
                    "96": "https://shlf.bid/a/100/96.avif",
                    "192": "https://shlf.bid/a/100/192.avif"
                  },
                  "works": [
                    10,
                    11
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/invalid"
          },
          "404": {
            "$ref": "#/components/responses/missing"
          },
          "429": {
            "$ref": "#/components/responses/limited"
          }
        }
      }
    },
    "/api/v1/authors/{id}/works": {
      "get": {
        "tags": [
          "Authors"
        ],
        "summary": "An author's works",
        "description": "Work summaries of an author, paged; with `language`, books of that language lead and show in it.",
        "parameters": [
          {
            "$ref": "#/components/parameters/id"
          },
          {
            "$ref": "#/components/parameters/language"
          },
          {
            "name": "sort",
            "in": "query",
            "description": "`popular` (most read first), `year` (oldest first, undated last), `newest` or `title`",
            "schema": {
              "type": "string",
              "enum": [
                "popular",
                "year",
                "newest",
                "title"
              ],
              "default": "popular"
            }
          },
          {
            "$ref": "#/components/parameters/page"
          },
          {
            "$ref": "#/components/parameters/limit"
          }
        ],
        "responses": {
          "200": {
            "description": "Works",
            "content": {
              "application/json": {
                "example": {
                  "author": 100,
                  "sort": "year",
                  "total": 2,
                  "page": 1,
                  "limit": 20,
                  "more": false,
                  "results": [
                    {
                      "id": 10,
                      "language": "en",
                      "title": "Harry Potter and the Philosopher's Stone",
                      "authors": [
                        {
                          "id": 100,
                          "name": "J. K. Rowling"
                        }
                      ],
                      "year": 1997,
                      "cover": "/b/10/en/320.avif",
                      "covers": {
                        "160": "https://shlf.bid/b/10/en/160.avif",
                        "320": "https://shlf.bid/b/10/en/320.avif",
                        "640": "https://shlf.bid/b/10/en/640.avif"
                      },
                      "url": "https://shlf.bid/b/10/en"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/invalid"
          },
          "404": {
            "$ref": "#/components/responses/missing"
          },
          "429": {
            "$ref": "#/components/responses/limited"
          }
        }
      }
    },
    "/api/v1/series": {
      "get": {
        "tags": [
          "Series"
        ],
        "summary": "Search series",
        "description": "Series of the books matching `q`.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "description": "Series or book title",
            "schema": {
              "type": "string"
            },
            "example": "harry potter"
          },
          {
            "$ref": "#/components/parameters/name_limit"
          }
        ],
        "responses": {
          "200": {
            "description": "Series",
            "content": {
              "application/json": {
                "example": {
                  "query": "harry potter",
                  "results": [
                    {
                      "id": 10,
                      "name": "Harry Potter",
                      "language": "en",
                      "volumes": 7,
                      "url": "https://shlf.bid/series/10/en"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/invalid"
          },
          "429": {
            "$ref": "#/components/responses/limited"
          }
        }
      }
    },
    "/api/v1/series/{id}": {
      "get": {
        "tags": [
          "Series"
        ],
        "summary": "Get a series",
        "description": "Volumes in reading order with their summaries, gaps filled from other catalogues. The id is the work id of the first volume (any volume's id works too).",
        "parameters": [
          {
            "$ref": "#/components/parameters/id"
          },
          {
            "$ref": "#/components/parameters/language"
          }
        ],
        "responses": {
          "200": {
            "description": "Series",
            "content": {
              "application/json": {
                "example": {
                  "id": 10,
                  "name": "Harry Potter",
                  "language": "en",
                  "url": "https://shlf.bid/series/10/en",
                  "works": [
                    {
                      "work": 10,
                      "position": 1,
                      "id": 10,
                      "language": "en",
                      "title": "Harry Potter and the Philosopher's Stone",
                      "authors": [
                        {
                          "id": 100,
                          "name": "J. K. Rowling"
                        }
                      ],
                      "year": 1997,
                      "cover": "/b/10/en/320.avif",
                      "covers": {
                        "160": "https://shlf.bid/b/10/en/160.avif",
                        "320": "https://shlf.bid/b/10/en/320.avif",
                        "640": "https://shlf.bid/b/10/en/640.avif"
                      },
                      "url": "https://shlf.bid/b/10/en"
                    },
                    {
                      "work": 11,
                      "position": 2,
                      "id": 11,
                      "language": "en",
                      "title": "Harry Potter and the Chamber of Secrets",
                      "authors": [
                        {
                          "id": 100,
                          "name": "J. K. Rowling"
                        }
                      ],
                      "url": "https://shlf.bid/b/11/en"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/invalid"
          },
          "404": {
            "$ref": "#/components/responses/missing"
          },
          "429": {
            "$ref": "#/components/responses/limited"
          }
        }
      }
    },
    "/api/v1/isbn": {
      "get": {
        "tags": [
          "ISBN"
        ],
        "summary": "Look up several ISBNs",
        "description": "Up to 50 ISBN-10 or ISBN-13 (hyphens and spaces allowed).",
        "parameters": [
          {
            "name": "isbns",
            "in": "query",
            "description": "Comma separated ISBNs, 1-50",
            "schema": {
              "type": "string"
            },
            "example": "0747532699,9780306406157,abc",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Found, missing and invalid ISBNs",
            "content": {
              "application/json": {
                "example": {
                  "results": [
                    {
                      "isbn": "9780747532699",
                      "isbn10": "0747532699",
                      "work": 10,
                      "language": "en",
                      "book": {
                        "id": 10,
                        "language": "en",
                        "title": "Harry Potter and the Philosopher's Stone",
                        "authors": [
                          {
                            "id": 100,
                            "name": "J. K. Rowling"
                          }
                        ],
                        "year": 1997,
                        "cover": "/b/10/en/320.avif",
                        "covers": {
                          "160": "https://shlf.bid/b/10/en/160.avif",
                          "320": "https://shlf.bid/b/10/en/320.avif",
                          "640": "https://shlf.bid/b/10/en/640.avif"
                        },
                        "url": "https://shlf.bid/b/10/en"
                      }
                    }
                  ],
                  "missing": [
                    "9780306406157"
                  ],
                  "invalid": [
                    "abc"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/invalid"
          },
          "429": {
            "$ref": "#/components/responses/limited"
          }
        }
      }
    },
    "/api/v1/isbn/{isbn}": {
      "get": {
        "tags": [
          "ISBN"
        ],
        "summary": "Look up an ISBN",
        "description": "The work an ISBN-10 or ISBN-13 belongs to.",
        "parameters": [
          {
            "name": "isbn",
            "in": "path",
            "required": true,
            "description": "ISBN-10 or ISBN-13, hyphens allowed",
            "schema": {
              "type": "string"
            },
            "example": "9780747532699"
          }
        ],
        "responses": {
          "200": {
            "description": "Work",
            "content": {
              "application/json": {
                "example": {
                  "isbn": "9780747532699",
                  "isbn10": "0747532699",
                  "work": 10,
                  "language": "en",
                  "book": {
                    "id": 10,
                    "language": "en",
                    "title": "Harry Potter and the Philosopher's Stone",
                    "authors": [
                      {
                        "id": 100,
                        "name": "J. K. Rowling"
                      }
                    ],
                    "year": 1997,
                    "cover": "/b/10/en/320.avif",
                    "covers": {
                      "160": "https://shlf.bid/b/10/en/160.avif",
                      "320": "https://shlf.bid/b/10/en/320.avif",
                      "640": "https://shlf.bid/b/10/en/640.avif"
                    },
                    "url": "https://shlf.bid/b/10/en"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/invalid"
          },
          "404": {
            "$ref": "#/components/responses/missing"
          },
          "429": {
            "$ref": "#/components/responses/limited"
          }
        }
      }
    },
    "/api/v1/isbn/{isbn}/check": {
      "get": {
        "tags": [
          "ISBN"
        ],
        "summary": "Validate and convert an ISBN",
        "description": "Checks the check digit and gives both forms; `isbn10` only exists for 978 ISBNs. Works for any ISBN, in the catalogue or not.",
        "parameters": [
          {
            "name": "isbn",
            "in": "path",
            "required": true,
            "description": "ISBN-10 or ISBN-13, hyphens allowed",
            "schema": {
              "type": "string"
            },
            "example": "0-306-40615-2"
          }
        ],
        "responses": {
          "200": {
            "description": "Check",
            "content": {
              "application/json": {
                "example": {
                  "input": "0-306-40615-2",
                  "valid": true,
                  "isbn13": "9780306406157",
                  "isbn10": "0306406152"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/limited"
          }
        }
      }
    },
    "/api/v1/languages": {
      "get": {
        "tags": [
          "Catalogue"
        ],
        "summary": "List catalogues",
        "description": "Every catalogue language, largest first.",
        "responses": {
          "200": {
            "description": "Languages",
            "content": {
              "application/json": {
                "example": {
                  "languages": [
                    {
                      "code": "en",
                      "name": "English",
                      "works": 1200000,
                      "url": "https://shlf.bid/l/en"
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/limited"
          }
        }
      }
    },
    "/api/v1/tags": {
      "get": {
        "tags": [
          "Catalogue"
        ],
        "summary": "List tags",
        "description": "Every tag (genre, topic, audience, form, accolade) of a catalogue with its localized label and how many works carry it, most used first. Use the slug as `tag` filter.",
        "parameters": [
          {
            "$ref": "#/components/parameters/language",
            "description": "Catalogue code, default en"
          }
        ],
        "responses": {
          "200": {
            "description": "Tags",
            "content": {
              "application/json": {
                "example": {
                  "language": "en",
                  "tags": [
                    {
                      "slug": "fantasy",
                      "label": "Fantasy",
                      "category": "genre",
                      "works": 81234
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/invalid"
          },
          "404": {
            "$ref": "#/components/responses/missing"
          },
          "429": {
            "$ref": "#/components/responses/limited"
          }
        }
      }
    },
    "/api/v1/catalogue/{language}": {
      "get": {
        "tags": [
          "Catalogue"
        ],
        "summary": "Popular works in a language",
        "description": "The 2500 most read works of a catalogue, most read first; with filters, the matching ones among them (e.g. popular fantasy: `tag=fantasy`). `total` counts the whole catalogue.",
        "parameters": [
          {
            "name": "language",
            "in": "path",
            "required": true,
            "description": "Catalogue code",
            "schema": {
              "type": "string"
            },
            "example": "de"
          },
          {
            "$ref": "#/components/parameters/page"
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/author"
          },
          {
            "$ref": "#/components/parameters/tag"
          },
          {
            "$ref": "#/components/parameters/year_from"
          },
          {
            "$ref": "#/components/parameters/year_to"
          },
          {
            "$ref": "#/components/parameters/cover"
          }
        ],
        "responses": {
          "200": {
            "description": "Works",
            "content": {
              "application/json": {
                "example": {
                  "language": "de",
                  "total": 400000,
                  "page": 1,
                  "limit": 20,
                  "more": true,
                  "results": []
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/invalid"
          },
          "404": {
            "$ref": "#/components/responses/missing"
          },
          "429": {
            "$ref": "#/components/responses/limited"
          }
        }
      }
    },
    "/b/{id}/{language}/{width}.avif": {
      "get": {
        "tags": [
          "Covers"
        ],
        "summary": "Book cover, 2:3",
        "description": "Immutable, cached for a year.",
        "parameters": [
          {
            "$ref": "#/components/parameters/id"
          },
          {
            "name": "language",
            "in": "path",
            "required": true,
            "description": "Catalogue code",
            "schema": {
              "type": "string"
            },
            "example": "en"
          },
          {
            "name": "width",
            "in": "path",
            "required": true,
            "description": "Width in pixels",
            "schema": {
              "enum": [
                160,
                320,
                640
              ]
            },
            "example": 320
          }
        ],
        "responses": {
          "200": {
            "description": "AVIF image"
          },
          "404": {
            "description": "No cover"
          }
        }
      }
    },
    "/a/{id}/{width}.avif": {
      "get": {
        "tags": [
          "Covers"
        ],
        "summary": "Author photo, square",
        "description": "Immutable, cached for a year.",
        "parameters": [
          {
            "$ref": "#/components/parameters/id"
          },
          {
            "name": "width",
            "in": "path",
            "required": true,
            "description": "Width in pixels",
            "schema": {
              "enum": [
                96,
                192
              ]
            },
            "example": 192
          }
        ],
        "responses": {
          "200": {
            "description": "AVIF image"
          },
          "404": {
            "description": "No photo"
          }
        }
      }
    },
    "/api/pow": {
      "get": {
        "tags": [
          "Legacy"
        ],
        "summary": "Retired proof-of-work challenge",
        "deprecated": true,
        "description": "The API needs no token any more. Kept for old app versions: the challenge is solved by any counter.",
        "responses": {
          "200": {
            "description": "Challenge",
            "content": {
              "application/json": {
                "example": {
                  "c": "000000000000000000000000000000000000000000000000",
                  "d": 0,
                  "k": 1,
                  "n": 2,
                  "r": 1
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Legacy"
        ],
        "summary": "Retired token exchange",
        "deprecated": true,
        "description": "Answers any body with a token that every route ignores.",
        "responses": {
          "200": {
            "description": "Token",
            "content": {
              "application/json": {
                "example": {
                  "t": "open"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "id": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "integer"
        },
        "example": 10
      },
      "page": {
        "name": "page",
        "in": "query",
        "description": "1-50",
        "schema": {
          "type": "integer",
          "default": 1
        }
      },
      "limit": {
        "name": "limit",
        "in": "query",
        "description": "1-50",
        "schema": {
          "type": "integer",
          "default": 20
        }
      },
      "similar_limit": {
        "name": "limit",
        "in": "query",
        "description": "1-50",
        "schema": {
          "type": "integer",
          "default": 12
        }
      },
      "name_limit": {
        "name": "limit",
        "in": "query",
        "description": "1-20",
        "schema": {
          "type": "integer",
          "default": 5
        }
      },
      "language": {
        "name": "language",
        "in": "query",
        "description": "Catalogue code like en or de: only works of that catalogue, shown in it",
        "schema": {
          "type": "string"
        }
      },
      "author": {
        "name": "author",
        "in": "query",
        "description": "Only works by this author id",
        "schema": {
          "type": "integer"
        }
      },
      "tag": {
        "name": "tag",
        "in": "query",
        "description": "Only works with this tag slug (see /api/v1/tags)",
        "schema": {
          "type": "string"
        },
        "example": "fantasy"
      },
      "year_from": {
        "name": "year_from",
        "in": "query",
        "description": "Only works first published in or after this year",
        "schema": {
          "type": "integer"
        }
      },
      "year_to": {
        "name": "year_to",
        "in": "query",
        "description": "Only works first published in or before this year",
        "schema": {
          "type": "integer"
        }
      },
      "cover": {
        "name": "cover",
        "in": "query",
        "description": "true: only works with a cover, false: only without",
        "schema": {
          "type": "boolean"
        }
      }
    },
    "responses": {
      "invalid": {
        "description": "`invalid_parameter`",
        "content": {
          "application/json": {
            "example": {
              "error": {
                "code": "invalid_parameter",
                "message": "limit must be 1-50"
              }
            }
          }
        }
      },
      "missing": {
        "description": "`not_found`",
        "content": {
          "application/json": {
            "example": {
              "error": {
                "code": "not_found",
                "message": "Work not found"
              }
            }
          }
        }
      },
      "limited": {
        "description": "`rate_limited`: too many requests from this IP",
        "content": {
          "application/json": {
            "example": {
              "error": {
                "code": "rate_limited",
                "message": "Too many requests"
              }
            }
          }
        }
      }
    }
  }
}