<aside> ⛔ Please refer to our new, evergreen API documentation here: https://openlaws.apidocumentation.com/

</aside>

OpenLaws APIs allow your company and your clients to bring current and precise primary law text into legal and compliance workflows. Legal text can be queried by Bluebook citation strings (recommended approach) or by hierarchical queries.

Get Started

Concepts

Jurisdictions

Jurisdictions in OpenLaws represent laws at the Federal government and the 50 states along with the District of Columbia and Puerto Rico. These are containers for Laws which contain the data for various types of primary law.

Jurisdiction Laws

All data in the OpenLaws API is organized under a single Jurisdiction Law and identified by human-readable keys, e.g. FED-CFR for the Federal Code of Federal Regulations, CA-RR for the California Code of Regulations.

We categorize primary law into various law types:

Citations

Citations are the most common way to query and find specific legal text. For the most accurate queries, we use Bluebook formatted citations.

Examples of valid citations:

Law Structure and Divisions

Law data is naturally hierarchical. For example, a title could contain chapters that could contain sections that might have appendices. State and federal law data in OpenLaws is standardized into a hierarchical tree structure. Each of the tree nodes of the law structure is called a division in OpenLaws.

To illustrate, a law — let’s say EXAMPLE-RR — might look like this:

graph TD
  Z((EXAMPLE-RR)) -.-> A(Title I)
  Z -.-> Y(Title II)
  Z -.-> X(Title III)
  A--> B(Chapter 1)
  A --> C(Chapter 2)
  A --> D(Chapter 3)
  D --> E(Section 100)
  D --> F(Section 101)
  D --> G(Section 102)
  E --> H(Appendix 100.A)

Each rectangle is a division in OpenLaws. The “Titles” in this example are top-level, root divisions. “Chapters” are children of “Titles” and so on.

Division Paths

Divisions typically have a type corresponding to how the state organizes their laws and an identifier that describes the node, e.g. Title I, Chapter 1, Section 100. We normalize the pairing of the division’s type and identifier (or the division’s name when there is no identifier). Then we combine all of a single division’s ancestor tree nodes into a URL-like string, called a path. This is used frequently in the API to identify a specific law division node.

The Get law structure Query or any of the Division Queries will return the paths for a set of divisions. Generally, it not necessary to construct the path on your own.

Example paths for the above diagram:

"/title-i/chapter-1/" is the path of the “Chapter 1” node belonging to the “Title I” node

"/title-i/chapter-3/section-100/appendix-100-a" is the path of “Appendix 100.A” node belonging to the “Section 100” node

Sorting like a human

OpenLaws returns query results in the order a human would sort a list of divisions rather than consistently alphabetical or numerical. Normally, this is determined by the state or federal data source. This is tricky to explain so we’ll give several examples of how we sort:

API Response Objects

<aside> ⚠️ In development

</aside>

Law

LawStructure

Division

API Queries

List law jurisdictions

List all law jurisdictions that are queryable within the OpenLaws API with their unique lawKeyidentifiers.

Parameters

None

GraphQL

REST

Get legal text by citation string

Query for the law information and text for a legal citation.

Parameters

Name Description Required or Optional? Default Value
lawKey The key for the law being queried, ex: FED-CFR or AL-STAT. Required for community and business plans.
Optional for Enterprise. None
citation The citation to search for in URL-encoded format. Required None
depth Levels of divisions to return. Defaults to 1 level deep (return ).

For GraphQL queries with depths > 1, add children to the lawStructure query. | Optional | 1 |

GraphQL

REST

Get law structure

Get data describing the law’s hierarchy. This query is faster and requires less data when the legal text and annotations are not needed.

Parameters

Name Description Required or Optional? Default Value
lawKey The key for the law being queried, ex: FED-CFR or AL-STAT. Required None
path Starting path to query. The path is a URL-like string identifying the division node to start query traversal. Defaults to the root path of the law if omitted (same as starting_path set to/). Optional None
depth Levels of divisions to return. Default to 1 level deep (return ).

For GraphQL queries with depths > 1, add children to the lawStructure query. | Optional | 1 |

GraphQL

REST

Get legal text by law division path

Same response as the “Get legal text by citation string” query, however, the input parameter is a path string instead of a citation. These paths are available from a previous “Get legal text by law division path” or the “Get law structure” query.

Parameters

Name Description Required or Optional? Default Value
lawKey The key for the law being queried, ex: FED-CFR or AL-STAT. Required None
path The exact path to the division node that is being queried Required None
depth Depths greater than 1 will allow you to return the children nodes.

For GraphQL queries with depths > 1, add children to the lawStructure query. | Optional | 1 |

GraphQL

REST

Hyperlink citations in a text string

This query will scan the given text string for citations within the provided law jurisdiction and hyperlink the valid citations to a publicly available OpenLaws webpage where the relevant legal text can be read.

<aside> ⚠️ Only plain text should be passed into the text parameter. HTML including images, styles, and scripts should not be passed into the text string. Only links similar to<a href="" target="_blank">citation</a> will be added where appropriate in the response string. We strongly recommend further processing this query response with a HTML sanitizing library with a strict block list and limited allow list of tags and attributes to reduce the risk of XSS attacks.

</aside>

Parameters

Name Description Required or Optional? Default Value
lawKey The key for the law being queried, ex: FED-CFR or AL-STAT. Required
(Optional for Enterprise plans) None
text Text to scan for citations to hyperlink Required None

GraphQL

REST

Pagination

<aside> ⚠️ Cursor-based pagination is in development.

</aside>

limit and offset parameters will be supported in both the GraphQL and REST APIs.

GraphQL

query {
  lawStructure(limit: 10, offset: 30, lawKey: "FED-USC", path: "/title-42/", depth: 2) {
    // ... snip ...
  }
}

REST

GET /laws/FED-USC/title-42/structure?depth=2&limit=10&offset=30

GraphQL Objects

<aside> ⚠️ Live documentation in development. Future iterations will likely introduce Input and Filter objects.

</aside>

Enterprise OpenLaws API

Get legal text by citation string

Additional enterprise features:

Validate and correct citation string

Check a citation string for validity and get back the recommended Bluebook citation

Get authoritative URL by citation string

Returns a last known authoritative URL for a division. URL could be a link to a deep-linked U.S. state or federal website, PDF, Word document or other document.

GraphQL Subscriptions

Subscribe to changes in the statute or regulatory text to build your own workflows

Custom Consulting Services

Bulk Data Exports

Get one-time or recurring bulk data exports to S3, in USLM XML format, or continuous database replication.

Vector Database Access

We are currently exploring vector search, Retrieval-Augmented Generation (RAG), and customer integrations using our up-to-date, hosted law data.