# Get Medicaid spending by code
URL: https://backworkhealth.com/docs/api/getSpendingByCode

Returns aggregate Medicaid provider spending statistics per HCPCS code, including totals and year-over-year breakdowns from CMS claims data.

**Endpoint:** `GET /api/v1/spending/by-code`

**Availability:** Live in production.

**Authentication:** API key in `Authorization: Bearer <key>` with the `read` scope.

Returns aggregate Medicaid provider spending statistics per HCPCS code, including totals and year-over-year breakdowns from CMS claims data. Provide `code` or `codes`. Requested codes with no data return zeroed totals. Patient counts are publisher row-level sums, not deduplicated people.

**Parameters**

* `code` (query): Single HCPCS code to look up
* `codes` (query): Comma-separated list of HCPCS codes (max 10)
* `year` (query): Filter the yearly breakdown to a specific year

**Example request**

```bash
curl -X GET "https://backworkhealth.com/api/v1/spending/by-code?code=T1019&codes=T1019%2CT1020&year=2023" \
  -H "Authorization: Bearer $BACKWORK_API_KEY"
```

**Example response** (`200`)

```json
{
  "success": true,
  "data": {},
  "meta": {
    "request_id": "string",
    "timestamp": "2026-01-15T10:30:00Z",
    "codes_requested": 0,
    "patient_count_semantics": "sum_of_source_row_counts_not_distinct_people",
    "patient_count_disclosure": "string",
    "year_filter": 0
  }
}
```
