Documentation

Card type

Book search API

Books for a genre, a topic, an author, a book they should be like, or constraints (rating, years, length), with their covers, authors and ratings, and filters that say how many books each option leaves. From WebKnox's book index, built on Open Library's data; each book links to its page there, and covers are the publishers' art, shown with the card's credit. Results are in English.

Card type book.search · version 1 · schema book.search.v1.schema.json

Layouts

Every card type has full. Pick a layout with the element's layout attribute, render.layout, or a theme.

Fields

The fields of card.data. Values a source doesn't provide are null; new optional fields can appear within version 1.

FieldTypeRequiredNotes
querystringyesWhat was searched for, in English, without the words the filters took ("cozy mysteries"); "like Dune" for books similar to a title. Empty when only filters were asked for.
filtersobjectyesGenres and authors: any of the chosen (or). Rating, published and length: one each. All of them together (and).
filters.genres[]string[]yesGenres (fantasy, science_fiction, mystery, …), any of them.
filters.authors[]string[]yesAuthors by the slug of their name, any of them. One word is a surname (tolkien).
filters.ratingenumyesAt least this many stars out of 5, from at least 10 ratings. · 3.5 · 4 · 4.5
filters.publishedobjectyesPublished from min to max (years; either may be null). Books without a year are left out while either is set.
filters.published.mininteger | nullyes
filters.published.maxinteger | nullyes
filters.lengthenumyesshort: under 200 pages; medium: 200 to 400; long: over 400. Books without a page count are left out while it is set. · short · medium · long
sortenumyesmatch: best match first; rating: highest rated first, books with fewer than 10 ratings last; popular: most ratings first; newest, oldest: by year, books without a year last. match · rating · popular · newest · oldest
totalintegeryesHow many books match, of which results holds the first limit.
cappedbooleanyestrue when the search looked only at the 1,000 best candidates of the index: total and the counts are over those of them that pass the filters, and more may match (show the total with a "+").
limitintegeryesHow many results were asked for: 24, or more after a refine asked for more.
results[]object[]yes
results[].idintegeryesThe book index's id for the book.
results[].titlestringyes
results[].subtitlestring | nullyes
results[].cover_urlurl | nullyesWebKnox media URL of the cover (taller than wide), or null when none is known.
results[].authors[]string[]yes
results[].yearinteger | nullyesWhen it was published, as far as known: often the edition's year, not the first.
results[].pagesinteger | nullyes
results[].ratingnumber | nullyesAverage rating out of 5, one decimal, or null when not rated.
results[].rating_countinteger | nullyesHow many ratings it is based on.
results[].genres[]string[]yes
results[].descriptionstring | nullyesA few sentences about it, shortened, or null.
results[].urlurl | nullyesThe book's page at Open Library.
facetsobjectyesFor every option: how many books there would be with it alone chosen in its section and every other section's filters as they are. Genres and authors: the most common ones among the books, most first, the chosen ones always included.
facets.genres[]object[]yesBy genre.
facets.genres[].valuestringyesA genre (science_fiction, mystery) or an author's name as a slug (stephen_king, jrr_tolkien).
facets.genres[].labelstringyes
facets.genres[].countintegeryes
facets.authors[]object[]yesBy author.
facets.authors[].valuestringyesA genre (science_fiction, mystery) or an author's name as a slug (stephen_king, jrr_tolkien).
facets.authors[].labelstringyes
facets.authors[].countintegeryes
facets.ratingobjectyesBy minimum rating.
facets.rating.4integer
facets.rating.3.5integer
facets.rating.4.5integer
facets.publishednull | objectyes
facets.published.minintegeryes
facets.published.maxintegeryes
facets.published.bins[]integer[]yes
facets.lengthobjectyesBy length.
facets.length.shortinteger
facets.length.mediuminteger
facets.length.longinteger
relax[]object[]yesOnly when nothing matches: applied filters that, dropped alone, bring books back, with how many. Empty otherwise.
relax[].filterobjectyesOne applied filter: a genre or author with its value, or the rating, published or length (value null).
relax[].filter.kindenumyesgenre · author · rating · published · length
relax[].filter.valuestring | nullyes
relax[].countintegeryes
creditstringyesWhere the books and covers come from. Show it with the results.

Example

A recorded answer to “Cozy mysteries”. Open it in the Answer Lab to see every layout and style.

Response
{
  "v": 2,
  "id": "ans_q1k86b9fakrrlrds",
  "matched": true,
  "locale": "en",
  "skill": "book_search",
  "confidence": 0.9,
  "text": "19 books for cozy mysteries. The best matches: Chocolate Chip Cookie Murder (Joanne Fluke, 2000); Aunt Dimity's Death (Nancy Atherton, 1992); Sugar Cookie Murder (Joanne Fluke, 2004); Key Lime Pie Murder (Joanne Fluke, 2007); Death at Wentwater Court (Carola Dunn, 1994).",
  "speech": "I found 19 books for cozy mysteries. The first is Chocolate Chip Cookie Murder by Joanne Fluke.",
  "card": {
    "type": "book.search",
    "version": 1,
    "data": {
      "query": "cozy mysteries",
      "filters": {
        "genres": [],
        "authors": [],
        "rating": null,
        "published": {
          "min": null,
          "max": null
        },
        "length": null
      },
      "sort": "match",
      "total": 19,
      "capped": false,
      "limit": 24,
      "results": [
        {
          "id": 515898,
          "title": "Chocolate Chip Cookie Murder",
          "subtitle": null,
          "cover_url": "https://webknox.com/media/v1/covers.openlibrary.org/b/id/7401253-L.jpg",
          "authors": [
            "Joanne Fluke"
          ],
          "year": 2000,
          "pages": 340,
          "rating": 3.7,
          "rating_count": 41200,
          "genres": [
            "Mystery",
            "Fiction"
          ],
          "description": "Bakery owner Hannah Swensen finds a deliveryman dead behind her cookie shop in small-town Minnesota and starts asking questions.",
          "url": "https://openlibrary.org/works/OL515898W"
        },
        {
          "id": 14949603,
          "title": "Aunt Dimity's Death",
          "subtitle": null,
          "cover_url": "https://webknox.com/media/v1/covers.openlibrary.org/b/id/10020476-L.jpg",
          "authors": [
            "Nancy Atherton"
          ],
          "year": 1992,
          "pages": 256,
          "rating": 4,
          "rating_count": 14300,
          "genres": [
            "Mystery",
            "Paranormal",
            "Fiction"
          ],
          "description": "A quiet Boston secretary inherits a cottage in the Cotswolds from a woman she thought was only a bedtime story, along with a friendly ghost.",
          "url": "https://openlibrary.org/works/OL14949603W"
        },
        {
          "id": 21183325,
          "title": "Sugar Cookie Murder",
          "subtitle": null,
          "cover_url": "https://webknox.com/media/v1/covers.openlibrary.org/b/id/13108339-L.jpg",
          "authors": [
            "Joanne Fluke"
          ],
          "year": 2004,
          "pages": 336,
          "rating": 3.8,
          "rating_count": 9800,
          "genres": [
            "Mystery",
            "Fiction"
          ],
          "description": null,
          "url": "https://openlibrary.org/works/OL21183325W"
        },
        {
          "id": 515925,
          "title": "Key Lime Pie Murder",
          "subtitle": null,
          "cover_url": "https://webknox.com/media/v1/covers.openlibrary.org/b/id/1416795-L.jpg",
          "authors": [
            "Joanne Fluke"
          ],
          "year": 2007,
          "pages": 357,
          "rating": 3.9,
          "rating_count": 8900,
          "genres": [
            "Mystery",
            "Fiction"
          ],
          "description": null,
          "url": "https://openlibrary.org/works/OL515925W"
        },
        {
          "id": 20885652,
          "title": "Death at Wentwater Court",
          "subtitle": null,
          "cover_url": "https://webknox.com/media/v1/covers.openlibrary.org/b/id/10213060-L.jpg",
          "authors": [
            "Carola Dunn"
          ],
          "year": 1994,
          "pages": 250,
          "rating": 3.7,
          "rating_count": 6100,
          "genres": [
            "Mystery",
            "Historical fiction",
            "Fiction"
          ],
          "description": "A young journalist in 1920s England goes to a country house to write about it and finds a guest dead on the ice.",
          "url": "https://openlibrary.org/works/OL20885652W"
        },
        {
          "id": 15951438,
          "title": "As the Pig Turns",
          "subtitle": null,
          "cover_url": "https://webknox.com/media/v1/covers.openlibrary.org/b/id/8239002-L.jpg",
          "authors": [
            "M. C. Beaton"
          ],
          "year": 2011,
          "pages": 292,
          "rating": 3.7,
          "rating_count": 5200,
          "genres": [
            "Mystery",
            "Fiction"
          ],
          "description": null,
          "url": "https://openlibrary.org/works/OL15951438W"
        },
        {
          "id": 1985111,
          "title": "Murder with Puffins",
          "subtitle": null,
          "cover_url": "https://webknox.com/media/v1/covers.openlibrary.org/b/id/14598684-L.jpg",
          "authors": [
            "Donna Andrews"
          ],
          "year": 2000,
          "pages": 308,
          "rating": 3.8,
          "rating_count": 5600,
          "genres": [
            "Mystery",
            "Humor",
            "Fiction"
          ],
          "description": "A getaway to a remote Maine island with her boyfriend turns into a murder investigation for blacksmith Meg Langslow, and a hunt among the puffin watchers.",
          "url": "https://openlibrary.org/works/OL1985111W"
        },
        {
          "id": 17316,
          "title": "The Winter Garden Mystery",
          "subtitle": null,
          "cover_url": "https://webknox.com/media/v1/covers.openlibrary.org/b/id/829126-L.jpg",
          "authors": [
            "Carola Dunn"
          ],
          "year": 1995,
          "pages": 256,
          "rating": 3.8,
          "rating_count": 3200,
          "genres": [
            "Mystery",
            "Historical fiction",
            "Fiction"
          ],
          "description": null,
          "url": "https://openlibrary.org/works/OL17316W"
        },
        {
          "id": 20853633,
          "title": "Agatha Raisin and the Blood of an Englishman",
          "subtitle": null,
          "cover_url": "https://webknox.com/media/v1/covers.openlibrary.org/b/id/10166188-L.jpg",
          "authors": [
            "M. C. Beaton"
          ],
          "year": 2014,
          "pages": 232,
          "rating": 3.7,
          "rating_count": 4100,
          "genres": [
            "Mystery",
            "Fiction"
          ],
          "description": null,
          "url": "https://openlibrary.org/works/OL20853633W"
        },
        {
          "id": 20032918,
          "title": "Pushing Up Daisies",
          "subtitle": null,
          "cover_url": "https://webknox.com/media/v1/covers.openlibrary.org/b/id/13084796-L.jpg",
          "authors": [
            "M. C. Beaton"
          ],
          "year": 2016,
          "pages": 280,
          "rating": 3.6,
          "rating_count": 2900,
          "genres": [
            "Mystery",
            "Fiction"
          ],
          "description": null,
          "url": "https://openlibrary.org/works/OL20032918W"
        },
        {
          "id": 14911361,
          "title": "Double Shot",
          "subtitle": null,
          "cover_url": "https://webknox.com/media/v1/covers.openlibrary.org/b/id/27482-L.jpg",
          "authors": [
            "Diane Mott Davidson"
          ],
          "year": 2004,
          "pages": 400,
          "rating": 4,
          "rating_count": 3900,
          "genres": [
            "Mystery",
            "Fiction"
          ],
          "description": null,
          "url": "https://openlibrary.org/works/OL14911361W"
        },
        {
          "id": 529879,
          "title": "Mail-Order Murder",
          "subtitle": null,
          "cover_url": "https://webknox.com/media/v1/covers.openlibrary.org/b/id/9552301-L.jpg",
          "authors": [
            "Leslie Meier"
          ],
          "year": 1991,
          "pages": null,
          "rating": 3.6,
          "rating_count": 3100,
          "genres": [
            "Mystery",
            "Fiction"
          ],
          "description": null,
          "url": "https://openlibrary.org/works/OL529879W"
        },
        {
          "id": 27876,
          "title": "Mrs. Pollifax on the China Station",
          "subtitle": null,
          "cover_url": "https://webknox.com/media/v1/covers.openlibrary.org/b/id/10649226-L.jpg",
          "authors": [
            "Dorothy Gilman"
          ],
          "year": 1983,
          "pages": 184,
          "rating": 4.1,
          "rating_count": 2400,
          "genres": [
            "Mystery",
            "Fiction"
          ],
          "description": null,
          "url": "https://openlibrary.org/works/OL27876W"
        },
        {
          "id": 515920,
          "title": "Cream Puff Murder",
          "subtitle": null,
          "cover_url": "https://webknox.com/media/v1/covers.openlibrary.org/b/id/7401205-L.jpg",
          "authors": [
            "Joanne Fluke"
          ],
          "year": 2009,
          "pages": 469,
          "rating": 3.8,
          "rating_count": 8100,
          "genres": [
            "Mystery",
            "Romance",
            "Fiction"
          ],
          "description": null,
          "url": "https://openlibrary.org/works/OL515920W"
        },
        {
          "id": 21675300,
          "title": "Death of a Charming Man",
          "subtitle": null,
          "cover_url": "https://webknox.com/media/v1/covers.openlibrary.org/b/id/10393048-L.jpg",
          "authors": [
            "M. C. Beaton"
          ],
          "year": 1994,
          "pages": 276,
          "rating": 3.8,
          "rating_count": 4600,
          "genres": [
            "Mystery",
            "Fiction"
          ],
          "description": null,
          "url": "https://openlibrary.org/works/OL21675300W"
        },
        {
          "id": 21891560,
          "title": "Christmas Cupcake Murder",
          "subtitle": null,
          "cover_url": "https://webknox.com/media/v1/covers.openlibrary.org/b/id/10886869-L.jpg",
          "authors": [
            "Joanne Fluke"
          ],
          "year": 2020,
          "pages": 288,
          "rating": 3.5,
          "rating_count": 2100,
          "genres": [
            "Mystery",
            "Fiction"
          ],
          "description": null,
          "url": "https://openlibrary.org/works/OL21891560W"
        },
        {
          "id": 24259726,
          "title": "Death of a Gentle Lady",
          "subtitle": null,
          "cover_url": "https://webknox.com/media/v1/covers.openlibrary.org/b/id/10746953-L.jpg",
          "authors": [
            "M. C. Beaton"
          ],
          "year": 2008,
          "pages": 312,
          "rating": 3.8,
          "rating_count": 3800,
          "genres": [
            "Mystery",
            "Fiction"
          ],
          "description": null,
          "url": "https://openlibrary.org/works/OL24259726W"
        },
        {
          "id": 22436551,
          "title": "Triple Chocolate Cheesecake Murder",
          "subtitle": null,
          "cover_url": "https://webknox.com/media/v1/covers.openlibrary.org/b/id/10459714-L.jpg",
          "authors": [
            "Joanne Fluke"
          ],
          "year": 2021,
          "pages": 304,
          "rating": 3.5,
          "rating_count": 1700,
          "genres": [
            "Mystery",
            "Fiction"
          ],
          "description": null,
          "url": "https://openlibrary.org/works/OL22436551W"
        },
        {
          "id": 15602951,
          "title": "A Highland Christmas",
          "subtitle": null,
          "cover_url": "https://webknox.com/media/v1/covers.openlibrary.org/b/id/10967568-L.jpg",
          "authors": [
            "M. C. Beaton"
          ],
          "year": 1999,
          "pages": 144,
          "rating": 3.9,
          "rating_count": 3300,
          "genres": [
            "Mystery",
            "Fiction"
          ],
          "description": null,
          "url": "https://openlibrary.org/works/OL15602951W"
        }
      ],
      "facets": {
        "genres": [
          {
            "value": "fiction",
            "label": "Fiction",
            "count": 19
          },
          {
            "value": "mystery",
            "label": "Mystery",
            "count": 19
          },
          {
            "value": "historical_fiction",
            "label": "Historical fiction",
            "count": 2
          },
          {
            "value": "humor",
            "label": "Humor",
            "count": 1
          },
          {
            "value": "paranormal",
            "label": "Paranormal",
            "count": 1
          },
          {
            "value": "romance",
            "label": "Romance",
            "count": 1
          }
        ],
        "authors": [
          {
            "value": "joanne_fluke",
            "label": "Joanne Fluke",
            "count": 6
          },
          {
            "value": "mc_beaton",
            "label": "M. C. Beaton",
            "count": 6
          },
          {
            "value": "carola_dunn",
            "label": "Carola Dunn",
            "count": 2
          },
          {
            "value": "diane_mott_davidson",
            "label": "Diane Mott Davidson",
            "count": 1
          },
          {
            "value": "donna_andrews",
            "label": "Donna Andrews",
            "count": 1
          },
          {
            "value": "dorothy_gilman",
            "label": "Dorothy Gilman",
            "count": 1
          },
          {
            "value": "leslie_meier",
            "label": "Leslie Meier",
            "count": 1
          },
          {
            "value": "nancy_atherton",
            "label": "Nancy Atherton",
            "count": 1
          }
        ],
        "rating": {
          "4": 3,
          "3.5": 19,
          "4.5": 0
        },
        "published": {
          "min": 1983,
          "max": 2021,
          "bins": [
            1,
            0,
            1,
            3,
            1,
            1,
            2,
            2,
            2,
            1,
            1,
            2,
            0,
            2
          ]
        },
        "length": {
          "short": 2,
          "medium": 15,
          "long": 1
        }
      },
      "relax": [],
      "credit": "Books and covers: Open Library. Cover art: the books' publishers."
    }
  },
  "sources": [
    {
      "name": "Open Library",
      "url": "https://openlibrary.org",
      "license": null
    }
  ],
  "follow_ups": [],
  "actions": [],
  "usage": {
    "billable": true
  }
}