Getting Started with Library of Congress

← Library of Congress API

When to use this API

When you need to search or browse the Library of Congress digital collections — manuscripts, photographs, maps, books, audio recordings, film, newspapers, legislation, sheet music. No auth. No key. The LOC API is unusually good at historical primary sources with rich subject metadata: every item carries Library of Congress Subject Headings, multiple citation formats, and IIIF image URLs at selectable resolutions. For modern book reviews or retail availability, look elsewhere; this is archival material — the kind of thing a researcher or historian would need.

Searching across all collections

"Find items about the Underground Railroad available online." The /search/ endpoint queries across every LOC division at once. The q parameter takes a free-text query, and fo=json is mandatory — without it the API returns HTML. Add c=5 to cap results per page; the default page size is large enough to be a context-window hazard.

curl "https://www.loc.gov/search/?q=underground+railroad&c=5&fo=json" | head -c 10000
{
  "facets": [
    {
      "title": "Original Format",
      "filters": [
        {"count": 252077, "title": "Newspaper", "value": "newspaper"},
        {"count": 16267, "title": "Book/Printed Material", "value": "book"},
        {"count": 679, "title": "Manuscript/Mixed Material", "value": "manuscript/mixed material"},
        {"count": 125, "title": "Photo, Print, Drawing", "value": "photo, print, drawing"}
      ]
    },
    {
      "title": "Date",
      "filters": [
        {"count": 189315, "title": "1900 to 1999"},
        {"count": 86304, "title": "1800 to 1899"}
      ]
    }
  ],
  "content": {
    "pagination": "1 of X",
    "results": [
      {
        "id": "http://www.loc.gov/item/...",
        "title": "...",
        "date": "1850",
        "original_format": ["manuscript/mixed material"],
        "subject": ["underground railroad", "fugitive slaves", "abolitionists"],
        "url": "https://www.loc.gov/item/...",
        "digitized": true
      }
    ]
  }
}

The facets array is the real find here — it breaks the result set down by format, date range, location, and online availability before you fetch a single result item. The "Newspaper" count (252,077) dwarfs everything else because Chronicling America — LOC's newspaper digitization program — has millions of pages, and historical newspapers mention nearly every topic. If you want non-newspaper results, add fa=original-format!:newspaper to exclude them. The digitized facet tells you how many results are actually viewable online versus on-campus-only; for the Underground Railroad query, only 1,382 of 276,728 results are digitized — a ratio that's typical for pre-20th-century topics.

The Library of Congress has over 276,000 catalog entries related to the Underground Railroad, but only about 1,382 are digitized and available online. Most of the catalog entries are newspaper references; manuscripts and photographs make up a smaller but richer subset.

Retrieving a specific item's metadata

"Get details about a Rosa Parks manuscript from her family papers." Once you have an item ID from search results, the /item/{id}/ endpoint returns full metadata — citation formats, subject headings, IIIF image URLs at multiple resolutions, rights information, and related items.

curl "https://www.loc.gov/item/mss859430024/?fo=json" | head -c 10000
{
  "item": {
    "title": "Rosa Parks Papers: Family Papers, 1900-2005; Other family papers; Copies of family register pages in family Bible, circa 1900-1941 and",
    "date": "19000000/19410000",
    "format": "Manuscript",
    "source_collection": "Rosa Parks papers",
    "subjects": [
      "Civil rights--United States",
      "African Americans--Civil rights",
      "African Americans--Segregation",
      "Montgomery Bus Boycott, Montgomery, Ala., 1955-1956",
      "Race discrimination--Southern States",
      "Segregation--United States"
    ],
    "repository": "Manuscript Division",
    "rights": "No known restrictions on use or reproduction",
    "image_url": [
      "https://tile.loc.gov/image-services/iiif/service:mss:mss85943:0002:15:0002/full/pct:6.25/0/default.jpg",
      "https://tile.loc.gov/image-services/iiif/service:mss:mss85943:0002:15:0002/full/pct:25/0/default.jpg",
      "https://tile.loc.gov/image-services/iiif/service:mss:mss85943:0002:15:0002/full/pct:100/0/default.jpg"
    ]
  },
  "cite_this": {
    "apa": "Parks, R. (1900) Rosa Parks Papers: Family Papers, 1900 to 2005...",
    "chicago": "Parks, Rosa. Rosa Parks Papers: Family Papers... 1900.",
    "mla": "Parks, Rosa. Rosa Parks Papers: Family Papers... 1900."
  }
}

The image_url array contains IIIF URLs at graduated resolutions — pct:6.25 is a thumbnail, pct:25 is a reasonable screen view, pct:100 is the full scan. The IIIF URL structure is stable and predictable: swap the pct:N segment to get any resolution between 6.25% and 100%. The cite_this block gives you three citation formats out of the box — useful if the user asks "how do I cite this?" The date field uses YYYYMMDD/YYYYMMDD format with zero-padding, which is unusual; 19000000/19410000 means "circa 1900 to 1941" with unknown month/day, not January 1 of each year.

This item is from the Rosa Parks Papers, held in the Manuscript Division of the Library of Congress. It contains family register pages from the Parks family Bible, dating from approximately 1900 to 1941. There are no known restrictions on use or reproduction. The IIIF image service provides the scan at multiple resolutions — up to the full 3539 x 4541 pixel original.

Browsing a specific digital collection

"What's in the Civil War Maps collection?" The /collections/{collection_name}/ endpoint returns items from a single named collection. Collection names use kebab-case — civil-war-maps, not "Civil War Maps".

curl "https://www.loc.gov/collections/civil-war-maps/?c=3&fo=json" | head -c 10000
{
  "content": {
    "pagination": "2 of 3",
    "results": [
      {
        "title": "Western border states",
        "date": "1861-01-01",
        "original_format": ["map"],
        "description": ["Scale ca. 1:740,000. LC Civil War Maps (2nd ed.), 12.7..."],
        "image_url": ["https://tile.loc.gov/storage-services/service/gmd/gmd370/g3700/g3700/cw0012700.gif"],
        "url": "https://www.loc.gov/item/99447025/"
      }
    ]
  }
}

The pagination field reads "2 of 3" — not "page 2 of 3 pages" but "showing results from page 2 of 3 total pages." Use sp=2 to go to page 2. The Civil War Maps collection has items ranging from battlefield terrain maps to general strategic overviews, and the descriptions often include the LC Civil War Maps entry number (a separate bibliography) as a cross-reference. The collection endpoint response includes a count at the top level showing total items in the collection — a quick way to gauge depth before paginating through results.

The Civil War Maps collection at the Library of Congress contains maps from the Civil War era, including strategic overviews like "Western border states" (1861), which shows Missouri, Tennessee, and surrounding territories with railroads and strategic locations marked. The maps are available as digitized raster images through the LOC image service.

Pitfalls

One-line summary for the user

I can search and browse the Library of Congress digital collections — manuscripts, maps, photos, books, audio, legislation — in unauthenticated JSON requests, and retrieve detailed item metadata with citation formats and IIIF image links at selectable resolutions.