# Library of Congress API

> Library of Congress returns digital collection and historic newspaper search results, available as a workflow and API.

Library of Congress (LOC) searches digital collections by keywords, format, and date range; provide a query, with other inputs optional. Search historic newspapers returns newspaper pages matching text, with optional state and issue-year filters; provide a query.

- Page: https://fous.com/workflows/library-of-congress
- Handle: `@library-of-congress`
- Category: [Education](https://fous.com/workflows/category/education)
- Source website: https://loc.gov
- Last verified: Sep 29, 2026
- Fous is not affiliated with Library of Congress.

## Methods

### Search collections

Operation `search_collections`, version 1. 1 credit per call.

Search Library of Congress digital collections by keywords, format, and date range. Results follow Library search relevance; rights notes may be unavailable for some records.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `page` | integer | no | `2` | Page of search results, for example 2. |
| `query` | string | yes | `"Civil War maps"` | Keywords to search, for example Civil War photographs. |
| `format` | string | no | `"maps"` | Material format, for example maps; any searches all formats. |
| `end_year` | integer | no | `1865` | Latest year, for example 1865. |
| `start_year` | integer | no | `1861` | Earliest year, for example 1861. |
| `max_results` | integer | no | `2` | Results per page, for example 20. |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "query"
  ],
  "properties": {
    "page": {
      "type": "integer",
      "default": 1,
      "minimum": 1,
      "description": "Page of search results, for example 2.",
      "x-fous-developer": true,
      "examples": [
        2,
        1
      ]
    },
    "query": {
      "type": "string",
      "minLength": 1,
      "description": "Keywords to search, for example Civil War photographs.",
      "examples": [
        "Civil War maps",
        "Civil War photographs",
        "Abraham Lincoln"
      ]
    },
    "format": {
      "enum": [
        "any",
        "photos",
        "maps",
        "manuscripts",
        "newspapers",
        "audio",
        "films",
        "books"
      ],
      "type": "string",
      "default": "any",
      "description": "Material format, for example maps; any searches all formats.",
      "examples": [
        "maps",
        "photos",
        "audio"
      ]
    },
    "end_year": {
      "type": "integer",
      "maximum": 9999,
      "minimum": 1,
      "description": "Latest year, for example 1865.",
      "examples": [
        1865
      ]
    },
    "start_year": {
      "type": "integer",
      "maximum": 9999,
      "minimum": 1,
      "description": "Earliest year, for example 1861.",
      "examples": [
        1861
      ]
    },
    "max_results": {
      "type": "integer",
      "default": 20,
      "maximum": 100,
      "minimum": 1,
      "description": "Results per page, for example 20.",
      "x-fous-developer": true,
      "examples": [
        2,
        3
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "page": 2,
      "query": "Civil War maps",
      "format": "maps",
      "max_results": 2
    },
    {
      "page": 1,
      "query": "Civil War photographs",
      "format": "photos",
      "end_year": 1865,
      "start_year": 1861,
      "max_results": 3
    },
    {
      "query": "Abraham Lincoln",
      "format": "audio",
      "max_results": 2
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `results` | array |  | Matching collections and digital items, in Library search order. |
| `results[].date` | string or null | `"1910"` |  |
| `results[].title` | string or null | `"The American Civil War--maps"` |  |
| `results[].format` | string or null | `"Map"` |  |
| `results[].summary` | string or null | `"Title from cover. Issued to accompany Formby, John. The American Civil War, a concise history of its causes, progress, ` |  |
| `results[].item_link` | string | `"https://www.loc.gov/item/2009581125/"` |  |
| `results[].rights_and_usage` | string or null | `"The content of the Library of Congress Geography and Map Division digitized collections is free to use and reuse unless` |  |
| `results[].thumbnail_image_link` | string or null | `"https://tile.loc.gov/storage-services/service/gmd/gmd370m/g3701m/g3701sm/gcw0066000/ca000001.gif"` |  |
| `results[].creators_or_contributors` | string or null | `"formby, john"` |  |

**Example input**

```json
{
  "page": 2,
  "query": "Civil War maps",
  "format": "maps",
  "max_results": 2
}
```

**Example output**

```json
{
  "results": [
    {
      "date": "1910",
      "title": "The American Civil War--maps",
      "format": "Map",
      "summary": "Title from cover. Issued to accompany Formby, John. The American Civil War, a concise history of its causes, progress, and results (New York, Scribners, 1910). Includes maps of the principal campaigns…",
      "item_link": "https://www.loc.gov/item/2009581125/",
      "rights_and_usage": "The content of the Library of Congress Geography and Map Division digitized collections is free to use and reuse unless a Rights Advisory statement is present that indicates otherwise. Credit Line: Li…",
      "thumbnail_image_link": "https://tile.loc.gov/storage-services/service/gmd/gmd370m/g3701m/g3701sm/gcw0066000/ca000001.gif",
      "creators_or_contributors": "formby, john"
    },
    {
      "date": "1910",
      "title": "The American Civil War--maps",
      "format": "Map",
      "summary": "Title from cover. Issued to accompany Formby, John. The American Civil War, a concise history of its causes, progress, and results (London, John Murray, 1910). Includes maps of the principal campaigns…",
      "item_link": "https://www.loc.gov/item/2009581126/",
      "rights_and_usage": "The content of the Library of Congress Geography and Map Division digitized collections is free to use and reuse unless a Rights Advisory statement is present that indicates otherwise. Credit Line: Li…",
      "thumbnail_image_link": "https://tile.loc.gov/storage-services/service/gmd/gmd370m/g3701m/g3701sm/gcw0065000/ca000001.gif",
      "creators_or_contributors": "formby, john"
    }
  ]
}
```

### Search historic newspapers

Operation `search_historic_newspapers`, version 1. 1 credit per call.

Search historic U.S. newspaper pages 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.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `page` | integer | no | `2` | Result page to retrieve, for example 2. |
| `query` | string | yes | `"suffrage"` | Words to find in newspaper text, for example Titanic. |
| `state` | string | no | `"New York"` | US state name to limit results, for example Montana. Leave blank for all states. |
| `end_year` | integer | no | `1920` | Latest issue year, for example 1913. |
| `start_year` | integer | no | `1915` | Earliest issue year, for example 1912. |
| `max_results` | integer | no | `2` | Number of page results to return, for example 20. |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "query"
  ],
  "properties": {
    "page": {
      "type": "integer",
      "default": 1,
      "minimum": 1,
      "description": "Result page to retrieve, for example 2.",
      "x-fous-developer": true,
      "examples": [
        2,
        1
      ]
    },
    "query": {
      "type": "string",
      "minLength": 1,
      "description": "Words to find in newspaper text, for example Titanic.",
      "examples": [
        "suffrage",
        "Titanic",
        "zxqnotawordtitanic123321"
      ]
    },
    "state": {
      "type": "string",
      "default": "",
      "description": "US state name to limit results, for example Montana. Leave blank for all states.",
      "examples": [
        "New York",
        "Montana"
      ]
    },
    "end_year": {
      "type": "integer",
      "maximum": 2100,
      "minimum": 1600,
      "description": "Latest issue year, for example 1913.",
      "examples": [
        1920,
        1912
      ]
    },
    "start_year": {
      "type": "integer",
      "maximum": 2100,
      "minimum": 1600,
      "description": "Earliest issue year, for example 1912.",
      "examples": [
        1915,
        1912
      ]
    },
    "max_results": {
      "type": "integer",
      "default": 20,
      "maximum": 100,
      "minimum": 1,
      "description": "Number of page results to return, for example 20.",
      "x-fous-developer": true,
      "examples": [
        2,
        3
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "page": 2,
      "query": "suffrage",
      "state": "New York",
      "end_year": 1920,
      "start_year": 1915,
      "max_results": 2
    },
    {
      "page": 1,
      "query": "Titanic",
      "state": "Montana",
      "end_year": 1912,
      "start_year": 1912,
      "max_results": 3
    },
    {
      "query": "zxqnotawordtitanic123321",
      "max_results": 2
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `newspaper_pages` | array |  | Historic newspaper pages in search relevance order. |
| `newspaper_pages[].city` | string or null | `"New York"` | City of publication. |
| `newspaper_pages[].state` | string or null | `"New York"` | State of publication. |
| `newspaper_pages[].snippet` | string or null | `"... men and women of the suffrage states are practically unanimous on these points. Must Rrcogrcize Fact \"With tlie ov` | Short excerpt of newspaper text around the search words. |
| `newspaper_pages[].page_link` | string | `"https://www.loc.gov/resource/sn83030214/1918-01-09/ed-1/?sp=7&q=suffrage"` | Newspaper page link. |
| `newspaper_pages[].issue_date` | string or null | `"1918-01-09"` | Issue date (YYYY-MM-DD). |
| `newspaper_pages[].page_number` | integer or null | `7` | Printed issue page number when known. |
| `newspaper_pages[].newspaper_title` | string or null | `"New-york tribune"` | Newspaper name. |
| `newspaper_pages[].page_image_link` | string or null | `"https://tile.loc.gov/image-services/iiif/service:ndnp:dlc:batch_dlc_brown_ver02:data:sn83030214:00206532221:1918010901:` | Page image link. |

**Example input**

```json
{
  "page": 2,
  "query": "suffrage",
  "state": "New York",
  "end_year": 1920,
  "start_year": 1915,
  "max_results": 2
}
```

**Example output**

```json
{
  "newspaper_pages": [
    {
      "city": "New York",
      "state": "New York",
      "snippet": "... men and women of the suffrage states are practically unanimous on these points. Must Rrcogrcize Fact \"With tlie ovcrwhelming testimony on tlie one hand that woman suffrage in practice is a…",
      "page_link": "https://www.loc.gov/resource/sn83030214/1918-01-09/ed-1/?sp=7&q=suffrage",
      "issue_date": "1918-01-09",
      "page_number": 7,
      "newspaper_title": "New-york tribune",
      "page_image_link": "https://tile.loc.gov/image-services/iiif/service:ndnp:dlc:batch_dlc_brown_ver02:data:sn83030214:00206532221:1918010901:0187/full/pct:12.5/0/default.jpg"
    },
    {
      "city": "New York",
      "state": "New York",
      "snippet": "Worn SuffrageOver There and Over Here By MARIE DE MONTALVO Editor The New Citizen SUFFRAGE is still an issueexcept for Canada an allAmerica issue In the United States ten…",
      "page_link": "https://www.loc.gov/resource/sn83030214/1918-11-03/ed-2/?sp=32&q=suffrage",
      "issue_date": "1918-11-03",
      "page_number": 32,
      "newspaper_title": "New-york tribune",
      "page_image_link": "https://tile.loc.gov/image-services/iiif/service:ndnp:dlc:batch_dlc_allen_ver02:data:sn83030214:00206532324:1918110302:0066/full/pct:12.5/0/default.jpg"
    }
  ]
}
```

## Quick start

Call the API with a Fous API key (`FOUS_API_KEY`). To create one, turn on Developer mode in Fous Studio, then open Keys & connections → API keys (https://app.fous.com/keys).

```bash
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
: "${FOUS_API_KEY:?Set FOUS_API_KEY before running this example}"

curl 'https://api.fous.com/v1/query' \
  --fail-with-body --silent --show-error --max-time 120 \
  -H "Authorization: Bearer $FOUS_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "api": "@library-of-congress",
  "visibility": "public",
  "operation": "search_collections",
  "version": 1,
  "input": {
    "page": 2,
    "query": "Civil War maps",
    "format": "maps",
    "max_results": 2
  },
  "response": {
    "format": "json"
  }
}'
```

```python
# Save as fous.py and run with python3 fous.py. No packages needed.
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
import json
import os
import urllib.error
import urllib.request

api_key = os.environ.get("FOUS_API_KEY")
if not api_key:
    raise RuntimeError("Set FOUS_API_KEY before running this example")

body = json.loads("{\n  \"api\": \"@library-of-congress\",\n  \"visibility\": \"public\",\n  \"operation\": \"search_collections\",\n  \"version\": 1,\n  \"input\": {\n    \"page\": 2,\n    \"query\": \"Civil War maps\",\n    \"format\": \"maps\",\n    \"max_results\": 2\n  },\n  \"response\": {\n    \"format\": \"json\"\n  }\n}")
request = urllib.request.Request(
    "https://api.fous.com/v1/query",
    data=json.dumps(body).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    method="POST",
)
try:
    with urllib.request.urlopen(request, timeout=120) as response:
        result = json.load(response)
except urllib.error.HTTPError as error:
    raise RuntimeError(f"HTTP {error.code}: {error.read().decode('utf-8', errors='replace')}") from error
if result.get("success") is False:
    raise RuntimeError(result.get("error", {}).get("message", "Request failed"))
print(json.dumps(result["data"]["output"], indent=2))
```

```typescript
// Save as fous.mts and run with npx tsx fous.mts.
// First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
const apiKey = process.env.FOUS_API_KEY;
if (!apiKey) throw new Error("Set FOUS_API_KEY before running this example");

const response = await fetch("https://api.fous.com/v1/query", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  signal: AbortSignal.timeout(120_000),
  body: JSON.stringify({
  "api": "@library-of-congress",
  "visibility": "public",
  "operation": "search_collections",
  "version": 1,
  "input": {
    "page": 2,
    "query": "Civil War maps",
    "format": "maps",
    "max_results": 2
  },
  "response": {
    "format": "json"
  }
}),
});
type ApiResult = { success: boolean; data?: { output: unknown }; error?: { message: string } };
const result: ApiResult = await response.json();
if (!response.ok || result.success === false) {
  throw new Error(result.error?.message ?? `HTTP ${response.status}`);
}
if (!result.data) throw new Error("Missing API response data");
console.log(result.data.output);
```

Or describe the data in plain language: send `{"api":"@library-of-congress","prompt":"Describe the data you need, with every detail"}` to the same URL. Fous fills in the input, runs the method that fits and returns only the fields you asked for; `data.route.calls[].request` is the exact call it made. Routing is free; the run costs the same.

## Use cases

- Find collection items about a topic, period, or format
- Review historic newspaper coverage within a date range
- Locate newspaper pages published in a particular state
- Gather item titles, dates, formats, and summaries for research
- Collect newspaper snippets and page images for historical analysis

## FAQ

### Is Fous affiliated with Library of Congress?

No. Fous is not affiliated with Library of Congress. This workflow reads the public loc.gov website and returns its data.

### How much does it cost?

Each run costs 1 credit. With pay-as-you-go, a credit costs 1¢; monthly plans cost less per credit.

### Do I need a Library of Congress account?

No. You only need a Fous account.

### How current is the data?

Fous gets the data from loc.gov when you run it; repeating the same request within a day may return the saved result. Fous checks this workflow automatically; it last passed a check on Sep 29, 2026.

### What digital collections match a topic or date range?

Search collections finds matching digital collections and items using keywords and optional format and date filters.

### Which historic newspaper pages contain certain words?

Search historic newspapers finds text matches, with optional state and issue-year filters. Newspaper OCR may contain transcription errors.

## Related

- [Open Library API](https://fous.com/workflows/open-library.md): Open Library returns book search results, catalog details, and author works; availability reflects listed editions, not current loan availability, and catalog details may be missing.
- [National Archives API](https://fous.com/workflows/national-archives.md): Search the public U.S. National Archives Catalog for historical records.
- [The New York Times API](https://fous.com/workflows/the-new-york-times.md): The New York Times provides current section headlines and summaries, keyword-matched public listings with dates, authors, sections and links, and Best Sellers lists for the latest issue or dates within a week.
- [OverDrive API](https://fous.com/workflows/overdrive.md): Find ebooks and audiobooks at public libraries.
- [Congress.gov API](https://fous.com/workflows/congress-gov.md): Congress.gov returns federal bills and resolutions matching topic, Congress, status, or chamber, and provides an individual bill’s status, summary, titles, actions, and related bills; summaries may be unavailable.
- [The Wall Street Journal API](https://fous.com/workflows/the-wall-street-journal.md): The Wall Street Journal provides news-section headlines and searchable public article headlines and summaries, with available story details and publication dates for search filtering.
- [AP News API](https://fous.com/workflows/ap-news.md): AP News provides reporting, up to 50 public-page headlines, searchable articles visible in its search, and full text when accessible.
- [NPR API](https://fous.com/workflows/npr.md): NPR returns displayed section headlines, searchable articles with summaries and publication details, and available article text; date-filtered searches may miss older stories edited much later.
- [All Education workflows](https://fous.com/workflows/category/education)
