Investigate API

A free, unauthenticated REST endpoint for AI agents and developers. Send structured medical bill line items, get Medicare rate benchmarks and AI-powered billing error analysis back.

No auth required10 requests/hourJSON in, JSON out

Quick Start

curl -X POST https://www.billsherlock.app/api/v1/investigate \
  -H "Content-Type: application/json" \
  -d '{
    "line_items": [
      { "code": "99285", "charge": 4500, "description": "Emergency dept visit level 5" },
      { "code": "99291", "charge": 8200, "description": "Critical care first hour" }
    ],
    "facility_type": "outpatient_facility",
    "facility_name": "Cedar-Sinai Medical Center",
    "state": "CA"
  }'

Endpoint Reference

MethodPOST
URLhttps://www.billsherlock.app/api/v1/investigate
Content-Typeapplication/json
AuthNone required
Max body size64 KB
Rate limit10 requests/hour per IP

Request Schema

InvestigateRequest

FieldTypeDescription
line_itemsarray (required)1–50 line item objects. Each must have code and charge.
facility_typestringOne of: professional_office, professional_facility, outpatient_facility, inpatient_facility, lab_diagnostic.
facility_namestringRequired when facility_type is a facility classification. Max 200 chars.
statestring2-letter uppercase US state code (e.g., "CA", "TX").
payer_idstringPayer identifier. Triggers payer ID validation rules.
insurance_companystringInsurance company name. Helps contextualize payer-specific rules.
network_statusstringOne of: IN_NETWORK, OUT_OF_NETWORK, UNKNOWN.

InvestigateLineItem

FieldTypeDescription
codestring (required)CPT/HCPCS, NDC, revenue code, or internal code. Max 20 chars.
code_typestringCPT_HCPCS, NDC, REV_CODE, INTERNAL, or UNKNOWN. Auto-detected if omitted.
chargenumber (required)Billed amount in USD. Must be > 0, max 999,999.99.
descriptionstringService description (not clinical notes). Max 200 chars.
quantityintegerUnits/quantity. 1–99, default 1.
modifiersstring[]CPT modifiers (e.g., ["-25", "-59"]). Max 4 items.
service_datestringYYYY-MM-DD format. Helps detect duplicates.
rev_codestringUB-04 revenue code. 3–4 digit numeric.

Code Type Auto-Detection

When code_type is omitted, the API infers it from the code format:

PatternDetected as
5-digit numeric (99285, 36556)CPT_HCPCS
Letter + 4 digits (J1234, A0425)CPT_HCPCS (HCPCS Level II)
10-11 digit with dashes (53746-0442-01)NDC
3-4 digit numeric (0250, 0450)REV_CODE
Anything elseUNKNOWN

Sensitive Data Guidance

Do not send patient name, date of birth, member ID, claim number, account number, address, phone number, or full document text. The description field should contain only service descriptions, not clinical notes or patient details.

Response Schema

A successful response (200) returns the standard API envelope with data and meta fields.

line_items[] — Medicare Rate Benchmarks

FieldTypeDescription
codestringEchoed from request.
code_typestringResolved code type: CPT_HCPCS, NDC, REV_CODE, INTERNAL, or UNKNOWN.
chargenumberEchoed from request.
medicare_ratenumber | nullMedicare benchmark rate. Only populated for CPT/HCPCS codes with a known rate.
rationumber | nullcharge / medicare_rate.
pricing_tierstring | nullfair-price (≤2x), tier-2x (2–3x), tier-3x (3–4x), tier-4x (4–5x), tier-5x (>5x).
benchmark_sourcestring | nullRate source: PFS, CLFS, OPPS, or PART_B_DRUGS.
benchmark_yearinteger | nullRate schedule year.
benchmark_basisstring | nullnational (state-only input) or locality (ZIP resolved).

analysis.findings[]

Present when analysis_status is "complete". Null when "unavailable".

FieldTypeDescription
categorystringIssue category (e.g., Coding Error, Duplicate Billing, Surprise Billing).
titlestringShort patient-readable label.
explanationstringWhat the issue is and why, with policy/coding rationale.
financial_impactnumberEstimated savings in USD.
confidence_scoreinteger0–100, evidence-based confidence.
estimated_effortstringLOW (phone call), MEDIUM (multiple calls/docs), HIGH (formal appeal).
estimated_resolution_timestringe.g., "15-30 minutes", "1-2 hours", "2-4 weeks".
recommendationstringConcrete next action for the patient.

summary

FieldTypeDescription
total_chargednumberSum of all line item charges.
total_medicare_benchmarknumberSum of Medicare rates for items with rates.
overall_rationumber | nulltotal_charged / total_medicare_benchmark.
findings_countintegerTotal findings (0 when analysis unavailable).
potential_savingsnumberSum of financial_impact across all findings.

input_quality

Indicates how much context the caller provided. score is one of: complete, partial, or minimal. missing_fields lists fields that would improve accuracy. next_best_questions suggests questions the agent can ask the user.

analysis_status

ValueMeaning
completeAI analysis ran successfully. analysis contains findings.
unavailableAI analysis failed. analysis is null. Medicare rate benchmarks are still returned.

Example

Request

{
  "line_items": [
    {
      "code": "99285",
      "charge": 4500,
      "description": "Emergency dept visit level 5"
    },
    {
      "code": "99291",
      "charge": 8200,
      "description": "Critical care first hour"
    }
  ],
  "facility_type": "outpatient_facility",
  "facility_name": "Cedar-Sinai Medical Center",
  "state": "CA",
  "network_status": "IN_NETWORK"
}
Show full response
{
  "data": {
    "line_items": [
      {
        "code": "99285",
        "code_type": "CPT_HCPCS",
        "charge": 4500,
        "medicare_rate": 637.41,
        "ratio": 7.06,
        "pricing_tier": "tier-5x",
        "benchmark_source": "PFS",
        "benchmark_year": 2026,
        "benchmark_basis": "national"
      },
      {
        "code": "99291",
        "code_type": "CPT_HCPCS",
        "charge": 8200,
        "medicare_rate": 462.15,
        "ratio": 17.74,
        "pricing_tier": "tier-5x",
        "benchmark_source": "PFS",
        "benchmark_year": 2026,
        "benchmark_basis": "national"
      }
    ],
    "analysis_status": "complete",
    "analysis": {
      "overall_assessment": "MAJOR_ISSUES",
      "findings": [
        {
          "category": "Coding Error",
          "title": "Level 5 ER Visit Without Documented Complexity",
          "explanation": "99285 requires high-complexity medical decision-making...",
          "financial_impact": 1800.00,
          "confidence_score": 65,
          "estimated_effort": "MEDIUM",
          "estimated_resolution_time": "1-2 hours",
          "recommendation": "Request itemized records showing medical decision-making complexity."
        }
      ],
      "quick_checks": [
        "Were you in the ER for more than 30 minutes of critical care?",
        "Did you receive any procedures during the ER visit?"
      ]
    },
    "summary": {
      "total_charged": 12700,
      "total_medicare_benchmark": 1099.56,
      "overall_ratio": 11.55,
      "findings_count": 2,
      "potential_savings": 6300.00
    },
    "input_quality": {
      "score": "partial",
      "missing_fields": ["allowed_amount", "paid_amount"],
      "next_best_questions": [
        "Do you have the EOB showing what insurance paid vs. what you owe?"
      ]
    },
    "limitations": [
      "Findings are based only on user-provided structured line items, not a reviewed document.",
      "Medicare benchmarks are approximate.",
      "This analysis is informational only and does not constitute medical, legal, or financial advice."
    ],
    "upsell": {
      "message": "We found 2 potential billing issues. Upload your full bill for a comprehensive audit.",
      "url": "https://billsherlock.app/audit?ref=api-investigate",
      "full_audit_includes": [
        "Full document OCR",
        "Hospital-specific cash prices",
        "No Surprises Act detection",
        "Downloadable audit report"
      ]
    }
  },
  "meta": {
    "timestamp": "2026-05-14T18:30:00Z",
    "version": "1.0",
    "rate_limit": {
      "remaining": 9,
      "reset_at": "2026-05-14T19:00:00Z"
    }
  }
}

Errors & Rate Limits

StatusCodeWhen
400VALIDATION_ERRORInvalid request body, missing required fields, or body exceeds 64 KB.
429RATE_LIMITEDExceeded 10 requests/hour. Check Retry-After header.
503SERVICE_UNAVAILABLEService temporarily unavailable. Retry with backoff.
Example error responses

400 — Validation Error

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "line_items is required and must contain 1-50 items"
  },
  "meta": { "timestamp": "2026-05-14T18:30:00Z" }
}

429 — Rate Limited

{
  "error": {
    "code": "RATE_LIMITED",
    "message": "Rate limit exceeded. Try again in 42 minutes."
  },
  "meta": { "timestamp": "2026-05-14T18:30:00Z" }
}

Graceful Degradation

When AI analysis fails but Medicare rate lookups succeed, the endpoint returns a 200 with analysis_status: "unavailable" and analysis: null. Agents can still present rate benchmarks to users.

The unauthenticated rate limit is 10 requests per hour per IP. Agent platforms typically make one API call per user interaction, so this covers normal usage. For higher-volume integrations, contact us about API key access.

Agent Integration

ChatGPT Custom GPT

  1. In the GPT builder, go to Configure Actions Import from URL.
  2. Enter: https://www.billsherlock.app/api/v1/openapi
  3. Set Authentication to None.
  4. In Instructions, tell the GPT to extract service codes, charges, and context from user messages, then call investigateBill. Present findings with confidence scores and recommendations. Always include the link to the full audit.

Claude tool_use

Define a tool that calls POST /api/v1/investigate with the request schema above. The OpenAPI spec at /api/v1/openapi provides the full schema for programmatic consumption.

LangChain / LlamaIndex

Use the OpenAPI spec URL with your framework's OpenAPI tool loader (e.g., LangChain's OpenAPIToolkit). The spec includes full request/response schemas and the investigateBill operation ID.

OpenAPI Specification

The machine-readable OpenAPI 3.0 spec is available at:

https://www.billsherlock.app/api/v1/openapi

Disclaimers

  • Results are informational only and do not constitute medical, legal, or financial advice.
  • Medicare benchmarks are approximate and vary by locality, setting, modifiers, and date of service.
  • Findings are based on user-provided structured line items, not a reviewed document.
  • Potential savings are estimates and are not guaranteed.
  • Agents should always present the limitations array from the response to users alongside findings.