> ## Documentation Index
> Fetch the complete documentation index at: https://vaquill.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Map a compliance requirement to the governing law

> Take a plain-language obligation, search the relevant regulatory corpora, and return the governing sections grouped by jurisdiction with citations and official source links

**What this gets you:** turn a plain-English obligation into every governing statute, regulation, and agency rule that actually applies to it, across federal and state law, each one sourced and citable - the core building block of a compliance or RegTech product.

Start from a plain-language obligation like "breach notification timelines" and
end with the governing sections: federal regulations, agency guidance, and the
relevant state rules, each with its citation and a link to the official source.
This is the backbone of a RegTech or compliance-mapping feature.

**Endpoints used:** `POST /us/statutes/search`, `GET /us/statutes/section/{actId}/body`, `GET /us/statutes/coverage` (free, to discover which corpora a jurisdiction has).

<Info>
  Vaquill AI returns the authoritative regulatory text and links back to the official
  government source. It supports building a compliance map, it does not render a
  compliance determination. Pair it with review by qualified counsel.
</Info>

## The flow

<Steps>
  <Step title="Pick the corpora that govern the obligation">
    A regulatory obligation usually lives across several corpora: `CFR` (federal
    regulations), `FEDERAL_REGISTER` (agency rules), `AGENCY_GUIDANCE` (rulings and
    notices), and `REGULATION` (state administrative rules, paired with a `state`).
  </Step>

  <Step title="Search each corpus for the obligation">
    Run `POST /us/statutes/search` once per corpus, using the same plain-language
    query, and filter each corpus with what that corpus actually carries:
    `agency` / `documentType` / `publishedFrom` / `publishedTo` on
    `FEDERAL_REGISTER`, `source` on `AGENCY_GUIDANCE`. Add
    `"excludeRepealed": true` so a rule the publisher has already killed cannot
    enter the map as an obligation.
  </Step>

  <Step title="Pull the text and group the results">
    Fetch each section's full text with `GET /us/statutes/section/{actId}/body`, then
    group by `corpusType` and jurisdiction so the map reads by source of authority.
  </Step>

  <Step title="Present with citations and official links">
    Show each section with its `citation` and the official government URL so a
    reviewer can open the primary source.
  </Step>
</Steps>

## Step 1: search across the regulatory corpora

<CodeGroup>
  ```bash cURL theme={"theme":"github-dark"}
  # Federal regulations (CFR)
  curl -X POST https://api.vaquill.ai/api/v1/us/statutes/search \
    -H "Authorization: Bearer vq_key_..." \
    -H "Content-Type: application/json" \
    -d '{"query": "data breach notification timeline", "corpusType": "CFR", "limit": 5}'

  # Federal Register agency rules. Filter, or you are ranking one query against
  # every rule every agency has published.
  curl -X POST https://api.vaquill.ai/api/v1/us/statutes/search \
    -H "Authorization: Bearer vq_key_..." \
    -H "Content-Type: application/json" \
    -d '{"query": "data breach notification timeline", "corpusType": "FEDERAL_REGISTER", "agency": "federal-trade-commission", "documentType": "final", "publishedFrom": "2020-01-01", "limit": 5}'

  # Agency guidance
  curl -X POST https://api.vaquill.ai/api/v1/us/statutes/search \
    -H "Authorization: Bearer vq_key_..." \
    -H "Content-Type: application/json" \
    -d '{"query": "data breach notification timeline", "corpusType": "AGENCY_GUIDANCE", "limit": 5}'

  # A specific state's administrative regulations (e.g. Washington)
  curl -X POST https://api.vaquill.ai/api/v1/us/statutes/search \
    -H "Authorization: Bearer vq_key_..." \
    -H "Content-Type: application/json" \
    -d '{"query": "data breach notification timeline", "corpusType": "REGULATION", "state": "wa", "limit": 5}'
  ```

  ```python Python theme={"theme":"github-dark"}
  import requests

  BASE = "https://api.vaquill.ai/api/v1/us"
  HEADERS = {"Authorization": "Bearer vq_key_..."}


  def search(query, corpus_type, state=None, limit=5, **filters):
      body = {"query": query, "corpusType": corpus_type, "limit": limit}
      if state:
          body["state"] = state
      # agency / documentType / publishedFrom / publishedTo for FEDERAL_REGISTER,
      # source for AGENCY_GUIDANCE, excludeRepealed anywhere.
      body.update(filters)
      resp = requests.post(f"{BASE}/statutes/search", headers=HEADERS, json=body)
      resp.raise_for_status()
      return resp.json()["results"]
  ```

  ```javascript JavaScript theme={"theme":"github-dark"}
  const BASE = "https://api.vaquill.ai/api/v1/us";

  async function search(query, corpusType, { state, limit = 5, ...filters } = {}) {
    // filters: agency / documentType / publishedFrom / publishedTo for
    // FEDERAL_REGISTER, source for AGENCY_GUIDANCE, excludeRepealed anywhere.
    const body = { query, corpusType, limit, ...filters };
    if (state) body.state = state;
    const resp = await fetch(`${BASE}/statutes/search`, {
      method: "POST",
      headers: {
        Authorization: "Bearer vq_key_...",
        "Content-Type": "application/json",
      },
      body: JSON.stringify(body),
    });
    if (!resp.ok) throw new Error(`search failed: ${resp.status}`);
    return (await resp.json()).results;
  }
  ```
</CodeGroup>

<Tip>
  Not sure which corpora a state has? Call `GET /us/statutes/coverage` and read the
  jurisdiction's `corpora` keys, then pass one as `corpusType`. State regulations
  (`REGULATION`) are ingested for a subset of states, so check before you scope to
  one.
</Tip>

## Narrowing the Federal Register sweep

`FEDERAL_REGISTER` is the noisiest corpus on this list, because it holds every
rule and every proposal every agency has published.
An unfiltered sweep ranks your obligation against all of it.
Four filters cut it down, and a compliance map usually wants all four.

| Filter | What it does |
| - | - |
| `documentType` | `final` for a rule in force, `proposed` for an NPRM, `presidential` for a Presidential Document |
| `agency` | Federal Register agency slug, or a list of them |
| `publishedFrom` | Only documents published on or after this date (`YYYY-MM-DD`) |
| `publishedTo` | Only documents published on or before this date |

```json theme={"theme":"github-dark"}
{
  "query": "emissions standards for power plants",
  "corpusType": "FEDERAL_REGISTER",
  "agency": "environmental-protection-agency",
  "documentType": "final",
  "publishedFrom": "2024-01-01",
  "publishedTo": "2024-12-31",
  "limit": 5
}
```

For a compliance map, `documentType: "final"` is usually the right default.
A proposed rule is not yet an obligation, and folding the two into one map is how a draft requirement ends up presented as law.
Run a second `proposed` pass when you want the pipeline of what is coming, and label it as such.

<Tip>
  Agency slugs come back on the results themselves. Ask for `agencySlugs` in
  `fields`, or read it off a broad sweep, and use what you find to scope the
  follow-up query. `publishedFrom` is the PUBLICATION date, which is not the same
  as `yearFrom`: that one filters the version year of a section.
</Tip>

<Note>
  `agency`, `documentType`, `publishedFrom` and `publishedTo` apply to
  `FEDERAL_REGISTER` (`agency` also applies to `EXECUTIVE_ACTION`). Other corpora
  carry no agency or publication date, so combining these with them returns
  nothing.
</Note>

## Narrowing to one named source

`AGENCY_GUIDANCE` is not one body of guidance, it is a registry: SSA rulings,
IRS notices/procedures/rulings, DOJ & FTC Merger Guidelines, the DOJ Antitrust
Leniency Policy, Copyright Office Circulars, the DOJ Justice Manual, the USCIS
Policy Manual, USPTO MPEP/TMEP, CFTC Staff Letters, FinCEN rulings and
guidance, Federal Reserve/OCC/FDIC banking guidance, DFARS PGI, and NLRB
memoranda all live under the same `corpusType`. `FEDERAL_RULES` and `CFR`
similarly fold in several sets (the Federal Rules of Procedure plus Supreme
Court Rules; FAR and DFARS within CFR Title 48).

If you already know an obligation is, say, a CFTC swaps-clearing question or
a BSA/AML question, skip the broader sweep and add `source` to go straight to
that one registry entry instead of ranking it against everything else in the
corpus:

```json theme={"theme":"github-dark"}
{
  "query": "digital asset margin collateral",
  "corpusType": "AGENCY_GUIDANCE",
  "source": "cftc_staff_letter",
  "limit": 5
}
```

Every result already carries its own `source`, so a hit from a broad sweep
tells you which registry entry to scope a follow-up query to. See
[Filtering to one named source](/docs/api-guide/concepts/corpus-types#filtering-to-one-named-source)
for the full list of `source` values and which corpus each belongs to; an
unrecognized value is rejected with `422` rather than silently matching
nothing.

## Step 2 and 3: collect, fetch text, and group

```python Python theme={"theme":"github-dark"}
import requests
from collections import defaultdict

BASE = "https://api.vaquill.ai/api/v1/us"
HEADERS = {"Authorization": "Bearer vq_key_..."}


def fetch_body(act_id):
    resp = requests.get(f"{BASE}/statutes/section/{act_id}/body", headers=HEADERS)
    resp.raise_for_status()
    data = resp.json()
    return data.get("plain") if data.get("available") else None


# best_source_url() is the shared helper from Text Formats and Source URLs,
# linked below. Copy it once; do not re-derive the field order per recipe.


def map_requirement(obligation, states=None, limit=5):
    # Federal regulatory corpora, plus one REGULATION pass per requested state.
    plan = [
        ("CFR", None, {}),
        # Rules in force, recent enough to still govern. Add "agency" once you
        # know which regulator owns the obligation.
        ("FEDERAL_REGISTER", None, {"documentType": "final", "publishedFrom": "2020-01-01"}),
        ("AGENCY_GUIDANCE", None, {}),
    ]
    for st in states or []:
        plan.append(("REGULATION", st, {}))

    grouped = defaultdict(list)
    for corpus_type, state, filters in plan:
        # excludeRepealed drops what the publisher's own status says is dead.
        # It does not promise the remainder is good law: read goodLawStatus on
        # each survivor to tell "checked" from "unchecked".
        for r in search(
            obligation,
            corpus_type,
            state=state,
            limit=limit,
            excludeRepealed=True,
            **filters,
        ):
            text = fetch_body(r["actId"])
            if not text:
                continue  # skip sections with no available text
            # Group key: corpusType, plus the state for state-scoped corpora.
            jurisdiction = (r.get("state") or "federal").upper()
            key = f"{corpus_type} / {jurisdiction}"
            grouped[key].append(
                {
                    "citation": r.get("citation") or r["actId"],
                    "title": r.get("title"),
                    "sourceUrl": best_source_url(r),
                    "text": text,
                }
            )
    return grouped


def render(obligation, grouped):
    print(f"Governing law for: {obligation}\n")
    for group, sections in grouped.items():
        print(f"== {group} ==")
        for s in sections:
            print(f"  {s['citation']} - {s['title']}")
            print(f"    Source: {s['sourceUrl']}")
        print()


if __name__ == "__main__":
    obligation = "data breach notification timeline"
    result = map_requirement(obligation, states=["wa", "md"])
    render(obligation, result)
```

A grouped result reads by source of authority:

```text theme={"theme":"github-dark"}
Governing law for: data breach notification timeline

== CFR / FEDERAL ==
  16 CFR § 318.5 - Notification to the Federal Trade Commission
    Source: https://www.ecfr.gov/...

== AGENCY_GUIDANCE / FEDERAL ==
  ... - Agency guidance on breach reporting
    Source: https://www.govinfo.gov/...

== REGULATION / WA ==
  WAC ... - Notice to affected consumers
    Source: https://app.leg.wa.gov/...
```

## Notes for a production compliance map

<AccordionGroup>
  <Accordion title="Feed the grouped sections into an LLM for a summary">
    Once you have the grouped, cited text, you can pass it to an LLM in your stack
    to produce a plain-language summary of each obligation, one that cites each
    section and links its official source. Use the strict grounding pattern in
    [Ground an LLM answer in statutes](/docs/api-guide/recipes/rag-grounding) so the
    summary quotes only the retrieved regulatory text.
  </Accordion>

  <Accordion title="Scope state regulations deliberately">
    `REGULATION` is state-scoped: always pair it with a two-letter `state` code.
    Coverage spans a subset of states and expands weekly, so drive the state list
    from `GET /us/statutes/coverage` rather than assuming every state is present.
  </Accordion>

  <Accordion title="Keep the official link on every row">
    Each result carries several optional source URL fields and any may be null.
    Use the canonical preference order in
    [Text Formats and Source URLs](/docs/api-guide/concepts/formats#picking-the-best-available-format)
    rather than writing your own, so a reviewer opening the link from your
    compliance map lands on the same official page as everywhere else in your
    product.
  </Accordion>
</AccordionGroup>

## Related

<CardGroup cols={2}>
  <Card title="Ground an LLM answer (RAG)" href="/docs/api-guide/recipes/rag-grounding">
    Summarize the mapped obligations with strict, cited grounding.
  </Card>

  <Card title="Resolve a citation" href="/docs/api-guide/recipes/citation-lookup">
    Verify a specific regulation citation and pull its text.
  </Card>

  <Card title="Grounding LLMs" href="/docs/api-guide/grounding-llms">
    The principles behind grounding legal AI on primary sources.
  </Card>

  <Card title="API Coverage" href="/docs/api-guide/coverage">
    Which corpora and jurisdictions are ingested, with live counts.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.