Skip to main content
The Court Rules API is designed to work well with AI agents. The OpenAPI spec provides everything an LLM needs to understand and call the API, and the MCP server exposes both court rules and enforcement data as native agent tools.

MCP vs REST API

If your AI tool supports the Model Context Protocol (MCP), you can connect directly to the hosted MCP server instead of using the REST API. MCP provides the same data through a standardized tool-calling interface that works natively with Claude Desktop, Cursor, and other MCP-enabled clients. See the MCP: Court Rules and MCP: Enforcement Data guides for setup instructions. The REST API approach below works with any HTTP client or agent framework.

Quick start: copy a prompt from the console

The console dashboard has ready-to-paste prompts for v0, Bolt, Replit, Lovable, Claude Code, Cursor, and Windsurf. Select your tool, copy the prompt, and paste it. The prompt includes the API endpoint, example request bodies, and instructions for building a compliance checker UI. For local tools (Claude Code, Cursor, Windsurf), your API key is included automatically.

Step 1: Download the OpenAPI spec

The spec is available as a public endpoint (no authentication required):
curl 'https://api.courtrules.app/openapi.json' -o openapi.json
This returns the complete OpenAPI 3.1 specification with all endpoints, request/response schemas, and examples. The spec is auto-generated from the API’s route definitions, so it’s always up to date.

Step 2: Feed the spec to your agent

Give the OpenAPI spec to your LLM as context. Most AI agent frameworks support this natively:
  • Claude: Attach the JSON file as context or paste it into the system prompt
  • ChatGPT: Upload the file or use the Actions/Functions feature
  • LangChain / LlamaIndex: Use their OpenAPI tool loader
  • Custom agents: Parse the spec and register each endpoint as a tool

Step 3: Example agent prompt

Here’s a system prompt that turns an LLM into a court rules compliance assistant:
You are a federal court filing compliance assistant. You have access to
the Court Rules API.

When the user describes a document they plan to file, do the following:

1. Ask for the judge name (or slug), district, document type, and
   motion type if not provided.
2. Call GET /api/v1/rules to show the user what rules apply BEFORE
   they finalize their document.
3. Once they have page count and word count, call POST /api/v1/check
   to run the compliance check.
4. Explain each result in plain English. For FAIL results, state
   exactly what needs to change and cite the rule source.
5. For ACTION_REQUIRED items, explain what the filer needs to do
   (e.g., prepare courtesy copies, complete a pre-motion conference).

Always cite the rule source (e.g., "FRCP 10(a)", "EDNY LR 7.1(c)",
"Amon SO") when explaining a result.

If the user provides a PDF instead of metadata, call
POST /api/v1/classify with the base64-encoded PDF to analyze it.
The response includes a check_request with extracted metadata. Add the
filing context fields (is_pro_se, pmc_completed, opposing_party_pro_se,
filing_role) before sending the merged body to POST /api/v1/check.

Agent workflow

Enforcement data in agent workflows

AI agents can monitor enforcement actions, answer regulatory questions, and trigger compliance reviews using the enforcement tools available through MCP.

Example: regulatory monitoring agent

System prompt:
You are a regulatory monitoring assistant for an in-house legal team.
When asked about enforcement actions, use the MCP tools:
1. Call search_enforcement_actions to find relevant events
2. For high-risk events, call get_enforcement_details for full context
3. Highlight: what law was violated, what the remedy requires, and what
   contract clauses the team should review (using search_terms)

Example agent conversation

User: "What enforcement actions involved children's data this year?"

Agent calls: search_enforcement_actions({
  violation_type: "children_data",
  date_from: "2026-01-01"
})

Agent responds: "Two major actions in 2026: Epic Games paid $275M for
COPPA violations involving Fortnite (dark patterns + children's data
collection without consent), and Jam City settled for $1.4M over selling
minors' data without opt-in consent. Both cases flag these contract
terms to review: COPPA compliance, parental consent mechanisms, age
verification."
For the full list of enforcement tools and their parameters, see the MCP: Enforcement Data guide.

Tips for agent builders

Use /rules for context

Before running a compliance check, call /rules to give your agent (and the user) full context on what rules apply. This makes the agent’s explanations more informed:
# Get all rules for a judge + document context
curl 'https://api.courtrules.app/api/v1/rules?judge_slug=carol-bagley-amon&district_id=edny&document_scope=brief_support&motion_type=Rule_56' \
  -H "Authorization: Bearer YOUR_API_KEY"

Use /check for validation

The /check endpoint is deterministic and sub-millisecond. Your agent can call it multiple times as the user iterates on their document without performance concerns:
# Check compliance (fast, deterministic, idempotent)
curl -X POST https://api.courtrules.app/api/v1/check \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "judge_slug": "carol-bagley-amon",
    "district_id": "edny",
    "document_scope": "brief_support",
    "motion_type": "Rule_56",
    "is_pro_se": false,
    "pmc_completed": false,
    "opposing_party_pro_se": false,
    "filing_role": "movant",
    "document": { "page_count": 25, "word_count": 7200 }
  }'

Use /classify for PDF analysis

If the user uploads a PDF, use /classify to extract metadata and classify it before checking:
# Classify a PDF (10-30s)
PDF_B64=$(base64 -i motion_for_sj.pdf)

curl -X POST https://api.courtrules.app/api/v1/classify \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{
    \"judge_slug\": \"carol-bagley-amon\",
    \"district_id\": \"edny\",
    \"pdf_base64\": \"$PDF_B64\"
  }"
The response includes a check_request field with extracted document metadata. Before sending to /check, merge in the filing context fields that only the filer knows: is_pro_se, pmc_completed, opposing_party_pro_se, and filing_role.

Use /courts for discovery

Let the agent browse available courts and judges:
# List all courts
curl 'https://api.courtrules.app/api/v1/courts' \
  -H "Authorization: Bearer YOUR_API_KEY"

# List judges in a district
curl 'https://api.courtrules.app/api/v1/judges?district_id=edny' \
  -H "Authorization: Bearer YOUR_API_KEY"

Example conversation flow

User:  I'm filing a summary judgment motion with Judge Brown in EDNY.
       My brief is 22 pages and about 7,200 words.

Agent: Let me check that against Judge Brown's requirements.
       [calls POST /check with page_count=22, word_count=7200]

       Your filing is NON-COMPLIANT. Here's what I found:

       FAIL: 22 pages exceeds Judge Brown's 20-page limit
       (Source: Brown SO section 2.B)

       You need to cut 2 pages. Judge Brown's standing order
       limits support briefs to 20 pages.

       Also note:
       - Courtesy copies are always required (Brown SO section 1)
       - Motion papers must NOT be filed until fully briefed
         (Brown SO section 3.B)

User:  What if I was filing with Judge Amon instead?

Agent: [calls POST /check with judge_slug=carol-bagley-amon]

       With Judge Amon, the same document gets a different result:
       no page limit violation. The 22 pages are within Amon's
       25-page limit (the EDNY district default).

       However, you'd still need:
       - Courtesy copies: tabbed binder, double-sided (Amon SO)
       - Wait for full briefing before filing (Amon SO)

Framework-specific examples

Claude tool use

{
  "name": "check_court_compliance",
  "description": "Check a legal document for compliance with federal court rules",
  "input_schema": {
    "type": "object",
    "properties": {
      "judge_slug": { "type": "string" },
      "district_id": { "type": "string" },
      "document_scope": { "type": "string" },
      "motion_type": { "type": "string" },
      "page_count": { "type": "integer" },
      "word_count": { "type": "integer" }
    },
    "required": ["judge_slug", "district_id", "document_scope", "page_count", "word_count"]
  }
}

OpenAI function calling

{
  "type": "function",
  "function": {
    "name": "check_court_compliance",
    "description": "Check a legal document for compliance with federal court rules",
    "parameters": {
      "type": "object",
      "properties": {
        "judge_slug": { "type": "string", "description": "Judge identifier slug" },
        "district_id": { "type": "string", "description": "Federal district ID" },
        "document_scope": {
          "type": "string",
          "enum": ["brief_support", "brief_reply", "brief_opposition", "letter", "discovery_letter"]
        },
        "motion_type": {
          "type": "string",
          "enum": ["Rule_12", "Rule_56", "Rule_50", "Rule_59", "discovery", "general"]
        },
        "page_count": { "type": "integer" },
        "word_count": { "type": "integer" }
      },
      "required": ["judge_slug", "district_id", "document_scope", "page_count", "word_count"]
    }
  }
}

Further reading