Discover/Loc API
live

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.

This API takes change requests — .
Endpoints
1
Updated
1mo ago

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.

Try it
Page number for pagination. Must be a positive integer.
State name to filter maps by (e.g. 'california', 'massachusetts'). Combined with location for more precise filtering.
City name to filter maps by (e.g. 'san francisco', 'boston', 'new york'). Used as a location facet filter.
Number of results per page. Must be between 1 and 150.
api.parse.bot/scraper/5bef1205-8db9-4d82-a034-aef5571a537e/<endpoint>
Ready to send
Fill in the parameters and hit sign in to send to see live response data here.
Call it over HTTPgrab a free API key at signup
curl -X GET 'https://api.parse.bot/scraper/5bef1205-8db9-4d82-a034-aef5571a537e/list_sanborn_sheets' \
  -H 'X-API-Key: $PARSE_API_KEY'
Python SDK · recommended

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()
All endpoints · 1 totalmissing one? ·

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.

Input
ParamTypeDescription
pageintegerPage number for pagination. Must be a positive integer.
statestringState name to filter maps by (e.g. 'california', 'massachusetts'). Combined with location for more precise filtering.
locationstringCity name to filter maps by (e.g. 'san francisco', 'boston', 'new york'). Used as a location facet filter.
per_pageintegerNumber of results per page. Must be between 1 and 150.
Response
{
  "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.

Reliability & maintenance

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?+
It's built not to. Every endpoint is health-checked on a schedule with automated test probes. When the source site changes and a check fails, the API is automatically queued for repair and re-verified — that's the self-healing layer. Each API page shows when its endpoints were last verified. And because marketplace APIs are shared, any fix reaches everyone using it.
Is this an official API from the source site?+
No — Parse APIs are independent, managed REST wrappers over publicly available data. That is the point: where a site has no official API (or only a limited one), Parse gives you a maintained, monitored endpoint for that data and keeps it working as the site changes — so you get a stable contract over a source that never promised one.
Can I fix or extend this API myself if I need a new endpoint or field?+
Yes — and you don't have to wait on us. This API was generated by the Parse agent, which stays attached. Describe the change in plain English ("add an endpoint that returns reviews", "fix the price field") in the revise box on the API page or via the revise_api MCP tool, and the agent rebuilds it against the live site in minutes. Contributing the change back to the public API is free.
What happens if I call an endpoint that has an issue?+
Errors are machine-readable: a bad call returns a clean status with the list of available endpoints and a repair hint, so an agent (or you) can recover or trigger a fix instead of failing silently. Confirmed failures feed the automatic repair queue.
Common use cases
  • Retrieve all Sanborn map sheets for a specific city to support historical urban research.
  • Download high-resolution IIIF images using image_url for 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 location filter results with GIS tools.
  • Check date and number_of_files fields 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.
Pricing & limitsSee full pricing →
TierPriceCredits/monthRate limit
Free$0/mo1005 req/min
Hobby$30/mo1,00020 req/min
Developer$100/mo5,000100 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.

Frequently asked questions
Does the Library of Congress have an official developer API for its collections?+
Yes. The LOC provides a public JSON API documented at https://libraryofcongress.github.io/data-exploration/. This Parse API targets the Sanborn Maps collection specifically and returns pre-structured sheet metadata with resolved IIIF image URLs, saving the work of navigating the general LOC API response format.
What does `list_sanborn_sheets` return for each map sheet?+
Each object in the 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?+
Coverage reflects what the Library of Congress has digitized. Major cities in many states are well-represented, but smaller towns or early survey years may have few or no sheets. The 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?+
Not currently. The API supports filtering by 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?+
The API returns metadata and a resolved 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.
Page content last updated . Spec covers 1 endpoint from loc.gov.
Related APIs in Government PublicSee all →
api.nasa.gov API
Access NASA's suite of open data APIs — including the Astronomy Picture of the Day, Near Earth Object tracking, DONKI space weather events, EPIC Earth imagery, Mars weather, the NASA Image and Video Library, the Exoplanet Archive, and EONET natural events.
developer.company-information.service.gov.uk API
Search for UK registered companies and retrieve detailed information including company profiles, officer names, and their dates of birth. Access comprehensive corporate records directly from the official Companies House register to verify business details and identify key personnel.
sec.gov API
Search for publicly traded companies and instantly access their SEC filings with details like filing type, date, description, and accession numbers. Find the regulatory documents you need to research company financial information and compliance records.
usaspending.gov API
usaspending.gov API
companieshouse.gov.uk API
Search for UK companies and officers, then access detailed information including company profiles, filing history, charges, and officers with significant control. Get comprehensive corporate records and appointment details all in one place.
mars.nasa.gov API
Explore real-time images, weather data, and location tracking from NASA's Perseverance and Curiosity rovers on Mars, while discovering mission details, rock sample findings, and the latest news from the Mars Exploration Program. Access rover photos, scientific discoveries, and multimedia content to stay updated on current Mars exploration activities.
find-and-update.company-information.service.gov.uk API
Search and access detailed information about UK companies registered at Companies House, including company profiles, filing histories, officers, and financial charges. Filter companies by name, status, type, SIC code, and more.
capitol.texas.gov API
Search and monitor Texas Legislature bills, track their progress through legislative stages, and retrieve detailed action histories. Look up legislator contact information, district details, committee assignments, and full committee membership rosters.