# eCFR scraper - search federal regulations, get section text (`retrainmap/ecfr-regulations`) Actor

eCFR scraper on the official API: search the Electronic Code of Federal Regulations by keyword, CFR title, part or section; one row per hit - hierarchy, heading, citation, version dates, score, snippet, link - optionally the section's full text as plain text. Public domain. $5 per 1,000 rows.

- **URL**: https://apify.com/retrainmap/ecfr-regulations.md
- **Developed by:** [RetrainMap Team](https://apify.com/retrainmap) (community)
- **Categories:**
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 records

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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## eCFR scraper - search federal regulations, get section text

**Returns:** one row per eCFR search hit: hierarchy (title, chapter, part, subpart, section), heading, citation, version dates, relevance score, snippet and ecfr.gov link — optionally the section's full text as plain text.
**Input:** `{ "query": "training providers", "title": 20, "part": "680", "fetch_full_text": false, "max_records": 100 }` — a `query` or a `title` is required; the rest optional.
**Price:** $5.00 per 1,000 rows ($0.005 per hit row) plus $0.10 per run. Pay per event; no subscription.

One row per hit from the Electronic Code of Federal Regulations' public search API,
optionally with the section's current full text. Search by keyword, CFR title, part or
section; get the hierarchy (title, chapter, subchapter, part, subpart, section), heading,
citation, the date the current version took effect, relevance score, snippet and the
ecfr.gov link — normalised, one flat row per hit. With `fetch_full_text` on, each section's
text is fetched from the versioner API and written as plain text (trimmed to 20,000
characters).

**The default input (query "training providers", title 20, 50 rows, no full text)
succeeds within 5 minutes and returns rows** — Apify auto-tests it daily.

### Data source and status

| | |
|---|---|
| Publisher | Office of the Federal Register (National Archives) and the U.S. Government Publishing Office — https://www.ecfr.gov/ |
| API | https://www.ecfr.gov/developers/documentation/api/v1 — public, no key. Search: `/api/search/v1/results`; title dates: `/api/versioner/v1/titles.json`; section text: `/api/versioner/v1/full/{date}/title-{N}.xml?part=&section=` |
| What this Actor reads | One titles request, then search pages of 100 (`query`, `hierarchy[title]`, `hierarchy[part]`, `hierarchy[section]`, and by default `date` = the title's `up_to_date_as_of`, so only regulations in force are returned), then — only when `fetch_full_text` is on — one XML request per section, dated the same way; at most one request per second |
| Refresh cadence | The eCFR is updated **daily** (each title's `up_to_date_as_of` and `latest_amended_on` are written to every row and to the run summary); it is an editorial compilation, not the official legal edition (the annual CFR and the Federal Register are). The Actor reads live on every run; `fetched_at` is the fetch time |
| Copyright | Works of the United States Government are not subject to copyright in the U.S. (17 U.S.C. §105). The data are public; please cite the eCFR as the source |
| Known caveats | The search API refuses to page past 10,000 results (narrow the query); `score` and `snippet` are search-relevance artefacts and are null for hierarchy-only searches without a query; without `current_only` the index also returns superseded and removed section versions (`ends_on` set, `current` false — 21 of the 50 default hits on 2026-09-04) which have no current full text; a cross-title search is dated the oldest `up_to_date_as_of` among titles (usually yesterday); full text is fetched for hits of type `Section` only (appendices and parts get `full_text_note`); `subchapter`, `subject_group` and `appendix` are empty wherever the CFR has none |

Honesty note: the rows are the API's own fields with the search markup stripped and the
XML reduced to plain text — nothing is inferred, summarised or classified by this Actor,
and a run stops with an error rather than guess when the API's shape changes.

Identification: the requests carry a product-token User-Agent and the operator's
contact address in the standard `From:` header (RFC 9110 §10.1.2).

### Input

| Field | Type | Meaning |
|---|---|---|
| `query` | string | Optional full-text query (phrases in double quotes). Empty = every section of the given title/part in CFR order |
| `title` | integer 1–50 | Optional CFR title (20 = Employees' Benefits, 29 = Labor, 34 = Education). Required with `part`/`section` |
| `part` | string | Optional part, e.g. `680` |
| `section` | string | Optional section, e.g. `680.410` (its part is used when `part` is empty) |
| `current_only` | boolean | Default true: only regulations in force (the search is dated the title's `up_to_date_as_of`). False = the whole index including superseded versions |
| `fetch_full_text` | boolean | Default false. One extra request per section hit |
| `max_records` | integer | Default 100, at most 10,000 |
| `request_interval_ms` | integer | Default 1000 (floor 250) |
| `contact_email` | string | Sent in the `From:` header |

At least a `query` or a `title` is required.

Example — the full text of every section of 20 CFR part 680 subpart D (eligible training providers):

```json
{ "title": 20, "part": "680", "query": "eligible training provider", "fetch_full_text": true, "max_records": 40 }
```

### Output (dataset row)

`citation` (e.g. `20 CFR 680.410`), `title`, `title_name`, `chapter`, `subchapter`, `part`,
`subpart`, `subject_group`, `section`, `appendix`, `type` (Section / Appendix …), `heading`,
`hierarchy` (identifiers), `headings` (names), `starts_on` (current version effective date),
`ends_on`, `current`, `change_types`, `removed`, `reserved`, `title_latest_amended_on`,
`title_up_to_date_as_of`, `score`, `snippet`, `section_url`, `full_text`, `full_text_chars`
(untrimmed length), `full_text_truncated`, `full_text_as_of`, `full_text_note`,
`fetched_at`, `source`.

A run summary (filters, the date the search was run as of, the search's own hit count,
pages, requests, per-title dates, whether the paging cap or the pay-per-event budget
stopped the run) is stored as `RUN_SUMMARY` in the run's key-value store.

### Pricing (pay per event)

| Event | Price |
|---|---|
| `run-start` — once per run | $0.10 |
| `record` — per row written (with or without full text) | $0.005 |

The default 50-row search costs $0.35; 1,000 hits cost $5.10. Rows stop when your run's
maximum charge is reached; the run summary says so.

### Operator

Steelyard Ventures LLC (RetrainMap) — info@steelyardclinical.com. Not affiliated with the
Office of the Federal Register or GPO. The Actor writes only to its own dataset and
key-value store; it stores no credentials and sends nothing else.

# Actor input Schema

## `query` (type: `string`):

Optional full-text query (eCFR search syntax; phrases in double quotes). Empty = every section in the given title/part, in CFR order.

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

Optional CFR title 1-50 (e.g. 20 = Employees' Benefits, 29 = Labor, 34 = Education). Required when part or section is given.

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

Optional part number within the title, e.g. 680.

## `section` (type: `string`):

Optional section number, e.g. 680.410 (the part is taken from it when part is empty).

## `current_only` (type: `boolean`):

On (default): search the eCFR as of the title's up-to-date date, so only sections in force today are returned. Off: search the whole index, which also returns superseded and removed section versions (ends\_on set, current=false) that have no current full text.

## `fetch_full_text` (type: `boolean`):

When on, the current full text of every section hit (up to max\_records) is fetched from the versioner API and written to full\_text as plain text, trimmed to 20,000 characters. One extra request per section, so 100 sections take about 2 minutes at the default interval.

## `max_records` (type: `integer`):

Stop after this many hits have been written. The search API refuses to page past 10,000 results.

## `request_interval_ms` (type: `integer`):

Politeness delay towards ecfr.gov. Each search request returns up to 100 hits; each full-text request returns one section. The floor is 250 ms.

## `contact_email` (type: `string`):

Sent in the standard From: request header so the data owner can reach the operator (RFC 9110 s10.1.2).

## Actor input object example

```json
{
  "query": "training providers",
  "title": 20,
  "current_only": true,
  "fetch_full_text": false,
  "max_records": 100,
  "request_interval_ms": 1000,
  "contact_email": "info@steelyardclinical.com"
}
```

# Actor output Schema

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

Every search hit as one row: title, chapter, part, subpart, section, heading, citation, version dates, score, snippet, link and (optionally) the section's full text.

## `results_csv` (type: `string`):

The same rows as a CSV file.

# 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 = {
    "query": "training providers",
    "title": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("retrainmap/ecfr-regulations").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 = {
    "query": "training providers",
    "title": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("retrainmap/ecfr-regulations").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 '{
  "query": "training providers",
  "title": 20
}' |
apify call retrainmap/ecfr-regulations --silent --output-dataset

```

## MCP server setup

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

```

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/yTDcgt49rniVWOwAC/builds/wiL7LmdLxqlXKfm7V/openapi.json
