API Documentation

REST endpoints for spine CPT categorization, surgery lookup, and operative note coding.

POST/api/categorize

Categorize a single row of CPT codes into a CAST spine surgery category. Returns base logic categorization complemented by Claude analysis.

Request Body

{
  "cptCodes": "22551 22552 20930"
}

Response

{
  "category": "ACDF",
  "subgroup": "2-level",
  "baseCategory": "ACDF",
  "baseSubgroup": "2-level",
  "claudeOverride": false,
  "confidence": 0.95,
  "reasoning": "CPT 22551 (anterior cervical discectomy and fusion) with 22552 (add-on level) indicates 2-level ACDF. 20930 is allograft."
}

curl Example

curl -X POST http://localhost:3000/api/categorize \
  -H "Content-Type: application/json" \
  -d '{"cptCodes": "22551 22552 20930"}'
POST/api/batch

Submit multiple rows of CPT codes for background batch processing. Results are emailed when complete.

Request Body

{
  "rows": [
    "22551 22552 20930",
    "22612 22842 20936"
  ],
  "email": "user@example.com",
  "caseIds": [
    "CASE-001",
    "CASE-002"
  ]
}

Response

{
  "status": "processing",
  "jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "rowCount": 2
}

curl Example

curl -X POST http://localhost:3000/api/batch \
  -H "Content-Type: application/json" \
  -d '{"rows": ["22551 22552 20930", "22612 22842 20936"], "email": "user@example.com", "caseIds": ["CASE-001", "CASE-002"]}'
POST/api/surgery-to-cpt

Convert a surgery description into matching CPT codes. Uses the built-in reference data and falls back to Claude for ambiguous descriptions.

Request Body

{
  "description": "2-level ACDF C5-C7 with plate"
}

Response

{
  "codes": [
    {
      "code": "22551",
      "description": "Anterior cervical discectomy and fusion, first level"
    },
    {
      "code": "22552",
      "description": "Anterior cervical discectomy and fusion, additional level"
    },
    {
      "code": "22845",
      "description": "Anterior instrumentation, 2-3 vertebral segments"
    }
  ],
  "source": "reference"
}

curl Example

curl -X POST http://localhost:3000/api/surgery-to-cpt \
  -H "Content-Type: application/json" \
  -d '{"description": "2-level ACDF C5-C7 with plate"}'
POST/api/cpt-to-surgery

Convert CPT codes into a human-readable surgery description with category and subgroup classification.

Request Body

{
  "codes": "22551 22552 20930"
}

Response

{
  "procedure": "2-level anterior cervical discectomy and fusion with allograft",
  "category": "ACDF",
  "subgroup": "2-level",
  "source": "reference"
}

curl Example

curl -X POST http://localhost:3000/api/cpt-to-surgery \
  -H "Content-Type: application/json" \
  -d '{"codes": "22551 22552 20930"}'
POST/api/op-note

Parse an operative note and return CPT codes with rationale, ICD-10 diagnosis codes, and wRVU calculations with Ohio GPCI adjustment.

Request Body

{
  "description": "Patient underwent L4-5 TLIF with interbody cage and pedicle screw fixation..."
}

Response

{
  "cptCodes": [
    {
      "code": "22630",
      "description": "Lumbar interbody fusion, single level",
      "wRvu": 24.76
    },
    {
      "code": "22842",
      "description": "Posterior segmental instrumentation, 3-6 segments",
      "wRvu": 2.04
    }
  ],
  "icd10Codes": [
    {
      "code": "M51.16",
      "description": "Intervertebral disc degeneration, lumbar region"
    }
  ],
  "totalWorkRvu": 26.8,
  "ohioGpciAdjusted": 26.16,
  "gpciWorkFactor": 0.976
}

curl Example

curl -X POST http://localhost:3000/api/op-note \
  -H "Content-Type: application/json" \
  -d '{"description": "Patient underwent L4-5 TLIF with interbody cage and pedicle screw fixation..."}'