A request is a URL with query parameters.

Base URL

All URLs start with https://www.loc.gov/ and should include fo=json as a parameter to get JSON

No API key or authentication is required.

Searching

Get a set of items back by using one of these search endpoints. You can add parameters to the end of any of them, and should always include fo=json.

Searches everything on the www.loc.gov website. Includes items in the collection, legislation, web pages, blog posts, and press releases.

Example: https://www.loc.gov/search/?q=baseball&fo=json

The API does not include records from the library catalog (although items that have been digitized are retrievable). See the MARC Open Access dataset for bulk access to the catalog records up through 2014.

/collections/{name of collection}?

Searches within a specified collection. The name of the collection needs to be in “slug” form, which is words separated by hyphens. For example: abraham-lincoln-papers or baseball-cards. You can find the collection’s name by searching the website.

Example: https://www.loc.gov/collections/civil-war-maps?fo=json

/{format}/?

Searches for items which have a specified original format. Possible values include:

  • maps: maps
  • audio recordings: audio
  • photo, print, drawing: photos
  • manuscripts/mixed material: manuscripts
  • newspapers: newspapers
  • film, videos: film-and-videos
  • printed music, such as sheet music: notated-music
  • archived websites: websites

Example: https://www.loc.gov/maps/?q=civil war&fo=json

Common parameters

Always include fo=json in your URL so that you get JSON, not HTML.

Parameter Description Examples
q query parameter
Does a keyword search in the metadata and any available full text including video transcripts
q=kittens
fa filter or facet

takes the format filter-name:value
multiple filters can be used by separating them with a pipe character: |

Available filters/facets include:

location

subject

original-format

Many formats are also available as endpoints (e.g. /maps/). Those that are ONLY available using the filters/facets parameter include:

original-format:sound recording
original-format:legislation
original-format:periodical
original-format:personal narrative
original-format:software,e-resource
original-format:3d object

partof

Collections, divisions, and units in the Library of Congress. Most are also available using the collections endpoint. See Part ofs for a list.

contributor

fa=location:ohio

fa=location:yellowstone national park

fa=subject:meterology

fa=original-format:periodical|subject:wildlife

fa=partof:performing arts encyclopedia

fa=contributor:lange, dorothea

c results per page default is 25 c=50
sp page in results (results are returned in pages of 25 items unless specified using the c parameter) The first page is sp=1. sp=2
at attributes to return in the results

This is helpful for removing extraneous information from the results, such as more_like_this and related_items. You can specify elements to exclude using at!=

at=item
at=item,resources,reproductions
at!=more_like_this
sb sort field

Available sort options include:

date (earliest to latest)
date_desc (latest to earliest)
title_s (by title)
title_s_desc (reverse by title)
shelf_id (call number/physical location)
shelf_id_desc (reverse by call number/physical location)
sb=date_desc
sb=shelf_id

More example requests

https://www.loc.gov/collections/herblock-cartoon-drawings/?fo=json&c=100

https://www.loc.gov/photos/?fa=location:oklahoma

Requesting a specific item

/item/{identifier}/?

The best way to get at all of the fields related to a specific item is to look at search results and use the id field for that item, and put fo=json at the end. The id field is a URL; the path will vary from collection to collection.

Examples:

https://www.loc.gov/item/ggb2006012811/?fo=json

https://www.loc.gov/item/acd1999001521/PP/?fo=json

https://www.loc.gov/item/ihas.200196396/?fo=json