| name | open-library-api |
| description | Search and access book metadata via the Open Library API |
| metadata | {"openclaw":{"emoji":"📕","category":"literature","subcategory":"search","keywords":["Open Library","book search","ISBN lookup","Internet Archive","book metadata","digital library"],"source":"https://openlibrary.org/"}} |
Open Library API
Overview
Open Library (by the Internet Archive) catalogs every book ever published — 40M+ editions, 20M+ unique works. The API provides book search, ISBN/OCLC lookup, cover images, and reading access for 2M+ borrowable ebooks. Particularly useful for monograph discovery, edition tracking, and bibliographic verification. Free, no authentication required.
API Endpoints
Search Books
curl "https://openlibrary.org/search.json?q=machine+learning&limit=20"
curl "https://openlibrary.org/search.json?title=deep+learning&limit=10"
curl "https://openlibrary.org/search.json?author=goodfellow&title=deep+learning"
curl "https://openlibrary.org/search.json?q=statistics&subject=data+analysis"
curl "https://openlibrary.org/search.json?q=artificial+intelligence&first_publish_year=2020"
curl "https://openlibrary.org/search.json?q=calculus&sort=editions"
Book Details
curl "https://openlibrary.org/works/OL45804W.json"
curl "https://openlibrary.org/books/OL7353617M.json"
curl "https://openlibrary.org/isbn/9780262035613.json"
curl "https://openlibrary.org/api/books?bibkeys=ISBN:9780262035613&format=json&jscmd=data"
Cover Images
https://covers.openlibrary.org/b/isbn/9780262035613-M.jpg
https://covers.openlibrary.org/b/olid/OL7353617M-L.jpg
Author Data
curl "https://openlibrary.org/authors/OL34184A.json"
curl "https://openlibrary.org/search/authors.json?q=hinton"
curl "https://openlibrary.org/authors/OL34184A/works.json?limit=20"
Search Parameters
| Parameter | Description | Example |
|---|
q | General search | q=neural+networks |
title | Title search | title=deep+learning |
author | Author search | author=bengio |
subject | Subject filter | subject=computer+science |
isbn | ISBN lookup | isbn=9780262035613 |
first_publish_year | Publication year | first_publish_year=2020 |
limit | Results (max 100) | limit=50 |
offset | Pagination | offset=50 |
sort | Sort order | new, editions, old |
fields | Return fields | key,title,author_name |
Response Structure (Search)
{
"numFound": 1250,
"docs": [
{
"key": "/works/OL45804W",
"title": "Deep Learning",
"author_name": ["Ian Goodfellow", "Yoshua Bengio", "Aaron Courville"],
"first_publish_year": 2016,
"isbn": ["9780262035613"],
"publisher": ["MIT Press"],
"subject": ["Machine learning", "Neural networks"],
"edition_count": 8,
"cover_i": 8739161
Python Usage
import requests
BASE_URL = "https://openlibrary.org"
def search_books(query: str, limit: int = 20,
subject: str = None) -> list:
"""Search Open Library for books."""
params = {"q": query, "limit": limit}
if subject:
params["subject"] = subject
resp = requests.get(f"{BASE_URL}/search.json", params=params)
resp.raise_for_status()
data = resp.json()
results = []
for doc in data.get("docs", []):
results.append({
"key": doc.get("key"),
"title": doc.get("title"),
"authors": doc.get("author_name", []),
"year": doc.get("first_publish_year"),
"publisher": doc.get("publisher", [None])[0],
"isbn": doc.get("isbn", [None])[0],
"editions": doc.get("edition_count", 0),
"subjects": doc.get("subject", [])[:5],
"ebook": doc.get("ebook_access"),
})
return results
def () -> :
resp = requests.get(
,
params={
: ,
: ,
: ,
},
)
resp.raise_for_status()
data = resp.json()
data.get(, {})
() -> :
resp = requests.get(
,
params={: limit},
)
resp.raise_for_status()
resp.json().get(, [])
books = search_books(,
subject=)
b books[:]:
()
()
info = get_by_isbn()
()
()
References