| 0 |
The Open Library Books API provides a programmatic client-side method for querying information of books using Javascript. |
0 |
[Developer Center](https://openlibrary.org/developers/api) → [APIs](https://openlibrary.org/dev/docs/api) → Books API |
| 1 |
|
1 |
|
| 2 |
This API is inspired by the Google Books [Dynamic links API][dynlinks] and is compatible with it. You can also pass people to an Open Library edition page by using a URL like this: <code>http://openlibrary.org/isbn/123</code>. |
2 |
|
| 3 |
|
3 |
## Book APIs |
| 4 |
[dynlinks]: http://code.google.com/apis/books/docs/dynamic-links.html |
4 |
|
| 5 |
|
5 |
Open Library has several APIs for accessing Book data. |
| 6 |
## API |
6 |
|
| 7 |
|
7 |
1. The [**Search** API](https://openlibrary.org/dev/docs/api/search) (preferred, multi) |
| 8 |
The API allows requesting information on one or more books using ISBNs, OCLC Numbers, LCCNs and OLIDs (Open Library IDs). |
8 |
2. The **Works** API (by Work ID) |
|
|
9 |
3. The **Editions** API (by Edition ID) |
|
|
10 |
4. The **ISBN** API (by ISBN) |
|
|
11 |
5. The **Books** API (generic) |
|
|
12 |
|
|
|
13 |
## The Book Search API |
|
|
14 |
|
|
|
15 |
If you are looking for a single API to meet all of your book needs, it's likely the [Book Search API](https://openlibrary.org/dev/docs/api/search). |
|
|
16 |
|
|
|
17 |
## Learnings about Works v Editions |
|
|
18 |
|
|
|
19 |
When we [refer to books](https://openlibrary.org/about/lib) on Open Library, we're often referring to a specific work and possibly a specific edition of this work. |
|
|
20 |
|
|
|
21 |
A Work is a logical collection of similar Editions. "Fantastic Mr. Fox" could be a Work which contains a Spanish translation edition, or perhaps a 2nd edition which has an additional chapter or corrections. Work metadata will include general umbrella information about a book, whereas an Edition will have a publisher, an ISBN, a book-jacket, and other specific information. |
|
|
22 |
|
|
|
23 |
Both Work and Edition pages on Open Library (i.e. the pages you navigate to) may also be returned as json or yml (in addition to HTML) by modifying the page URL. |
|
|
24 |
|
|
|
25 |
Learn more about the [fields](https://openlibrary.org/about/work_edition) that belong to works and editions. |
|
|
26 |
|
|
|
27 |
### Works API |
|
|
28 |
|
|
|
29 |
Work pages on Open Library begin with the URL prefix "/works". |
|
|
30 |
|
|
|
31 |
Here is an example: |
|
|
32 |
https://openlibrary.org/works/OL45804W/Fantastic_Mr._FOX |
|
|
33 |
|
|
|
34 |
In this example, if we remove the /Title from the URL (e.g. https://openlibrary.org/works/OL45804W) and then add a suffix of ".json" or ".yml" to the end, the page will return a data representation instead of HTML, e.g.: |
|
|
35 |
|
|
|
36 |
https://openlibrary.org/works/OL45804W.json |
|
|
37 |
|
|
|
38 |
#### Fetching a Work's Editions |
|
|
39 |
|
|
|
40 |
You can fetch a work's editions by adding `/editions.json` after the work ID: |
|
|
41 |
|
|
|
42 |
https://openlibrary.org/works/OL45804W/editions.json |
|
|
43 |
|
|
|
44 |
#### Ratings and Bookshelves |
|
|
45 |
|
|
|
46 |
Can be accessed by the following APIs: |
|
|
47 |
https://openlibrary.org/works/OL18020194W/bookshelves.json |
|
|
48 |
https://openlibrary.org/works/OL18020194W/ratings.json |
|
|
49 |
|
|
|
50 |
### Editions API |
|
|
51 |
|
|
|
52 |
Edition pages on Open Library begin with the prefix "/books". |
|
|
53 |
|
|
|
54 |
Here is an example: |
|
|
55 |
https://openlibrary.org/books/OL7353617M/Fantastic_Mr._Fox |
|
|
56 |
|
|
|
57 |
In this example, if we remove the /Title from the URL (e.g. https://openlibrary.org/works/OL45804W) and then add a suffix of ".json" or ".yml" to the end, the page will return a data representation instead of HTML, e.g.: |
|
|
58 |
|
|
|
59 |
https://openlibrary.org/books/OL7353617M.json |
|
|
60 |
|
|
|
61 |
|
|
|
62 |
### ISBN API |
|
|
63 |
|
|
|
64 |
The ISBN API is a special case and alternative approach to arriving at an Editions page. Instead of "/books", a path of "/isbn" is used, followed by a valid ISBN 10 or 13. |
|
|
65 |
|
|
|
66 |
Here is an example: |
|
|
67 |
https://openlibrary.org/isbn/9780140328721 |
|
|
68 |
|
|
|
69 |
In this example, entering this URL will result in a redirect to the appropriate Editions page: https://openlibrary.org/books/OL7353617M |
|
|
70 |
|
|
|
71 |
Just like an Edition or Work page, we may add ".json" to the end of the URL to request the response in json instead of as HTML, e.g.: |
|
|
72 |
|
|
|
73 |
https://openlibrary.org/isbn/9780140328721.json |
|
|
74 |
|
|
|
75 |
## Legacy Book API |
|
|
76 |
|
|
|
77 |
Please consider using the Book Search API above; this is a legacy endpoint and may be phased out in the future. |
|
|
78 |
|
|
|
79 |
The Book API is a generic, flexible, configurable endpoint which allows requesting information on one or more books using ISBNs, OCLC Numbers, LCCNs and OLIDs (Open Library IDs). It is inspired by the Google Books [Dynamic links API][dynlinks] and is compatible with it. |
|
|
80 |
[dynlinks]: https://code.google.com/apis/books/docs/dynamic-links.html |
|
|
81 |
|
| 9 |
|
82 |
|
| 10 |
At the core of the API is a URL format that allows developers to construct URLs requesting information on one or more books and send the requests to the Open Library using the `<script>` tag. |
83 |
At the core of the API is a URL format that allows developers to construct URLs requesting information on one or more books and send the requests to the Open Library using the `<script>` tag. |
| 11 |
|
84 |
|
| 12 |
<script src="http://openlibrary.org/api/books?bibkeys=ISBN:0451526538&callback=mycallback"></script> |
85 |
<script src="https://openlibrary.org/api/books?bibkeys=ISBN:0451526538&callback=mycallback"></script> |
| 13 |
|
13 |
|
| ... |
|
... |
|
| 35 |
|
35 |
|
| 36 |
&bibkeys=OLID:OL123W |
109 |
&bibkeys=OLID:OL123M |
| 37 |
|
37 |
|
| ... |
|
... |
|
| 47 |
|
47 |
|
| 48 |
Optional paramater to decide what information to provide for each matched `bib_key`. Possible values are `viewapi` and `data`. The default value is `viewapi`. |
121 |
Optional parameter to decide what information to provide for each matched `bib_key`. Possible values are `viewapi` and `data`. The default value is `viewapi`. |
| 49 |
|
49 |
|
| ... |
|
... |
|
| 67 |
|
67 |
|
| 68 |
$ curl 'http://openlibrary.org/api/books?bibkeys=ISBN:0201558025,LCCN:93005405&callback=processBooks' |
141 |
$ curl 'https://openlibrary.org/api/books?bibkeys=ISBN:0201558025,LCCN:93005405&callback=processBooks' |
| 69 |
processBooks({ |
69 |
processBooks({ |
| ... |
|
... |
|
| 80 |
|
80 |
|
| 81 |
$ curl 'http://openlibrary.org/api/books?bibkeys=ISBN:0201558025,LCCN:93005405&format=json' |
154 |
$ curl 'https://openlibrary.org/api/books?bibkeys=ISBN:0201558025,LCCN:93005405&format=json' |
| 82 |
{ |
82 |
{ |
| ... |
|
... |
|
| 113 |
|
113 |
|
| 114 |
A URL to the preview of the book. This is provided only when the fulltext of the book is available. |
187 |
A URL to the preview of the book. |
|
|
188 |
|
|
|
189 |
This links to the archive.org page when a readable version of the book is available, otherwise it links to the book page on openlibrary.org. |
|
|
190 |
|
|
|
191 |
Please note that the `preview_url` is always provided even if there is no readable version available. The `preview` property should be used to test if a book is readable. |
| 115 |
|
115 |
|
| ... |
|
... |
|
| 121 |
|
121 |
|
| 122 |
$ curl 'http://openlibrary.org/api/books?bibkeys=ISBN:0385472579,LCCN:62019420&format=json' |
199 |
$ curl 'https://openlibrary.org/api/books?bibkeys=ISBN:0385472579,LCCN:62019420&format=json' |
| 123 |
{ |
200 |
{ |
| 124 |
"ISBN:0385472579": { |
201 |
"ISBN:0385472579": { |
| 125 |
"bib_key": "ISBN:0385472579", |
202 |
"bib_key": "ISBN:0385472579", |
| 126 |
"preview": "noview", |
203 |
"preview": "noview", |
| 127 |
"thumbnail_url": "http://covers.openlibrary.org/b/id/240726-S.jpg", |
204 |
"thumbnail_url": "https://covers.openlibrary.org/b/id/240726-S.jpg", |
| 128 |
"preview_url": "http://openlibrary.org/books/OL1397864M/Zen_speaks", |
205 |
"preview_url": "https://openlibrary.org/books/OL1397864M/Zen_speaks", |
| 129 |
"info_url": "http://openlibrary.org/books/OL1397864M/Zen_speaks" |
206 |
"info_url": "https://openlibrary.org/books/OL1397864M/Zen_speaks" |
| 130 |
}, |
207 |
}, |
| 131 |
"LCCN:62019420": { |
208 |
"LCCN:62019420": { |
| 132 |
"bib_key": "LCCN:62019420", |
209 |
"bib_key": "LCCN:62019420", |
| 133 |
"preview": "full", |
210 |
"preview": "full", |
| 134 |
"thumbnail_url": "http://covers.openlibrary.org/b/id/6121771-S.jpg", |
211 |
"thumbnail_url": "https://covers.openlibrary.org/b/id/6121771-S.jpg", |
| 135 |
"preview_url": "http://www.archive.org/details/adventurestomsa00twaigoog", |
212 |
"preview_url": "https://archive.org/details/adventurestomsa00twaigoog", |
| 136 |
"info_url": "http://openlibrary.org/books/OL23377687M/adventures_of_Tom_Sawyer" |
213 |
"info_url": "https://openlibrary.org/books/OL23377687M/adventures_of_Tom_Sawyer" |
| 137 |
} |
137 |
} |
| ... |
|
... |
|
| 157 |
"name": "...", |
157 |
"name": "...", |
| 158 |
"url": "http://openlibrary.org/authors/..." |
235 |
"url": "https://openlibrary.org/authors/..." |
| 159 |
} |
159 |
} |
| ... |
|
... |
|
| 186 |
{ |
186 |
{ |
| 187 |
"url": "http://openlibrary.org/subjects/history", |
264 |
"url": "https://openlibrary.org/subjects/history", |
| 188 |
"name": "History" |
188 |
"name": "History" |
| ... |
|
... |
|
| 224 |
{ |
224 |
{ |
| 225 |
"url": "http://...", |
302 |
"url": "https://...", |
| 226 |
"title": "..." |
226 |
"title": "..." |
| ... |
|
... |
|
| 233 |
{ |
233 |
{ |
| 234 |
"small": "http://covers.openlibrary.org/b/id/1-S.jpg", |
311 |
"small": "https://covers.openlibrary.org/b/id/1-S.jpg", |
| 235 |
"medium": "http://covers.openlibrary.org/b/id/1-M.jpg", |
312 |
"medium": "https://covers.openlibrary.org/b/id/1-M.jpg", |
| 236 |
"large": "http://covers.openlibrary.org/b/id/1-L.jpg", |
313 |
"large": "https://covers.openlibrary.org/b/id/1-L.jpg", |
| 237 |
} |
237 |
} |
| ... |
|
... |
|
| 243 |
{ |
243 |
{ |
| 244 |
"preview_url": "http://www.archive.org/details/..." |
321 |
"preview_url": "https://archive.org/details/..." |
| 245 |
} |
245 |
} |
| ... |
|
... |
|
| 257 |
|
257 |
|
| 258 |
$ curl 'http://openlibrary.org/api/books?bibkeys=ISBN:9780980200447&jscmd=data&format=json' |
335 |
$ curl 'https://openlibrary.org/api/books?bibkeys=ISBN:9780980200447&jscmd=data&format=json' |
| 259 |
{ |
259 |
{ |
| ... |
|
... |
|
| 310 |
"title": "Slow reading", |
310 |
"title": "Slow reading", |
| 311 |
"url": "http://openlibrary.org/books/OL22853304M/Slow_reading", |
388 |
"url": "https://openlibrary.org/books/OL22853304M/Slow_reading", |
| 312 |
"number_of_pages": 80, |
389 |
"number_of_pages": 80, |
| 313 |
"cover": { |
390 |
"cover": { |
| 314 |
"small": "http://covers.openlibrary.org/b/id/5546156-S.jpg", |
391 |
"small": "https://covers.openlibrary.org/b/id/5546156-S.jpg", |
| 315 |
"large": "http://covers.openlibrary.org/b/id/5546156-L.jpg", |
392 |
"large": "https://covers.openlibrary.org/b/id/5546156-L.jpg", |
| 316 |
"medium": "http://covers.openlibrary.org/b/id/5546156-M.jpg" |
393 |
"medium": "https://covers.openlibrary.org/b/id/5546156-M.jpg" |
| 317 |
}, |
394 |
}, |
| 318 |
"subjects": [ |
395 |
"subjects": [ |
| 319 |
{ |
396 |
{ |
| 320 |
"url": "http://openlibrary.org/subjects/books_and_reading", |
397 |
"url": "https://openlibrary.org/subjects/books_and_reading", |
| 321 |
"name": "Books and reading" |
398 |
"name": "Books and reading" |
| 322 |
}, |
399 |
}, |
| 323 |
{ |
400 |
{ |
| 324 |
"url": "http://openlibrary.org/subjects/reading", |
401 |
"url": "https://openlibrary.org/subjects/reading", |
| 325 |
"name": "Reading" |
325 |
"name": "Reading" |
| ... |
|
... |
|
| 330 |
{ |
330 |
{ |
| 331 |
"url": "http://openlibrary.org/authors/OL6548935A/John_Miedema", |
408 |
"url": "https://openlibrary.org/authors/OL6548935A/John_Miedema", |
| 332 |
"name": "John Miedema" |
332 |
"name": "John Miedema" |
| ... |
|
... |
|
| 354 |
|
354 |
|
| 355 |
$ curl 'http://openlibrary.org/api/books?bibkeys=ISBN:9780980200447&jscmd=details&format=json' |
432 |
$ curl 'https://openlibrary.org/api/books?bibkeys=ISBN:9780980200447&jscmd=details&format=json' |
| 356 |
{ |
433 |
{ |
| 357 |
"ISBN:9780980200447": { |
434 |
"ISBN:9780980200447": { |
| 358 |
"info_url": "http://openlibrary.org/books/OL22853304M/Slow_reading", |
435 |
"info_url": "https://openlibrary.org/books/OL22853304M/Slow_reading", |
| 359 |
"bib_key": "ISBN:9780980200447", |
436 |
"bib_key": "ISBN:9780980200447", |
| 360 |
"preview_url": "http://openlibrary.org/books/OL22853304M/Slow_reading", |
437 |
"preview_url": "https://openlibrary.org/books/OL22853304M/Slow_reading", |
| 361 |
"thumbnail_url": "http://covers.openlibrary.org/b/id/5546156-S.jpg", |
438 |
"thumbnail_url": "https://covers.openlibrary.org/b/id/5546156-S.jpg", |
| 362 |
"preview": "noview", |
362 |
"preview": "noview", |
| ... |
|
... |
|
| 500 |
Earlier these details were provided when `details=true` parameter is passed. It is equivalent to `jscmd=details` and it is retained only for backward-compataibilty. |
500 |
Earlier these details were provided when `details=true` parameter is passed. It is equivalent to `jscmd=details` and it is retained only for backward-compataibilty. |
|