home db
K3 Analytics

API Documentation

Everything you need to query 385+ federal fraud datasets.

Claude Code Integration

The easiest way to use FraudGraph. Just tell Claude Code to install it — no manual setup needed.

# Just tell Claude:
"Install the fraudgraph Python package and set my API key to fg_your_key"
# Then ask questions directly:
"Find all federal contractors with active EPA enforcement actions"
# Claude handles the SQL, API calls, and analysis for you:
"Which SEC-filed companies received Provider Relief Fund payments over $1M?"

Claude Code translates your questions into SQL, calls the FraudGraph API, and analyzes the results — all in one conversation.

MCP Connector (Claude.ai)

Query FraudGraph directly from Claude.ai conversations. Add the connector once, then ask Claude questions — it calls the database tools automatically.

Setup

# 1. Open Claude.ai settings
Settings → Connectors → Add Connector
# 2. Paste the MCP endpoint URL with your API key
https://api.k3analytics.io/mcp/?api_key=fg_your_key
# 3. Ask Claude anything about the data
"How many excluded providers are in the LEIE database?"
"Show me EPA enforcement actions against Company B Healthcare"
"Run: SELECT COUNT(*) FROM epa_echo_enforcement WHERE TOTAL_PENALTY_ASSESSED_AMT > 100000"

Available Tools

Tool Description
query_sql Execute any read-only SQL query (DuckDB dialect)
list_tables List all tables with row counts
describe_table Show columns, types, and nullability for a table
search_entities Search resolved entities by name (with optional state filter)
get_ppp_loans Look up PPP loans by borrower name
search_courtlistener Search 70M+ federal court dockets by party name, NOS code, or keyword (live API, 200 calls/hr)

Authentication is via the API key in the URL. Your tier limits (tables, row caps) apply to all tool calls. The same SQL sanitization and guardrails as the REST API protect the MCP endpoint.

Python SDK

# Install
pip install fraudgraph

# Usage
from fraudgraph import FraudGraph
fg = FraudGraph(api_key="fg_your_key")

# SQL query
result = fg.query("SELECT * FROM leie LIMIT 10")

# Browse tables
tables = fg.catalog()

# AI query (Pro)
result = fg.ai("Which healthcare providers have both LEIE exclusions and EPA violations?")

Authentication

All API requests require an API key passed in the X-API-Key header.

# Every request needs this header
curl -H "X-API-Key: fg_your_key_here" https://api.k3analytics.io/v1/catalog

Get a free key at api.k3analytics.io. Free Preview includes LEIE and OFAC tables. Contact us for Pro access.

Base URL

https://api.k3analytics.io

Endpoints

GET /v1/catalog Pro Full catalog

List all available tables with column counts. Free tier sees LEIE + OFAC. Pro sees all 385+ tables.

# Request
curl -H "X-API-Key: YOUR_KEY" \
https://api.k3analytics.io/v1/catalog
# Response
{
  "tables": [
    {"schema_name": "main", "table_name": "ppp", "column_count": 52},
    {"schema_name": "main", "table_name": "leie", "column_count": 18},
    ...
  ],
  "total": 278
}
POST /v1/query Pro All tables, 10K rows

Run a SQL query against the database. DuckDB dialect. Free Preview: LEIE/OFAC only, 25 rows, no JOINs. Pro: all tables + entity resolution, custom limits, AI queries. Contact us for Pro access.

# Find largest EPA penalties
curl -X POST -H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"sql": "SELECT CASE_NAME, DEFENDANT_NAME, TOTAL_PENALTY_ASSESSED_AMT FROM epa_echo_enforcement ORDER BY TOTAL_PENALTY_ASSESSED_AMT DESC LIMIT 5"}' \
https://api.k3analytics.io/v1/query
# Query LEIE exclusions by state
curl -X POST -H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"sql": "SELECT * FROM leie WHERE STATE = '\''TX'\'' LIMIT 10"}' \
https://api.k3analytics.io/v1/query
Pro users receive full schema documentation with table and column references for cross-dataset queries.
# Response format
{
  "columns": ["DEFENDANT_NAME", "TOTAL_PENALTY_ASSESSED_AMT"],
  "rows": [["COMPANY A", 5000000], ...],
  "row_count": 5,
  "truncated": false
}
POST /v1/ai/query Pro

Ask a question in plain English. The API translates it to SQL, runs it, and returns results.

# Natural language query
curl -X POST -H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"question": "Which Provider Relief Fund recipients have EPA enforcement actions?"}' \
https://api.k3analytics.io/v1/ai/query
# Response includes the generated SQL + results
{
  "sql": "...",
  "columns": [...],
  "rows": [...],
  "row_count": 42,
  "truncated": false
}
GET /v1/download/ppp Pro

Download datasets as Parquet files. Pro tier only.

curl -O -H "X-API-Key: YOUR_KEY" \
https://api.k3analytics.io/v1/download/ppp
POST /v1/signup No auth required

Create a free API key. The key is emailed to you.

curl -X POST -H "Content-Type: application/json" \
-d '{"email": "you@company.com"}' \
https://api.k3analytics.io/v1/signup
# Response
{"message": "API key sent to you@company.com", "key_prefix": "fg_abc12...", "tier": "free"}
GET /health No auth required

Check API status and database connectivity.

# Request
curl https://api.k3analytics.io/health
# Response
{"status": "ok", "duckdb_tables": 545}

Cross-Dataset Entity Resolution

Pro tier enables cross-dataset queries using FraudGraph's built-in entity resolution. Ask questions that span multiple federal programs — the API handles the matching automatically.

Use the AI query endpoint for natural language cross-referencing, or contact us for full schema documentation after signing up for Pro.

CourtListener Integration

Live search proxy for CourtListener's 70M+ federal court docket API. Rate-limited to 200 calls/hour with 15-minute response caching. Also available as the search_courtlistener MCP tool.

GET /courtlistener/search Pro

Search dockets by party name, keyword, nature-of-suit code, court, or date range.

Param Description
partyCompany or person name
qFree-text search query
nature_of_suitNOS code (e.g. 375 for FCA, 370 for fraud)
courtCourt ID (e.g. txsd, oknd)
date_filed_afterYYYY-MM-DD
date_filed_beforeYYYY-MM-DD
# Search for Brookhaven Hospital cases
curl "https://api.k3analytics.io/courtlistener/search?party=Brookhaven+Hospital"
GET /courtlistener/parties/{docket_id} Pro

Get parties and attorneys for a specific docket.

GET /courtlistener/status

Check rate limit status (remaining calls, cache size).

Rate Limits

Tier Tables Queries/day Rows/query
Free Preview LEIE + OFAC (no JOINs) 10 25
Pro Contact us All 328+ + entity resolution Unlimited 10,000

Error Codes

Code Meaning
401 Invalid or missing API key
403 Feature not available on your tier
429 Rate limit exceeded
400 Invalid SQL or request body

Terms · Privacy · K3 Analytics · @K3_Analytics