Use OCLC WorldCat APIs to search for books and scholarly materials, retrieve bibliographic metadata, check library holdings worldwide, and get classification data...
WorldCat is the world's largest library catalog with 500+ million bibliographic records and holdings from 10,000+ libraries worldwide.
For detailed bibliographic records and metadata.
Python Library: bookops-worldcat (recommended)
from bookops_worldcat import MetadataSession, WorldcatAccessToken
# Authenticate
token = WorldcatAccessToken(
key=OCLC_CLIENT_ID,
secret=OCLC_CLIENT_SECRET,
scopes="WorldCatMetadataAPI"
)
session = MetadataSession(authorization=token)
# Search for books
response = session.brief_bibs_search(q="title:Moby Dick")
# Get classification
response = session.bib_get_classification(oclcNumber="123456")
# Check specific institutions
response = session.summary_holdings_search(
oclcNumber="123456",
heldBySymbol=["ZGM", "NYP"]
)
Key Methods:
brief_bibs_search(q=query) - search bibliographic recordssummary_holdings_search() - check holdings at specific institutionsbib_get_classification() - get LC/Dewey classificationbrief_bibs_get() - get single record by OCLC numberDocumentation: https://bookops-cat.github.io/bookops-worldcat/
For comprehensive holdings data across ALL institutions.
Important: No Python library available - use direct REST calls.
Key Endpoint - Get ALL Holdings:
import requests
from bookops_worldcat import WorldcatAccessToken
# Authenticate
token = WorldcatAccessToken(
key=OCLC_CLIENT_ID,
secret=OCLC_CLIENT_SECRET,
scopes='wcapi:view_holdings wcapi:view_institution_holdings'
)
# Get ALL institutions holding this item (ONE API call)
url = 'https://americas.discovery.api.oclc.org/worldcat/search/v2/bibs-holdings'
headers = {
'Authorization': f'Bearer {token.token_str}',
'Accept': 'application/json'
}
params = {'oclcNumber': '123456'}
response = requests.get(url, headers=headers, params=params)
data = response.json()
# Extract institution symbols
institutions = []
for record in data.get('briefRecords', []):
for holding in record.get('institutionHolding', {}).get('briefHoldings', []):
institutions.append({
'symbol': holding.get('oclcSymbol'),
'name': holding.get('institutionName'),
'country': holding.get('country')
})
symbols = [inst['symbol'] for inst in institutions]
# Returns: ["DLC", "NYP", "ZGM", "ZCU", ...]
Why This Matters: This endpoint returns ALL holdings in one API call, avoiding the need for 100+ individual requests when checking multiple institutions.
All WorldCat APIs use OAuth 2.0 Client Credentials Grant:
# Set environment variables
export OCLC_CLIENT_ID="your_client_id"
export OCLC_CLIENT_SECRET="your_client_secret"
Get credentials from OCLC Developer Network: https://developer.api.oclc.org/
When searching with incomplete or messy citations:
Example:
❌ Bad: "Ezra and Dorothy Pound: Letters in Captivity, 1945–1946"
✅ Good: "Pound Letters Captivity"
→ If 50+ results, add year: 1999
→ Pick match with correct publisher/author
Why: Bibliographic data has variations (punctuation, encoding, formatting). Better to get 20 results and filter than 0 results from being too specific.
Don't do this (slow - 150+ API calls):
for code in institution_codes: # BAD!
check_if_institution_holds(oclc_number, code)
Do this instead (fast - 1 API call):
# Get ALL holdings at once
holdings = get_all_holdings_via_search_api_v2(oclc_number)
symbols = set(holdings['institution_symbols'])
# Filter locally
tier_codes = {'NYP', 'ZCU', 'ZYU'}
matches = symbols & tier_codes
Common citation formats encountered:
(Year) Title, PublisherTitle / Vol. N, Subtitle"Title" : SubtitleAuthor. (Year). Title.Best practice: Extract clean search terms by removing volume info, subtitles, and complex punctuation initially. Add specificity only if needed.
Encoding errors:
?, �, garbled charactersMultiple OCLC records:
Missing metadata:
Libraries have OCLC institution symbols (codes):
DLC - Library of CongressNYP - New York Public LibraryZGM - CUNY Graduate CenterZCU - Columbia UniversityHUL - Harvard UniversityThe Search API V2 /bibs-holdings endpoint returns these symbols. Users typically maintain lists of symbols for their consortia.
brief_bibs_get(oclcNumber=num) or similar/bibs-holdings endpointOfficial OCLC documentation: