Open Library provides an experimental API to search.
WARNING: This is an experimental API and can change in future.
URL format
The URL format for API is simple. Take the search URL and add .json
to the end. Eg:
-
https://openlibrary.org/search.json?q=the+lord+of+the+rings
-
https://openlibrary.org/search.json?title=the+lord+of+the+rings
-
https://openlibrary.org/search.json?author=tolkien&sort=new
-
https://openlibrary.org/search.json?q=the+lord+of+the+rings&page=2
- https://openlibrary.org/search/authors.json?q=twain
URL Parameters
Parameter | Description |
---|---|
q |
The solr query. See Search HowTo for sample queries |
fields |
The fields to get back from solr. Use the special value * to get all fields (although be prepared for a very large response!).
To fetch availability data from archive.org, add the special value, availability . Example: /search.json?q=harry%20potter&fields=*,availability&limit=1. This will fetch the availability data of the first item in the `ia` field.
|
sort |
You can sort the results by various facets such as new , old , random , or key (which sorts as a string, not as the number stored in the string). For a complete list of sorts facets look here (this link goes to a specific commit, be sure to look at the latest one for changes). The default is to sort by relevance.
|
Response Format
The response with be of the following format.
{
"start": 0,
"num_found": 629,
"docs": [
{...},
{...},
...
{...}]
}
Each document specified listed in "docs" will be of the following format:
{
"cover_i": 258027,
"has_fulltext": true,
"edition_count": 120,
"title": "The Lord of the Rings",
"author_name": [
"J. R. R. Tolkien"
],
"first_publish_year": 1954,
"key": "OL27448W",
"ia": [
"returnofking00tolk_1",
"lordofrings00tolk_1",
"lordofrings00tolk_0",
],
"author_key": [
"OL26320A"
],
"public_scan_b": true
}
The fields in the doc are described by Solr schema which can be found here:
https://github.com/internetarchive/openlibrary/blob/master/conf/solr/conf/managed-schema#L136-L216
The schema is not guaranteed to be stable, but most common fields (e.g. title, IA ids, etc) should be safe to depend on.
History
- Created February 27, 2013
- 22 revisions
January 20, 2023 | Edited by raybb | Add key sort |
January 20, 2023 | Edited by raybb | improve docs about sorting |
October 7, 2022 | Edited by Mek | adding sort docs |
February 5, 2022 | Edited by Drini | Text field no longer publicly visible |
February 27, 2013 | Created by Anand Chitipothu | documented search API. |