Library of Congress APIs
www.loc.gov · Government
Access the Library of Congress digital collections — millions of photographs, manuscripts, maps, newspapers, audio recordings, and more. No API key required.
Authentication
Sample Requests
Search all Library of Congress digital collections.
Hover any highlighted part to learn what it does
curl -X GET "https://www.loc.gov/search?q=civil%20war%20photographs&fo=json"
import requests
params = {
"q": "civil war photographs",
"fo": "json"
}
response = requests.get(
"https://www.loc.gov/search",
params=params,
)
print(response.json())const url = new URL('https://www.loc.gov/search');
url.searchParams.set('q', 'civil war photographs');
url.searchParams.set('fo', 'json');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://www.loc.gov/search")
q := baseURL.Query()
q.Set("q", "civil war photographs")
q.Set("fo", "json")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://www.loc.gov/search")
uri.query = URI.encode_www_form({
"q" => "civil war photographs",
"fo" => "json"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://www.loc.gov/search?" . http_build_query([
"q" => "civil war photographs",
"fo" => "json"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Browse the Chronicling America historical newspapers collection.
Hover any highlighted part to learn what it does
curl -X GET "https://www.loc.gov/collections/chronicling-america?fo=json"
import requests
params = {
"fo": "json"
}
response = requests.get(
"https://www.loc.gov/collections/chronicling-america",
params=params,
)
print(response.json())const url = new URL('https://www.loc.gov/collections/chronicling-america');
url.searchParams.set('fo', 'json');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://www.loc.gov/collections/chronicling-america")
q := baseURL.Query()
q.Set("fo", "json")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://www.loc.gov/collections/chronicling-america")
uri.query = URI.encode_www_form({
"fo" => "json"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://www.loc.gov/collections/chronicling-america?" . http_build_query([
"fo" => "json"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Postman Setup Guide
- No API key needed
- Append ?fo=json to any loc.gov URL to get JSON
- Try GET https://www.loc.gov/search/?q=apollo+moon+landing&fo=json
- Browse collections at https://www.loc.gov/collections/?fo=json
- Chronic America newspapers: https://www.loc.gov/collections/chronicling-america/?fo=json
What can you build with Library of Congress APIs?
Library of Congress APIs is a Government API. Developers commonly use government APIs for:
- surfacing public datasets in citizen-facing apps
- building transparency and civic engagement tools
- accessing legislation, court records, and official data
- powering research and journalism tools
- creating compliance and regulatory monitoring dashboards
No authentication required. This API is open — no signup or key needed. Ideal for quick prototypes and public-facing features. Library of Congress APIs is free to use, making it a low-risk choice to experiment with.
New to APIs? Read our beginner's guide