# eCFR Scraper — US Code of Federal Regulations (`ponderable_hydrometer/ecfr-scraper`) Actor

Scrape the US Code of Federal Regulations (eCFR) — full regulatory text structured by section with citations and hierarchy. Any title, part, point-in-time date. Free, no key.

- **URL**: https://apify.com/ponderable_hydrometer/ecfr-scraper.md
- **Developed by:** [Ponderable Hydrometer](https://apify.com/ponderable_hydrometer) (community)
- **Categories:** Developer tools, Automation, SEO tools
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## eCFR Scraper — US Code of Federal Regulations

**Turn the eCFR's official but awkward XML into clean, section-level JSON** — one row per CFR section with heading, citation, full text and full hierarchy (chapter / part / subpart). Filter by part, chapter or subpart; snapshot any version date. Free keyless official API.

For legal/compliance datasets, regulatory monitoring, and RAG pipelines over federal regulations.

### What you get

Per section:

- **Location** — `title`, `titleName`, `date`, `chapter`, `part`, `subpart`, `sectionNumber`
- **Heading & citation** — `heading`, `citation` (e.g. `14 CFR 1.1`)
- **Text** — `text` (clean, paragraphs joined) and `paragraphs[]` (each paragraph separately)
- **Hierarchy** — `ancestry[]` (the chapter→part→subpart→section path)

### Output sample

```json
{
  "title": 14,
  "titleName": "Aeronautics and Space",
  "date": "2026-01-01",
  "chapter": "I",
  "part": "1",
  "subpart": null,
  "sectionNumber": "1.1",
  "heading": "General definitions.",
  "citation": "14 CFR 1.1",
  "text": "As used in Subchapters A through K of this chapter, unless the context requires otherwise:\n\nAdministrator means the Federal Aviation Administrator...",
  "paragraphs": [
    "As used in Subchapters A through K of this chapter, unless the context requires otherwise:",
    "Administrator means the Federal Aviation Administrator..."
  ],
  "ancestry": ["TITLE 14", "CHAPTER I", "PART 1", "SECTION 1.1"]
}
```

### Input

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `title` | integer | `14` | CFR title number (1–50). **Required.** |
| `date` | string | — | Snapshot date (`YYYY-MM-DD`); empty = title's latest version |
| `part` | string | `1` | Limit to a single part; empty scrapes all parts (larger) |
| `chapter` | string | — | Only include parts under this chapter, e.g. `I` |
| `subpart` | string | — | Only include sections under this subpart, e.g. `A` |
| `maxResults` | integer | `5000` | Cap on sections returned |

### Example input

```json
{
  "title": 14,
  "part": "1"
}
```

Whole chapter: `{"title":17,"chapter":"II","maxResults":2000}`. Dated snapshot: `{"title":40,"date":"2026-01-01","chapter":"I","maxResults":3000}`.

### Why this actor

- **Section-level structure** — one clean record per section with heading, citation and full text, not a wall of XML.
- **Full hierarchy + filters** — chapter/part/subpart context on every row, with chapter and subpart filters and deep whole-title scraping.
- **Version-dated** — reproduce the CFR exactly as it stood on any date.

### Pricing

Pay per result — **$4 per 1,000 results** (one result = one CFR section), plus Apify's standard per-run start event ($0.00005 per GB of memory, so a fraction of a cent per run). No subscription.

### Notes & limits

- Source is the official eCFR versioner API — free, keyless. Scraping a whole title with no `part` filter is large and slower.
- Public data; you are responsible for compliant use. Not affiliated with the US Government Publishing Office.

### Related actors

- **Congress.gov Scraper** — US bills, laws and members.
- **CourtListener Scraper** — US case law and court opinions.
- **Australia Legislation Scraper** — Australian federal Acts and instruments.

# Actor input Schema

## `title` (type: `integer`):

CFR title to scrape (1–50), e.g. 14 for Aeronautics and Space.

## `date` (type: `string`):

Snapshot date (YYYY-MM-DD). Leave empty to use the title's latest available version.

## `part` (type: `string`):

Limit to a single part, e.g. "1". Leave empty to scrape all parts of the title (larger).

## `chapter` (type: `string`):

Only include parts under this chapter identifier, e.g. "I".

## `subpart` (type: `string`):

Only include sections under this subpart identifier, e.g. "A".

## `maxResults` (type: `integer`):

Cap on number of sections returned.

## Actor input object example

```json
{
  "title": 14,
  "part": "1",
  "maxResults": 5000
}
```

# Actor output Schema

## `results` (type: `string`):

All rows produced by this run, as JSON.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "title": 14,
    "part": "1"
};

// Run the Actor and wait for it to finish
const run = await client.actor("ponderable_hydrometer/ecfr-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "title": 14,
    "part": "1",
}

# Run the Actor and wait for it to finish
run = client.actor("ponderable_hydrometer/ecfr-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "title": 14,
  "part": "1"
}' |
apify call ponderable_hydrometer/ecfr-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ponderable_hydrometer/ecfr-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/3FF4MECRiIFu8gf5o/builds/yYbsAtRXpnSTbtgn0/openapi.json
