# loc.gov API (Library of Congress) API reference

> The loc.gov API returns structured JSON or YAML data about Library of Congress collections: items (books, photos, maps, newspapers, manuscripts, audio, video), collections and their metadata. It does not include library catalog records. Investigators use it to search digitized collections. Any…

Source: https://osinttools.io/apis/loc-gov-api/ (Markdown view of an OSINTtools.io page; append `.md` to any page URL for this format).

Compiled by OSINTtools.io editors from the vendor's docs, updated Nov 29, 2026. Listing: https://osinttools.io/tools/loc-gov-api/

- Base URL: https://www.loc.gov
- Authentication: No key needed.
- Free tier: yes
- Pricing: Free
- Rate limits: 20 requests per minute; blocked for 1 hour if exceeded
- Vendor docs: https://www.loc.gov/apis/json-and-yaml/

## Overview

The loc.gov API returns structured JSON or YAML data about Library of Congress collections: items (books, photos, maps, newspapers, manuscripts, audio, video), collections and their metadata. It does not include library catalog records. Investigators use it to search digitized collections.

Any loc.gov page can be requested as data by adding `fo=json`. No key or authentication is needed. Paging past the 100,000th result is not supported; use facets to narrow.

The limit for this API is 20 requests per minute, with a 1 hour block when exceeded; limits can be lower under heavy traffic and 429 or CAPTCHA pages may appear.

## Errors

| Status | Meaning |
| --- | --- |
| 429 | Rate limit exceeded; pause requests |

## Search

### Search everything on loc.gov.

`GET /search/`

- Takes: Name
- Footprint: passive (the target is not contacted)

Covers collection items, legislation, web pages, blog posts and events. Needs q.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `q` | query | string | yes | Keyword search across metadata and full text Example: bridges |
| `fo` | query | string | yes | Response format Example: json One of: json, yaml |
| `fa` | query | string | no | Filters as filter-name:value, multiple separated by a pipe Example: location:ohio |
| `c` | query | integer | no | Results per page Example: 25 |
| `sp` | query | integer | no | Page number, from 1 Example: 1 |
| `sb` | query | string | no | Sort order Example: date One of: date, date_desc, title_s, title_s_desc, shelf_id, shelf_id_desc |
| `at` | query | string | no | Return only selected attributes Example: results,pagination |

Response fields:

- `results[]` (object): Matching records
- `results[].id` (string): URL of the item
- `pagination` (object): Paging information

```bash
curl 'https://www.loc.gov/search/?q=bridges&fo=json'
```

Example response (200):

```json
{
  "results": [
    {
      "id": "https://www.loc.gov/item/00000000/"
    }
  ],
  "pagination": {}
}
```

### Items of one original format, such as photos or maps.

`GET /{format}/`

- Takes: Name
- Footprint: passive (the target is not contacted)

Format slugs include audio, books, film-and-videos, legislation, manuscripts, maps, newspapers, photos, notated-music, web-archives.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `format` | path | string | yes | Format slug Example: photos One of: audio, books, film-and-videos, legislation, manuscripts, maps, newspapers, photos, notated-music, web-archives |
| `q` | query | string | no | Keyword search Example: bridges |
| `fo` | query | string | yes | Response format Example: json One of: json, yaml |
| `fa` | query | string | no | Filters as filter-name:value Example: location:washington d.c. |

Response fields:

- `results[]` (object): Matching records
- `pagination` (object): Paging information

```bash
curl 'https://www.loc.gov/photos/?fo=json'
```

Example response (200):

```json
{
  "results": [
    {
      "id": "https://www.loc.gov/item/00000000/"
    }
  ],
  "pagination": {}
}
```

## Collections

### List all digital collections.

`GET /collections/`

- Footprint: passive (the target is not contacted)

Returns a results list.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `fo` | query | string | yes | Response format Example: json One of: json, yaml |

Response fields:

- `results[]` (object): Collections

```bash
curl 'https://www.loc.gov/collections/?fo=json'
```

Example response (200):

```json
{
  "results": [
    {
      "id": "https://www.loc.gov/collections/civil-war-maps/"
    }
  ]
}
```

### One collection and its items.

`GET /collections/{collection}/`

- Footprint: passive (the target is not contacted)

The collection name is a kebab-case slug such as civil-war-maps.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `collection` | path | string | yes | Collection slug Example: civil-war-maps |
| `fo` | query | string | yes | Response format Example: json One of: json, yaml |
| `q` | query | string | no | Keyword search within the collection Example: river |

Response fields:

- `results[]` (object): Items in the collection

```bash
curl 'https://www.loc.gov/collections/civil-war-maps/?fo=json'
```

Example response (200):

```json
{
  "results": [
    {
      "id": "https://www.loc.gov/item/00000000/"
    }
  ]
}
```

## Items

### Bibliographic information for one item.

`GET /item/{item_id}/`

- Footprint: passive (the target is not contacted)

Use the item ID or the id URL from search results. at can limit to item, resources, cite_this and similar.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `item_id` | path | string | yes | Item ID Example: 00000000 |
| `fo` | query | string | yes | Response format Example: json One of: json, yaml |
| `at` | query | string | no | Return only selected attributes Example: item,resources |

Response fields:

- `item` (object): Bibliographic data
- `resources[]` (object): Digitized resources

```bash
curl 'https://www.loc.gov/item/00000000/?fo=json'
```

Example response (200):

```json
{
  "item": {},
  "resources": []
}
```

### One resource with its context and segments.

`GET /resource/{resource_id}/`

- Footprint: passive (the target is not contacted)

For example one digitized newspaper edition and its pages.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `resource_id` | path | string | yes | Resource ID Example: 00000000 |
| `fo` | query | string | yes | Response format Example: json One of: json, yaml |

Response fields:

- `resource` (object): The resource
- `segments[]` (object): Parts such as pages

```bash
curl 'https://www.loc.gov/resource/00000000/?fo=json'
```

Example response (200):

```json
{
  "resource": {},
  "segments": []
}
```

---

Listings on OSINTtools.io are reviewed by editors and re-verified on a schedule; check pricing and availability on the vendor's site before relying on them, and use OSINT tools only with a lawful basis.
Site index for agents: https://osinttools.io/llms.txt · Full catalog: https://osinttools.io/llms-full.txt · MCP server (Streamable HTTP, no auth): https://osinttools.io/mcp/
