# eCFR Scraper - Code of Federal Regulations by Date (`s-r/ecfr`) Actor

Get current and historical eCFR section text with its version date, search federal regulations, and list substantive changes between dates with Federal Register document numbers and regulations.gov docket links. For compliance and legal teams.

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

## Pricing

from $1.00 / 1,000 run start fees

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

eCFR Scraper retrieves current and historical US federal regulation text, finds sections by keyword,
and lists substantive changes between two dates. Use a CFR citation to get the consolidated rule
as it stood on a particular day, together with its heading, paragraphs, source note and version date.
Federal Register references can be resolved to document numbers and docket identifiers for connecting
the codified text to the rulemaking record.

### What eCFR Scraper returns

A section record represents one CFR provision on one date. A change record represents one substantive
version identified by the source. The `record_type` field distinguishes these records, while `_type`
provides the corresponding shared regulation record name. Every delivered record includes its citation,
retrieval timestamp, source identifier, position and a dated source URL. These fields let you keep a
repeatable evidence trail when a rule changes later.

This is useful for compliance monitoring, legal research, regulatory inventories and comparison of
historical requirements. A date-specific snapshot answers which consolidated text was available for
that date. The source version list answers when a provision changed. A resolved Federal Register
reference helps you find the document behind a codifying amendment and continue your research in
the associated docket.

### Input

Provide `title` and optionally `part`, `section` or `subpart` for a hierarchy lookup. For example,
`{"title":21,"section":"101.91"}` retrieves the food labeling provision for gluten-free claims.
Section input also accepts `§ 101.91` and `21 CFR 101.91` when the supplied title matches.
Omit the section to collect a part, or omit the part to walk the title. Title numbers range from
1 to 50; reserved titles have no regulation text to return.

Set `date` to a calendar date in `YYYY-MM-DD` format for a historical snapshot. Without it, the
Actor uses the latest available issue date reported for the selected title. That date can be earlier
than today. An unavailable future date is rejected rather than silently replaced with another date.

Use `changesSince` to return the requested snapshot and substantive versions after that starting date,
up to and including `date`. Use `compareDate` when you also want the earlier snapshot in the same
result set. For the real provision above, comparing `2020-08-12` with `2020-10-13` shows the text
before and after the 2020 gluten labeling amendment. The starting boundary is exclusive for changes;
the ending boundary is inclusive.

Use `query` for full-text searching, optionally restricted by title, part, section and agency slugs
in `agencies`. The default `currentOnly=true` searches the latest available material. Set it to false
to include historical result versions. An explicit date always takes precedence. Search and comparison
fields are separate workflows and cannot be combined in a single input.

`includeText` controls delivery of consolidated text and paragraph arrays. `includeFrLinks` controls
resolution of Federal Register citations. Both default to true. Turn both off for a compact search
result set containing headings and plain-text excerpts. `maxItems`, from 1 to 1000, limits all delivered
records combined, including change records and both snapshots when comparing dates.

### Output

Section records include `citation`, `as_of`, `heading`, `text`, `paragraphs`, `version_date`,
`source_note` and `fr_citations`. Search records also include the original query, plain-text excerpt,
source excerpt, relevance score and version validity dates. A null `ends_on` indicates that the search
version remains current in the source. Historical versions keep their own starting date.

Change records include `effective_on`, `issue_date`, `removed`, `amending_document_id`,
`amending_citation`, `docket_id` and `fr_document_candidates`. The document identifier can be joined
to Federal Register document data; a docket identifier can be used to continue to regulations.gov.
The cited Federal Register page may lie inside a document rather than match its first page.

A document number is reported as confirmed only when a unique source-note match supports it.
Multiple plausible documents remain candidates. Missing matches stay null. Older citations, especially
those before 1994, may not have a document in the searchable Federal Register archive. A temporary
link-resolution failure keeps the regulation text and adds a visible warning to the run output.

#### Example output

Input `{"title": 21, "section": "101.91", "changesSince": "2020-01-01"}` returns one section record
followed by the substantive versions after 1 January 2020. This is a trimmed copy of a real response,
so the citation, dates and identifiers below are the ones the source reported:

```json
{
  "data": {
    "items": [
      {
        "record_type": "section",
        "_type": "regulation_section",
        "citation": "21 CFR 101.91",
        "as_of": "2026-11-05",
        "version_date": "2020-10-13",
        "heading": "Gluten-free labeling of food.",
        "text": "(a) Definitions. (1) The term “gluten-containing grain” means any one of the following grains or their crossbred hybrids…",
        "source_note": "[78 FR 47178, Aug. 5, 2013, as amended at 85 FR 49260, Aug. 13, 2020]",
        "fr_citations": [
          { "citation": "78 FR 47178", "publication_date": "2013-08-05", "fr_document_number": "2013-18813" },
          { "citation": "85 FR 49260", "publication_date": "2020-08-13", "fr_document_number": "2020-17088" }
        ],
        "url": "https://www.ecfr.gov/on/2026-11-05/title-21/section-101.91",
        "source": "ecfr",
        "position": 1
      },
      {
        "record_type": "change",
        "_type": "regulation_change",
        "citation": "21 CFR 101.91",
        "effective_on": "2020-08-13",
        "issue_date": "2020-08-13",
        "amending_citation": "85 FR 49260",
        "amending_document_id": "2020-17088",
        "docket_id": "FDA-2014-N-1021",
        "removed": false,
        "position": 2
      }
    ],
    "partial": false,
    "warnings": [],
    "cursor": null
  }
}
```

The full paragraph array, the remaining text of the section and the second change record
(`effective_on` `2020-10-13`) are trimmed here; a run returns all of them.

### Use cases for eCFR Scraper

- **Point-in-time answers.** Ask for the section as it stood on a given date, for example the
  labeling rule as it read the day before an amendment took effect.
- **Change monitoring.** Run the same citation with `changesSince` each week and keep only the rows
  that appeared, so a regulation team sees amendments instead of re-reading the whole part.
- **Rulemaking follow-up.** Take the Federal Register document number from a change record and the
  docket identifier beside it, then continue in the Federal Register or regulations.gov record.
- **Inventory and comparison work.** Walk a part or a whole title with `maxItems` and build a table
  of provisions, version dates and source notes for an audit or a regulatory inventory.
- **Full-text discovery.** Search a phrase such as `gluten-free` inside one title, part or agency
  scope, then pull the matched sections with their citations.
- **Retired provisions.** Rows for withdrawn requirements arrive with `removed` set, so a rule that
  no longer exists is distinguishable from one that never had text.

### How eCFR Scraper compares

Browsing the public eCFR website is free and fine for reading one provision, but it hands you web
pages: no structured rows to keep, and a date picker you drive by hand. Calling its public API
directly means assembling the hierarchy, the change list and the Federal Register join yourself.
The annual printed edition of the Code of Federal Regulations arrives as static documents and lags
the daily consolidation. Other eCFR actors in this Store cover current text or full-text search, and
some also take a date; what this Actor adds is the pair — the consolidated snapshot *and* the list of
substantive versions between two dates, each with a Federal Register document number and a
regulations.gov docket identifier in the same response. If you only need today's wording, the
website is enough. If you need the wording on a past date plus the record of what changed and which
document changed it, that is this Actor.

### Pricing

The Actor counts each delivered section, snapshot, search result or substantive change as one result.
The current pricing panel states the applicable event prices and any run-start charge. A run with
no delivered records has no result charge. Non-paying users are limited to ten delivered records per
run. Paid users can request up to the input maximum. A comparison can deliver more than one record
for a single citation, so choose `maxItems` with that combined total in mind.

Large collections continue automatically in bounded pages. Output and the dataset describe delivered
records rather than attempted downloads. A partial result or unresolved reference is reported in the
run output, so downstream workflows can distinguish complete delivery from a source interruption.

### FAQ

#### Is the latest available date always today?

No. Each title has its own published availability date. The Actor uses that source date for a current
lookup and includes the selected date on the returned section record.

#### Does every substantive version mean the rule text changed?

No. The source can label an amendment announcement as substantive before new wording takes effect.
Announcement cross-references are excluded from the consolidated text. Compare the snapshots when
you need to inspect the actual wording; the change list preserves the source's classification.

#### Are Federal Register matches guaranteed?

No. Source citations without a unique matching document remain unresolved. Date-only matches are
candidates, and the Actor does not turn them into a confirmed amendment identifier.

#### Can I retrieve an entire title?

Yes. Supply its title number and choose a result limit. The Actor walks the available provisions and
continues collection automatically until the requested row limit or the available content is reached.
Review any warnings before treating a collection as complete.

# Actor input Schema

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

CFR title number. Required for hierarchy lookup; optional for full-text search.

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

CFR part number, for example 101. Inferred from section when omitted.

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

Section number, for example 101.91, § 101.91 or 21 CFR 101.91. Requires matching title.

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

Subpart identifier, for example F. Requires part.

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

Point-in-time date in YYYY-MM-DD. Omit for the latest available title issue date.

## `compareDate` (type: `string`):

Earlier YYYY-MM-DD date. Return both snapshots and substantive changes in (compareDate, date].

## `changesSince` (type: `string`):

Earlier YYYY-MM-DD date. Return the requested snapshot and substantive changes in (changesSince, date].

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

Full-text search term. Cannot be combined with comparison fields.

## `agencies` (type: `array`):

Agency slugs for search, for example food-and-drug-administration.

## `currentOnly` (type: `boolean`):

Search at the latest available date; false includes historical search versions. An explicit date takes precedence.

## `includeText` (type: `boolean`):

Include consolidated section text and paragraph arrays. Does not affect change rows.

## `includeFrLinks` (type: `boolean`):

Resolve source-note citations to Federal Register document numbers and docket IDs. Uncertain matches remain candidates.

## `maxItems` (type: `integer`):

Maximum delivered rows across all cursor pages, including snapshots and changes.

## `cursor` (type: `string`):

Signed continuation from the previous response. Keep all other input fields unchanged; expires after 24 hours.

## Actor input object example

```json
{
  "title": 21,
  "section": "101.91",
  "currentOnly": true,
  "includeText": true,
  "includeFrLinks": true,
  "maxItems": 50
}
```

# Actor output Schema

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

Consolidated section snapshots, substantive change rows and full-text search hits with version dates and source-note links.

## `output` (type: `string`):

Status, delivered rows, charges, free-tier status, warnings and the next cursor for this run.

# 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": 21,
    "section": "101.91"
};

// Run the Actor and wait for it to finish
const run = await client.actor("s-r/ecfr").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": 21,
    "section": "101.91",
}

# Run the Actor and wait for it to finish
run = client.actor("s-r/ecfr").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": 21,
  "section": "101.91"
}' |
apify call s-r/ecfr --silent --output-dataset

```

## MCP server setup

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

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/OJGgnzyLRWjVIOeYd/builds/JBMgx0lUOJyfcCAe1/openapi.json
