No logo available for Regulations.gov to DuckDB connector icon

Load Regulations.gov data to DuckDB

Build a Regulations.gov to DuckDB pipeline with your coding agent. One prompt scaffolds it with the dltHub AI harness, plus the Regulations.gov API base URL, auth, endpoints, and incremental loading.

SourceRegulations.govRegulations.gov API DocumentationDestinationDuckDBIn-process analytical database. The default local destination for dlt pipelines.

Regulations.gov is a federal government portal providing programmatic access to regulatory dockets, documents, and public comments. Everything needed to build a working Regulations.gov → DuckDB pipeline is on this page: the API's base URL, authentication, endpoints, pagination and incremental field — plus a prompt that hands the whole job to your coding agent.


Build your Regulations.gov to DuckDB pipeline

Paste this prompt into Claude, Codex, or Cursor. The agent does the rest.

Prompt
Run uvx dlthub-init@latest to build a pipeline from Regulations.gov to DuckDB and run it on dltHub

That scaffolds a dltHub workspace and installs the dltHub AI harness — the project rules, the secrets-management skill, and the dlt MCP server your agent needs to work safely. From there it reads the Regulations.gov API, proposes the endpoints to load, then writes, runs and validates the pipeline while you review rather than type. Credentials are inspected through MCP tools, so your agent never reads secrets.toml itself. How the LLM-native workflow works →

Prefer to write it yourself? Every fact the agent uses is below.


Regulations.gov API at a glance

Base URLhttps://api.regulations.gov
Example endpointGET v4/documents
Records found atdata
Authenticationall requests require an API key sent in the X-Api-Key header — sent in the X-Api-Key header
PaginationPage-number via page[number], page size via page[size] (default 25, max 250). The API uses page-number-based pagination. Developers are limited to a maximum of 20 pages per query, effectively capping bulk retrieval to 5,000 items (20 pages * 250 items) per request set. Pagination must be handled by incrementing the page[number] parameter and applying filters (e.g., lastModifiedDate) between query sets to retrieve all data.
Incremental fieldlastModifiedDate
Record idid
API referencehttps://open.gsa.gov/api/regulationsgov/

These values come from the Regulations.gov API reference — the authoritative source if anything here looks out of date.


How do I authenticate with the Regulations.gov API?

Requests require an API key to be passed in the X-Api-Key HTTP header. A DEMO_KEY is available for testing purposes, but production use requires registering for a unique key via api.data.gov.

1. Get your credentials

To obtain API credentials for the Regulations.gov REST API, visit the official GSA API portal at https://open.gsa.gov/api/regulationsgov/ and follow the registration link (provided via api.data.gov) to sign up for an API key. Once registered, you will receive a unique 40-character API key string which must be included in the 'X-Api-Key' HTTP header of your requests. For demonstration purposes only, the API accepts the string 'DEMO_KEY'.

2. Add them to .dlt/secrets.toml

[sources.regulations_gov_source] api_key = "YOUR_REGS_GOV_API_KEY"

dlt reads this file automatically at runtime. With the harness, the setup-secrets skill prompts you for the values and never handles the raw credential in chat. For production, see setting up credentials with dlt.


What Regulations.gov data can I load into DuckDB?

These are the Regulations.gov endpoints dlt can load into DuckDB:

ResourceEndpointMethodData selectorDescription
documents/v4/documentsGETdataSearch and list documents
document/v4/documents/{documentId}GETGet details of a single document
comments/v4/commentsGETdataSearch and list comments
comment/v4/comments/{commentId}GETGet details of a single comment
dockets/v4/docketsGETdataSearch and list dockets
docket/v4/dockets/{docketId}GETGet details of a single docket

How do I load only new Regulations.gov records?

Regulations.gov exposes lastModifiedDate on v4/documents, so dlt can request only the records that changed since the last run. Set it as the cursor_path and dlt tracks the high-water mark for you between runs.

{"name": "documents", "endpoint": { "path": "v4/documents", "data_selector": "data", "incremental": {"cursor_path": "lastModifiedDate", "initial_value": "2024-01-01T00:00:00Z"}, }}

On the first run dlt loads everything from initial_value; on every run after that it requests only what changed and appends with write_disposition="merge" if you set a primary key. See incremental loading.


What does the generated Regulations.gov pipeline look like?

A standard dlt REST API pipeline — the same code you would write by hand, loading /v4/documents and /v4/comments from the Regulations.gov API into DuckDB:

import dlt from dlt.sources.rest_api import RESTAPIConfig, rest_api_resources @dlt.source def regulations_gov_source(api_key=dlt.secrets.value): config: RESTAPIConfig = { "client": { "base_url": "https://api.regulations.gov", "auth": {"type": "api_key", "api_key": api_key, "name": "X-Api-Key", "location": "header"}, }, "resources": [ {"name": "documents", "endpoint": {"path": "v4/documents", "data_selector": "data"}}, {"name": "comments", "endpoint": {"path": "v4/comments", "data_selector": "data"}} ], } yield from rest_api_resources(config) def load_regulations_gov_to_duckdb() -> None: pipeline = dlt.pipeline( pipeline_name="regulations_gov_pipeline", destination="duckdb", dataset_name="regulations_gov_data", ) load_info = pipeline.run(regulations_gov_source()) print(load_info) if __name__ == "__main__": load_regulations_gov_to_duckdb()

Run it with python regulations_gov_pipeline.py. The agent iterates on this until it loads cleanly — you review and approve, rather than write it from scratch.


How do I query Regulations.gov data in DuckDB?

dlt creates one table per resource. Query the loaded data with Python or SQL — or ask your agent to, through the MCP server's execute_sql_query tool.

Python (pandas DataFrame):

import dlt data = dlt.pipeline("regulations_gov_pipeline").dataset() df = data.documents.df() print(df.head())

SQL:

SELECT * FROM regulations_gov_data.documents LIMIT 10;

See querying your data with dataset and exploring it in marimo notebooks.


How do I deploy the Regulations.gov to DuckDB pipeline in production?

The pipeline runs locally, which is ideal for prototyping and one-off analysis. When you need it on a schedule, monitored on every load, and shared with your team, deploy the same dlt code on the dltHub platform — no infrastructure to maintain. The prompt above already ends with "run it on dltHub", so your agent can take it there directly.

  • Deploy & schedule — run the pipeline as a managed job with automatic retries.
  • Monitor — observable job queues, alerting, and load metrics for every run.
  • Transform — promote raw Regulations.gov loads into governed, documented models.
  • Visualize & share — explore data in notebooks and publish live dashboards instead of static screenshots.

Book a demo →


What other destinations can I load Regulations.gov data to?

dlt loads into any of these — only the destination argument changes:

DestinationExample value
PostgreSQL"postgres"
BigQuery"bigquery"
Snowflake"snowflake"
Redshift"redshift"
Databricks"databricks"
Filesystem (S3, GCS, Azure)"filesystem"

Set dlt.pipeline(destination="snowflake") and add credentials in .dlt/secrets.toml. On the dltHub platform the same pipeline runs against a managed Iceberg lakehouse. See the full destinations list.


Next steps

Was this page helpful?

Community Hub

Need more dlt context for Regulations.gov to DuckDB?

Request dlt skills, commands, AGENT.md files, and AI-native context.