Search laws

Full-text search over statutes, regulations, constitutions, and agency guidance (US federal + all 50 states + DC).

Currency. Results are the law in force TODAY by default. Currency is derived, not stored: a document is current iff (1) it is not marked historical, (2) its effective_date is not in the future (a not-yet-effective amendment is stored but is not yet the law), and (3) no newer version is already in force, and (4) it is not a TOMBSTONE. Set current_only: false to search historical and future-effective versions too; each result carries is_current and is_historical so you can tell them apart. Historical search requires an API key with full historical access.

Filters.

  • states — full state names or USPS abbreviations; federal law is "Federal". Values are validated server-side.
  • collection_types — statute / regulation / constitution / guidance / executive_order / notice.
  • collections — specific codes by id or human-readable name (see /laws/collections). Values are resolved server-side.
  • path_prefix — restrict to a subtree of a code via its ltree path (e.g. "cfr.t21" = all of 21 CFR). Pair it with collections; paths are only unique within a collection.
  • effective_date_from/to, publication_date_from/to — ISO dates, inclusive. Note many state statutes have no source-stated effective date (the field is null and such docs would be excluded by an effective_date range filter).

State surveys. state_counts in the response gives estimated per-state hit counts for the whole query (not just the returned page) — use it to scope the survey, then verify each state with a filtered search.

Pagination: page (1-indexed) and page_size (max 50). Results beyond the first 10,000 cannot be paginated; narrow the query instead.

Body·
required
application/json
  • query
    Type: string
    required

    Full-text query, matched against document text, headings, and citations

  • collection_types
    Type: array string[] enum
    values
    • statute
    • regulation
    • constitution
    • guidance
    • executive_order
    • notice
  • collections
    Type: array string[]

    Restrict to collection ids or human-readable names (see /laws/collections). Values are resolved server-side.

  • current_only
    Type: boolean

    When true (default), only documents that are the law in force today. Currency is derived — not historical, not future-effective, no in-force successor version.

  • effective_date_from
    Type: string Format: date

    full-date notation as defined by RFC 3339, section 5.6, for example, 2017-07-21

  • effective_date_to
    Type: string Format: date

    full-date notation as defined by RFC 3339, section 5.6, for example, 2017-07-21

  • page
    Type: integer
    min:  
    1

    Integer numbers.

  • page_size
    Type: integer
    min:  
    1
    max:  
    50

    Integer numbers.

  • path_prefix
    Type: string

    Restrict to a subtree via a dot-separated ltree path prefix. Pair with collections — paths are only unique within a collection.

  • publication_date_from
    Type: string Format: date

    full-date notation as defined by RFC 3339, section 5.6, for example, 2017-07-21

  • publication_date_to
    Type: string Format: date

    full-date notation as defined by RFC 3339, section 5.6, for example, 2017-07-21

  • states
    Type: array string[]

    State names or USPS abbreviations; federal law is "Federal". Values are validated server-side.

Responses
  • application/json
  • 400

    Validation error

  • 401

    Unauthorized

  • 403

    Historical search requires full historical access

Request Example for post/laws/search
curl https://app.midpage.ai/api/v1/laws/search \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --data '{
  "query": "non-compete agreement enforceability",
  "page": 1,
  "page_size": 10
}'
{
  "total": 1,
  "page": 1,
  "page_size": 1,
  "results": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "score": 1,
      "collection_id": "cfr",
      "collection_type": "regulation",
      "state": "Federal",
      "country": "US",
      "path": "cfr.t21.cI.scH.p820.spA.s820_1",
      "node_type": "LEAF",
      "number": "820.1",
      "title": "Scope.",
      "citation": "21 C.F.R. § 820.1",
      "effective_date": "2026-07-13",
      "publication_date": "2026-07-13",
      "is_current": true,
      "is_historical": true,
      "snippets": [
        "string"
      ],
      "url": "https://example.com"
    }
  ],
  "state_counts": {
    "California": 41,
    "Texas": 17,
    "Federal": 210
  }
}