Skip to main content

Prerequisites

  • A Solana wallet funded with USDC — see the wallet setup guide
  • The x402 client library installed for your language
  • A federal case number and court code to monitor

Step 1 — Check coverage

Before querying, confirm the court you need is covered. This endpoint is free and requires no payment.
curl https://api.docketlayer.com/v1/status
Find your court_code in the response. If your court shows "status": "full" you are ready. If your court is not listed, check the coverage roadmap.

Step 2 — Make your first query

from x402 import PaymentClient

client = PaymentClient(
    private_key=os.environ["SOLANA_PRIVATE_KEY"],
    network="solana-mainnet",
    currency="USDC"
)

result = client.get(
    "https://api.docketlayer.com/v1/case",
    json={
        "case_id": "1:24-cv-01234",
        "court_code": "nysd",
        "last_checked": "2026-01-01T00:00:00Z"
    }
).json()

if result["changed"]:
    for filing in result["new_filings"]:
        print(f"{filing['filing_type']}: {filing['description']}")
else:
    print("No changes")

Step 3 — Handle the response

A successful response looks like this:
{
  "case_id": "1:24-cv-01234",
  "court_code": "nysd",
  "queried_at": "2026-04-12T01:00:00Z",
  "changed": true,
  "new_filings": [
    {
      "filing_id": "nysd-2024-01234-0042",
      "filing_type": "order",
      "filed_at": "2026-04-11T14:23:00Z",
      "filed_by": "Judge Sarah Johnson",
      "description": "Order granting motion to dismiss",
      "document_url": "https://ecf.nysd.uscourts.gov/doc1/...",
      "document_access": "pacer_auth_required"
    }
  ],
  "query_cost": 0.99,
  "coverage_status": "full"
}
When changed is false, new_filings is an empty array. Your agent pays $0.99 either way — only for successful responses.

Step 4 — Handle errors

DocketLayer never charges for failed queries.
if response.status_code == 402:
    # Payment failed — check wallet balance and x402 configuration
elif response.status_code == 404:
    # Case not found — verify case_id format and court_code
elif response.status_code == 422:
    # Court not covered — check /v1/status for current coverage
elif response.status_code == 429:
    # Rate limited — back off, retry after retry_after interval
elif response.status_code == 503:
    # PACER unavailable — retry later, check /v1/status

Next steps

Build a monitoring loop

Run your agent on a schedule

Wallet setup

Solana wallet and x402 configuration in detail

API reference

Full endpoint documentation

Court codes

All covered courts and their identifiers