Loc APIloc.gov ↗
Query the LOC Sanborn Fire Insurance Maps collection by city and state. Returns sheet metadata, dates, item IDs, and high-resolution IIIF image URLs.
What is the Loc API?
The Library of Congress Sanborn Maps API exposes 1 endpoint — list_sanborn_sheets — that returns paginated metadata for historical Sanborn Fire Insurance Map sheets from the LOC collection. Each result includes a title, date, item ID, detail URL, resource URL, file count, and the highest-resolution IIIF image URL available for that sheet. Filters for city and state let you narrow results to a specific geographic area.
curl -X GET 'https://api.parse.bot/scraper/5bef1205-8db9-4d82-a034-aef5571a537e/list_sanborn_sheets' \ -H 'X-API-Key: $PARSE_API_KEY'
Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace loc-gov-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
"""
Library of Congress Sanborn Maps API Client
Get your API key from: https://parse.bot/settings
"""
import os
import requests
from typing import Optional
class ParseClient:
"""Client for interacting with the Library of Congress Sanborn Maps API through Parse."""
def __init__(self, api_key: Optional[str] = None):
"""Initialize the Parse client with API credentials.
Args:
api_key: API key for Parse. If not provided, reads from PARSE_API_KEY env var.
"""
self.base_url = "https://api.parse.bot"
self.scraper_id = "5bef1205-8db9-4d82-a034-aef5571a537e"
self.api_key = api_key or os.getenv("PARSE_API_KEY")
if not self.api_key:
raise ValueError(
"API key not provided. Set PARSE_API_KEY environment variable or pass api_key parameter."
)
def _call(self, endpoint: str, method: str = "POST", **params) -> dict:
"""Make an API call to the Parse scraper.
Args:
endpoint: The endpoint name to call.
method: HTTP method to use (GET or POST).
**params: Parameters to pass to the endpoint.
Returns:
The JSON response from the API.
Raises:
requests.RequestException: If the API call fails.
"""
url = f"{self.base_url}/scraper/{self.scraper_id}/{endpoint}"
headers = {"X-API-Key": self.api_key, "Content-Type": "application/json"}
if method.upper() == "GET":
response = requests.get(url, headers=headers, params=params)
elif method.upper() == "POST":
response = requests.post(url, headers=headers, json=params)
else:
raise ValueError(f"Unsupported HTTP method: {method}")
response.raise_for_status()
return response.json()
def list_sanborn_sheets(
self,
location: str = "san francisco",
state: str = "california",
page: int = 1,
per_page: int = 100,
) -> dict:
"""List Sanborn fire insurance map sheets filtered by location.
Args:
location: City name to filter maps by (e.g. 'san francisco', 'boston', 'new york').
state: State name to filter maps by (e.g. 'california', 'massachusetts').
page: Page number for pagination (default: 1).
per_page: Number of results per page, between 1 and 150 (default: 100).
Returns:
Dictionary containing sheets, total count, and pagination info.
"""
return self._call(
"list_sanborn_sheets",
method="GET",
location=location,
state=state,
page=page,
per_page=per_page,
)
def main():
"""Demonstrate practical usage of the Sanborn Maps API."""
# Initialize the client
client = ParseClient()
print("=" * 80)
print("Library of Congress Sanborn Maps API - Practical Usage Example")
print("=" * 80)
# 1. Search for Sanborn maps in San Francisco, California
print("\n📍 Fetching Sanborn Fire Insurance Maps for San Francisco, California...")
response = client.list_sanborn_sheets(
location="san francisco", state="california", page=1, per_page=10
)
print(f"\nFound {response['total']} total maps for San Francisco, CA")
print(f"Showing page {response['page']} of {response['pages']} (10 results per page)")
# 2. Process and display the map sheets
print("\n" + "-" * 80)
print("Map Sheets Found:")
print("-" * 80)
sheets = response.get("sheets", [])
for idx, sheet in enumerate(sheets, 1):
print(f"\n{idx}. {sheet['title']}")
print(f" Date: {sheet['date']}")
print(f" Item ID: {sheet['item_id']}")
print(f" Files: {sheet['number_of_files']}")
print(f" Library of Congress URL: {sheet['item_url']}")
print(f" High-Resolution Image: {sheet['image_url'][:80]}...")
print(f" Resource URL: {sheet['resource_url']}")
# 3. Demonstrate pagination - fetch next page if available
if response["page"] < response["pages"]:
print("\n" + "=" * 80)
print("📄 Fetching next page of results...")
next_response = client.list_sanborn_sheets(
location="san francisco", state="california", page=2, per_page=10
)
print(f"\nPage 2 contains {len(next_response['sheets'])} more map sheets")
if next_response["sheets"]:
first_sheet = next_response["sheets"][0]
print(f"First map on page 2: {first_sheet['title']}")
print(f"Date: {first_sheet['date']}")
# 4. Search for maps in a different city
print("\n" + "=" * 80)
print("🔍 Searching for Sanborn maps in Boston, Massachusetts...")
boston_response = client.list_sanborn_sheets(
location="boston", state="massachusetts", page=1, per_page=5
)
print(f"Found {boston_response['total']} total maps for Boston, MA")
print(f"Showing {len(boston_response['sheets'])} results:")
for sheet in boston_response["sheets"]:
print(f" • {sheet['title']} ({sheet['date']})")
print("\n" + "=" * 80)
print("✅ Example completed successfully!")
print("=" * 80)
if __name__ == "__main__":
main()List Sanborn fire insurance map sheets filtered by location. Returns paginated results from the Library of Congress Sanborn Maps collection with metadata and highest-resolution IIIF image URLs for each sheet.
| Param | Type | Description |
|---|---|---|
| page | integer | Page number for pagination. Must be a positive integer. |
| state | string | State name to filter maps by (e.g. 'california', 'massachusetts'). Combined with location for more precise filtering. |
| location | string | City name to filter maps by (e.g. 'san francisco', 'boston', 'new york'). Used as a location facet filter. |
| per_page | integer | Number of results per page. Must be between 1 and 150. |
{
"type": "object",
"fields": {
"page": "integer current page number",
"pages": "integer total number of pages",
"total": "integer total number of matching sheets",
"sheets": "array of sheet objects with title, date, item_id, item_url, image_url, resource_url, and number_of_files",
"per_page": "integer results per page"
},
"sample": {
"page": 1,
"pages": 1,
"total": 8,
"sheets": [
{
"date": "1887-09",
"title": "Sanborn Fire Insurance Map from San Francisco, San Francisco County, California.",
"item_id": "sanborn00813_001",
"item_url": "https://www.loc.gov/item/sanborn00813_001/",
"image_url": "https://tile.loc.gov/image-services/iiif/service:gmd:gmd436m:g4364m:g4364sm:g4364sm_g008131887:00813_1887-0001/full/full/0/default.jpg",
"resource_url": "https://www.loc.gov/resource/g4364sm.g4364sm_g008131887/",
"number_of_files": 1
}
],
"per_page": 100
}
}About the Loc API
What the API Returns
The list_sanborn_sheets endpoint queries the Library of Congress Sanborn Fire Insurance Maps collection and returns structured metadata for each matching map sheet. Each object in the sheets array contains: title (the sheet's descriptive title), date (publication or survey date), item_id (the LOC identifier), item_url (link to the LOC catalog record), image_url (highest-resolution IIIF image available), resource_url (the resource endpoint for the item), and number_of_files (how many image files exist for that sheet).
Filtering and Pagination
Results can be filtered by location (city name, e.g. 'boston' or 'new york') and state (e.g. 'massachusetts' or 'california'). Both filters can be combined to narrow to a specific city within a state. The per_page parameter accepts values between 1 and 150, and page controls which result page is returned. The response includes total (total matching sheets), pages (total pages), page (current page), and per_page alongside the sheets array.
Coverage and Data Source
Sanborn Fire Insurance Maps were produced from the 1860s through the mid-20th century, primarily covering urban areas in the United States. The LOC digitized collection holds tens of thousands of sheets across hundreds of cities and towns. Not every city or time period is equally represented — coverage depends on what LOC has digitized and made publicly accessible. The number_of_files field indicates how many image files are associated with a given sheet, which is useful for identifying multi-page or multi-segment entries.
The Loc API is a managed, monitored endpoint for loc.gov — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when loc.gov changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official loc.gov API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Retrieve all Sanborn map sheets for a specific city to support historical urban research.
- Download high-resolution IIIF images using
image_urlfor digitization or archival projects. - Identify building footprints and land use patterns in a historical neighborhood using sheet metadata.
- Build a geocoded index of LOC Sanborn sheets by combining
locationfilter results with GIS tools. - Check
dateandnumber_of_filesfields to find the most complete map coverage for a target city. - Automate discovery of map item IDs (
item_id) to batch-fetch LOC catalog records for historical property research.
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does the Library of Congress have an official developer API for its collections?+
What does `list_sanborn_sheets` return for each map sheet?+
sheets array includes title, date, item_id, item_url, image_url (highest-resolution IIIF image URL), resource_url, and number_of_files. The image_url field resolves to the best available resolution for that sheet, so it can be used directly for download or display.How complete is the geographic coverage across U.S. cities?+
total field in any filtered query shows exactly how many sheets LOC holds for that location. Using state alone (without location) will return all digitized sheets statewide.Can I filter by date range or map scale?+
location (city) and state, with pagination via page and per_page. Date and scale filtering are not exposed as parameters. You can fork this API on Parse and revise it to add date-range filtering against the LOC collection's available facets.Does the API return full map imagery or only metadata?+
image_url pointing to the highest-resolution IIIF image for each sheet. Actual image binary delivery is handled by the LOC IIIF image service at the URL provided — the API does not proxy or return raw image data itself.