Skip to content
LexBuild
On this page

API Quickstart

Make your first API call to the LexBuild Data API and retrieve legal content as JSON, Markdown, or plaintext.

Base URL

https://lexbuild.dev/api

All endpoints are prefixed with /api/. No authentication is required for read-only access.

Your First Request

Retrieve a single U.S. Code section as JSON:

curl https://lexbuild.dev/api/usc/documents/1-1

This returns the document for 1 USC Section 1 (“Words denoting number, gender, and so forth”):

{
  "data": {
    "identifier": "/us/usc/t1/s1",
    "heading": "1 USC \u00a7 1 - Words denoting number, gender, and so forth",
    "source": "usc",
    "title_number": 1,
    "section_number": "1",
    "granularity": "section",
    "body": "# \u00a7 1. Words denoting number, gender, and so forth\n\n...",
    "token_estimate": 1250
  }
}

Content Negotiation

Request the same document as Markdown:

curl https://lexbuild.dev/api/usc/documents/1-1 \
  -H "Accept: text/markdown"

Or use the format query parameter:

curl "https://lexbuild.dev/api/usc/documents/1-1?format=markdown"

Supported formats:

FormatAccept HeaderQuery Param
JSONapplication/json (default)?format=json
Markdowntext/markdown?format=markdown
Plain texttext/plain?format=plaintext

Browse Available Sources

List all available sources with document counts:

curl https://lexbuild.dev/api/sources
{
  "data": [
    { "id": "usc", "name": "U.S. Code", "document_count": 60421 },
    { "id": "cfr", "name": "Code of Federal Regulations", "document_count": 232847 },
    { "id": "fr", "name": "Federal Register", "document_count": 785000 }
  ]
}

List Documents

List USC documents with pagination:

curl "https://lexbuild.dev/api/usc/documents?limit=5"

Filter by title:

curl "https://lexbuild.dev/api/usc/documents?title_number=18&limit=5"

Search across all sources:

curl "https://lexbuild.dev/api/search?q=environmental+protection&limit=5"

Filter search results by source:

curl "https://lexbuild.dev/api/search?q=securities+fraud&source=cfr&limit=5"

[!TIP] The interactive API reference with request builder is available at lexbuild.dev/api/docs.

Next Steps