{
  "openapi": "3.0.1",
  "info": {
    "title": "eCFR: Search US Federal Regulations, Parts & Amendments",
    "description": "Search the Code of Federal Regulations by phrase, title, part or agency and get sections as rows: citation, headings, matched excerpt, effective window and change types. Further modes list the parts and sections inside a title, amendment dates per section, and the title and agency dictionaries.",
    "version": "0.1",
    "x-build-id": "sy2Bz872YDnwETGB3"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/yadroo~ecfr-regulations/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-yadroo-ecfr-regulations",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/yadroo~ecfr-regulations/runs": {
      "post": {
        "operationId": "runs-sync-yadroo-ecfr-regulations",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/yadroo~ecfr-regulations/run-sync": {
      "post": {
        "operationId": "run-sync-yadroo-ecfr-regulations",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "mode": {
            "title": "What to return",
            "enum": [
              "search",
              "structure",
              "versions",
              "counts",
              "titles",
              "agencies"
            ],
            "type": "string",
            "description": "`search` queries the codified text of the whole Code of Federal Regulations and writes one row per matching section or appendix, by default only the version in force. `structure` walks one title's tree and writes a row per node, so you can see which parts and sections exist. `versions` reads the amendment log of a title or part: one row per section version with its amendment and issue date, which is the cheap way to answer 'what changed in 40 CFR 141 this year'. `counts` turns a phrase into a map of the code — how many hits sit in each title, chapter and part — without paying per section. `titles` and `agencies` write the two dictionaries the filters below accept; run them once and keep the values.",
            "default": "search"
          },
          "query": {
            "title": "Search phrase",
            "type": "string",
            "description": "Words to look for in the regulation text, used by `search` and `counts`. Several words are matched as separate terms and ranked; put double quotes around a phrase (`\"design controls\"`) to keep the words together and in order. Empty in mode `search` returns the sections the other filters allow, which is useful with *Changed after* to list recent amendments without a topic."
          },
          "order": {
            "title": "Sort rows by",
            "enum": [
              "relevance",
              "newest",
              "oldest",
              "hierarchy"
            ],
            "type": "string",
            "description": "Applies to mode `search`. `hierarchy` reads like the printed code and is the one to pick when you export a part. `newest` pairs with *Changed after* for a change feed. Modes `structure` and `versions` always follow the code's own order, `titles` and `agencies` their own numbering and name.",
            "default": "relevance"
          },
          "asOfDate": {
            "title": "Text as it stood on",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "YYYY-MM-DD. Empty = the newest day the source has processed, which is usually one to three days behind today; the actor reads that day from the title dictionary and reports it in the run log and in `asOfDate`. A date the source has not reached yet is refused by the API, so the actor clamps a future date down to the newest available day instead of failing. An older date gives you the code as it read that day — the way to quote a rule as of a contract or audit date."
          },
          "includeHistory": {
            "title": "Include superseded versions",
            "type": "boolean",
            "description": "Off (the default) every row is the version in force on *Text as it stood on*, so one section appears once. On, the search also returns the older and the not-yet-effective versions of a section: several rows per section, each with its own `startsOn`, `endsOn` and `inForce`. Turn it on to diff a section over time, keep it off for compliance lists.",
            "default": false
          },
          "changedAfter": {
            "title": "Changed after",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "YYYY-MM-DD. Keep only sections whose text was touched after this day. This is the field that turns the actor into a regulation watch: the source records every amendment, so a weekly task with a seven-day window writes exactly the sections that moved."
          },
          "changedBefore": {
            "title": "Changed before",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "YYYY-MM-DD, the other end of the change window. Use both ends to pull one quarter of amendments."
          },
          "lookbackDays": {
            "title": "Changed in the last N days",
            "minimum": 1,
            "maximum": 3650,
            "type": "integer",
            "description": "Relative change window for scheduled runs, counted in UTC from the day the run starts: 7 = the past week, 90 = the past quarter. Ignored when *Changed after* is set. In mode `versions` it filters by issue date instead, which is the same calendar the source publishes amendments on."
          },
          "cfrTitle": {
            "title": "CFR title",
            "minimum": 1,
            "maximum": 50,
            "type": "integer",
            "description": "One of the 50 titles of the code: 21 = food and drugs, 40 = environment, 12 = banks, 17 = commodity and securities exchanges, 26 = internal revenue, 29 = labor, 49 = transportation. Optional in `search` and `counts` (empty = all titles), required by `structure` and `versions`, ignored by `titles` and `agencies`. Run mode `titles` for the full list with names."
          },
          "cfrChapter": {
            "title": "CFR chapter",
            "type": "string",
            "description": "Roman numeral as the code prints it (`I`, `III`, `XII`). A chapter belongs to one agency, so this is the way to keep only that agency's part of a title. Needs *CFR title*."
          },
          "cfrPart": {
            "title": "CFR part",
            "type": "string",
            "description": "Part number inside the title, e.g. `820` in title 21 or `141` in title 40. In `search` it narrows the hits, in `structure` it exports that part's subparts and sections, in `versions` it limits the amendment log to that part. Needs *CFR title*."
          },
          "cfrSubpart": {
            "title": "CFR subpart",
            "type": "string",
            "description": "Subpart letter inside the part (`A`, `C`, `UUUUU`). Needs *CFR part*."
          },
          "cfrSection": {
            "title": "CFR section",
            "type": "string",
            "description": "A single section, written the way the citation does: `820.30`, `141.23`. Combined with *CFR title* this answers 'what happened to this section' — in `versions` you get its amendment history, in `search` with *Include superseded versions* every version of its text. A section that does not exist on the chosen date yields one row with `found: false` rather than an empty run."
          },
          "agencySlugs": {
            "title": "Agencies",
            "type": "array",
            "description": "Agency slugs for mode `search`, combined with OR, e.g. `environmental-protection-agency`, `food-and-drug-administration`, `securities-and-exchange-commission`. The source maps each agency to the chapters it owns, so this filter is broader than a title filter and narrower than a full-code search. Mode `agencies` writes the whole dictionary with the chapters per slug; an unknown slug is reported with the closest match instead of a silent empty run.",
            "items": {
              "type": "string"
            }
          },
          "nodeTypes": {
            "title": "Levels to write as rows",
            "type": "array",
            "description": "Mode `structure` only: which levels of the title tree become dataset rows. `[\"part\"]` gives a compact table of contents, `[\"part\", \"section\"]` the parts with their sections, which is also what an empty list means. Every row carries `nodeType`, its parent path and `sizeBytes`, the size of that node's text in the source's own XML, which tells you how long a part is before you read it.",
            "items": {
              "type": "string",
              "enum": [
                "chapter",
                "subchapter",
                "part",
                "subpart",
                "subjectGroup",
                "section",
                "appendix"
              ],
              "enumTitles": [
                "Chapter",
                "Subchapter",
                "Part",
                "Subpart",
                "Subject group",
                "Section",
                "Appendix"
              ]
            }
          },
          "substantiveOnly": {
            "title": "Only substantive amendments",
            "type": "boolean",
            "description": "Mode `versions` only. The source marks each amendment as substantive or not; the non-substantive ones are cross-reference and nomenclature fixes. On, only the amendments that changed the obligation are written.",
            "default": false
          },
          "includeRemoved": {
            "title": "Include removed sections",
            "type": "boolean",
            "description": "Mode `versions` only. On, sections that an amendment deleted are written too, with `removed: true` — worth having when you track a renumbering such as a part being rewritten.",
            "default": false
          },
          "onlyNew": {
            "title": "Only rows not seen before",
            "type": "boolean",
            "description": "Remember every row key (citation plus version start date, or amendment date in mode `versions`) in this actor's key-value store and write only keys that were not there on the previous run. The first run writes what it finds, later runs write what appeared since — a watch list on a schedule that does not pay twice for the same section.",
            "default": false
          },
          "maxItems": {
            "title": "Max rows",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Stop after this many rows. The search index serves at most 10 000 hits per query, so narrow the title, part or change window to go deeper; `structure` and `versions` of a large title can produce tens of thousands of nodes, which is what this cap is for.",
            "default": 50
          },
          "fields": {
            "title": "Output fields",
            "type": "array",
            "description": "Keep only these fields, in this order, e.g. [\"citation\", \"sectionName\", \"startsOn\", \"url\"]. Empty = every field the mode fills.",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}