loc.gov API: Search Library of Congress collections
Searches Library of Congress digital collections by keywords, material format and date range, in Library search relevance order. Rights notes may be unavailable for some records.
Unofficial. Not affiliated with or endorsed by loc.gov.
Inputs
Values from the run on Oct 31, 2026, shown under Output.
- Page optional
page Page of search results, for example 2.
1
Whole number 1 or more. Default
1.- Query, required
query Keywords to search, for example Civil War photographs.
Civil War photographs
- Format optional
format Material format, for example maps; any searches all formats.
photos
One of
any,photos,maps,manuscripts,newspapers,audio,films,books. Defaultany.- End Year optional
end_year Latest year, for example 1865.
1865
Whole number from 1 to 9999.
- Start Year optional
start_year Earliest year, for example 1861.
1861
Whole number from 1 to 9999.
- Max Results optional
max_results Results per page, for example 20.
3
Whole number from 1 to 100. Default
20.
Input as JSON
{ "page": 1, "query": "Civil War photographs", "format": "photos", "end_year": 1865, "start_year": 1861, "max_results": 3}Output
{ "results": [ { "date": "1860", "title": "Civil War", "format": "Collection; Photo, Print, Drawing", "summary": "Explore the faces, places and events of the U.S. Civil War through photographs, prints and drawings. The Prints & Photographs Division holds thousands of images relating to the Civil War, found in many different collections. This category allows research across those collections.", "item_link": "https://www.loc.gov/collections/civil-war/about-this-collection/" , "rights_and_usage": null, "thumbnail_image_link": "https://www.loc.gov/static/collections/civil-war/500_500.jpg" , "creators_or_contributors": "gibson, james f.; brady, mathew b.; o'sullivan, timothy h.; barnard, george n.; smith, william morris; gardner, alexander" }, { "date": "1850", "title": "Liljenquist Family Collection of Civil War Photographs", "format": "Collection; Photo, Print, Drawing", "summary": "New Photos Added! View the most recent additions", "item_link": "https://www.loc.gov/collections/liljenquist-civil-war-photographs/about-this-collection/" , "rights_and_usage": null, "thumbnail_image_link": "https://www.loc.gov/static/collections/liljenquist-civil-war-photographs/500_500.jpg" , "creators_or_contributors": "liljenquist, thomas richard; liljenquist, christian blaine; liljenquist, brandon paul; liljenquist, jason george" }, { "date": "1824", "title": "The Alfred Whital Stern Collection of Lincolniana", "format": "Collection; Book; Photo, Print, Drawing; Notated Music", "summary": "The collection contains more than 11,100 items. This online release presents more than 1,300 items with more than 4,000 images and a date range of 1824-1931. It includes the complete collection of Stern's contemporary newspapers, Lincoln's law papers, sheet music, broadsides, prints, cartoons, maps,…", "item_link": "https://www.loc.gov/collections/alfred-whital-stern-lincolniana/about-this-collection/" , "rights_and_usage": null, "thumbnail_image_link": "https://www.loc.gov/static/collections/alfred-whital-stern-lincolniana/500_500.jpg" , "creators_or_contributors": "alfred whital stern collection of lincolniana (library of congress); stern, alfred whital; library of congress" } ]}Code
curl https://api.fous.com/v1/runs \ -H "Authorization: Bearer $FOUS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"method":"loc.gov/search_collections","input":{"page":1,"query":"Civil War photographs","format":"photos","end_year":1865,"start_year":1861,"max_results":3}}' # Save as fous.py, then run: python3 fous.pyimport json, os, timefrom urllib.error import HTTPErrorfrom urllib.request import Request, urlopenAPI = "https://api.fous.com/v1/runs" KEY = os.environ["FOUS_API_KEY"]HEADERS = { "Authorization": f"Bearer {KEY}", "Content-Type": "application/json" ,}def call(url, body=None): data = json.dumps(body).encode() if body else None request = Request(url, data, HEADERS) try: with urlopen(request, timeout=120) as r: return r.status, json.load(r) except HTTPError as error: message = json.load(error)["error"]["message"] raise RuntimeError(message) from errorstatus, run = call(API, { "method": "loc.gov/search_collections" , "input": { "page": 1, "query": "Civil War photographs", "format": "photos", "end_year": 1865, "start_year": 1861, "max_results": 3 }})# 202: still going after 30 s. Ask again until it ends.while status == 202: time.sleep(2) status, run = call(f"{API}/{run['id']}")print(json.dumps(run["data"], indent=2))// Save as fous.mjs, then run: node fous.mjsconst api = "https://api.fous.com/v1/runs" ;const headers = { Authorization: `Bearer ${process.env.FOUS_API_KEY}`, "Content-Type": "application/json" ,};let response = await fetch(api, { method: "POST", headers, body: JSON.stringify({ "method": "loc.gov/search_collections" , "input": { "page": 1, "query": "Civil War photographs", "format": "photos", "end_year": 1865, "start_year": 1861, "max_results": 3 } }), signal: AbortSignal.timeout(120_000),});let run = await response.json();// 202: still going after 30 s. Ask again until it ends.while (response.status === 202) { await new Promise((done) => setTimeout(done, 2_000)); response = await fetch(`${api}/${run.id}`, { headers }); run = await response.json();}if (!response.ok) throw new Error(run.error.message);console.log(run.data);# Connect your agent to Fous once, over MCP (Streamable HTTP):# https://api.fous.com/mcp# Set FOUS_API_KEY first: create a key at https://app.fous.com/keys.# Claude Codeclaude mcp add \ --scope user \ --transport http fous https://api.fous.com/mcp \ --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"# Codexcodex mcp add fous \ --url https://api.fous.com/mcp \ --bearer-token-env-var FOUS_API_KEY# Cursor, VS Code, Windsurf, Cline and morenpx -y add-mcp https://api.fous.com/mcp -g -n fous \ --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"# Then ask your agent:# "Use Fous to run loc.gov/search_collections# with {"page":1,"query":"Civil War photographs","format":"photos","end_year":1865,"start_year":1861,"max_results":3}"Over HTTP, the answer’s data holds the output. A run still going after 30 seconds answers 202 with its id: ask GET /v1/runs/{id} until it ends.
Schema
Input schema
{ "type": "object", "required": [ "query" ], "properties": { "page": { "type": "integer", "default": 1, "minimum": 1, "description": "Page of search results, for example 2." }, "query": { "type": "string", "minLength": 1, "description": "Keywords to search, for example Civil War photographs." }, "format": { "enum": [ "any", "photos", "maps", "manuscripts", "newspapers", "audio", "films", "books" ], "type": "string", "default": "any", "description": "Material format, for example maps; any searches all formats." }, "end_year": { "type": "integer", "maximum": 9999, "minimum": 1, "description": "Latest year, for example 1865." }, "start_year": { "type": "integer", "maximum": 9999, "minimum": 1, "description": "Earliest year, for example 1861." }, "max_results": { "type": "integer", "default": 20, "maximum": 100, "minimum": 1, "description": "Results per page, for example 20." } }}Output schema
{ "type": "object", "required": [ "results" ], "properties": { "results": { "type": "array", "items": { "type": "object", "required": [ "title", "date", "format", "creators_or_contributors", "summary", "rights_and_usage", "thumbnail_image_link", "item_link" ], "properties": { "date": { "type": [ "string", "null" ] }, "title": { "type": [ "string", "null" ] }, "format": { "type": [ "string", "null" ] }, "summary": { "type": [ "string", "null" ] }, "item_link": { "type": "string" }, "rights_and_usage": { "type": [ "string", "null" ] }, "thumbnail_image_link": { "type": [ "string", "null" ] }, "creators_or_contributors": { "type": [ "string", "null" ] } }, "additionalProperties": false }, "description": "Matching collections and digital items, in Library search order." } }, "additionalProperties": false}- Price
- 1 credit per completed run (1¢ with pay as you go); failed runs are free.
- Method
loc.gov/search_collections- Returns
- title, date, format, creators or contributors, summary, rights and usage, thumbnail, item link
Use it from your agent
Give your agent this line. It reads SKILL.md, gets a Fous API key and connects the Fous MCP server. Its run then takes the method loc.gov/search_collections with the inputs above.
Ask your agent
- Find Library of Congress photographs of Dust Bowl farm families taken between 1934 and 1940
- Search loc.gov for maps of San Francisco from 1850 to 1906, and give me 50 results per page
- I need digitized manuscripts related to Frederick Douglass — show me titles, dates, creators, and whether they're free to reuse
- Any old audio recordings of Appalachian fiddle music from the 1920s or 1930s? Include thumbnails and links to the items.
- Show me page 3 of newspaper results about the 1918 influenza pandemic, covering 1918 to 1919
See more
All loc.gov methodsSearches historic U.S. newspaper pages (Chronicling America) by text, with optional state and issue-year filters. Returns relevance-ranked page records with snippets and image links; newspaper OCR may contain transcription errors.
loc.gov/search_historic_newspapersFinds Open Library books by search words, optionally narrowed by author and subject, sorted by relevance or publication age. Returns work-level results; free_online means at least one edition is marked public or borrowable, not that a loan is available now.
openlibrary.org/search_booksSearches public National Archives Catalog records by keywords, year range, material type and online availability, in catalog relevance order.
catalog.archives.gov/search_recordsSearches New York Times article headlines and summaries by keyword, optionally within a date range, and returns matching articles with dates, authors, sections and links, newest or most relevant first.
nytimes.com/search_newsFinds poems matching a topic or occasion, or poems by a named poet, in Poetry Foundation search order. Older magazine poems without public text have no first two lines; untagged poems have no themes or occasions.
poetryfoundation.org/search_poemsSearches NASA public photos, videos or audio by words and creation year, returning matches in relevance order with thumbnails and full-size file links.
nasa.gov/search_imagesSearches NPR-published articles by keyword, newest first or by best match, with optional publication dates, and returns each article's date, authors, section and summary.
npr.org/search_newsFinds an Open Library author by name, link or key and lists their works with first publication year, edition count, cover and an author profile.
openlibrary.org/list_author_books