> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.taigabilling.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.taigabilling.com/_mcp/server.

# Predict visit codes

POST https://api.taigabilling.com/api/prices/v1/treatments
Content-Type: application/json

Predicts the procedure codes for an upcoming visit without pricing it. Price the result by sending its `id` as `treatments.trt_id` to the create-price endpoint.

Reference: https://docs.taigabilling.com/api-reference/prices/create-treatment-prediction

## Authentication

- `Authorization` header (bearer token, required) — Send your Taiga API key as a Bearer token. Create and manage keys in the Taiga developer portal.

## Servers

- `https://api.taigabilling.com` (Production, default)
- `https://api-staging.taigabilling.com` (Staging)

## Request

### Headers

- `Idempotency-Key` (string, required) — Retrying with the same key and body returns the same result.

### Body (application/json)

This endpoint expects a TreatmentPredictionCreate.

- `appointment` (TreatmentPredictionCreateAppointment, required)
- `billing_provider_npi` (string, required)
- `patient` (TreatmentPredictionCreatePatient, required)
- `insurance` (TreatmentPredictionCreateInsurance, optional)
- `max_candidates` (integer, optional) — Defaults to 5.
- `provider` (TreatmentPredictionCreateProvider, optional)

## Response

### 200

Prediction

- `candidates` (list of TreatmentPredictionCandidatesItems, required) — Further likely codes, best first.
- `created_at` (datetime, required)
- `id` (string, required) — Send as `treatments.trt_id` to price this prediction.
- `livemode` (boolean, required)
- `object` (enum, required)
  - Allowed values: `treatment_prediction`
- `predicted` (list of TreatmentPredictionPredictedItems, required) — The codes expected for the visit.
- `model_version` (string, optional, nullable)
- `selection_mode` (string, optional, nullable) — `model`, `route` or `suppressed`.

## Errors

### 400 Bad Request Error

The request could not be completed.

- `message` (string, required)
- `error` (ApiPricesV1TreatmentsPostResponsesContentApplicationJsonSchemaError, optional)

### 401 Unauthorized Error

The request could not be completed.

- `message` (string, required)
- `error` (ApiPricesV1TreatmentsPostResponsesContentApplicationJsonSchemaError, optional)

### 403 Forbidden Error

The request could not be completed.

- `message` (string, required)
- `error` (ApiPricesV1TreatmentsPostResponsesContentApplicationJsonSchemaError, optional)

### 404 Not Found Error

The request could not be completed.

- `message` (string, required)
- `error` (ApiPricesV1TreatmentsPostResponsesContentApplicationJsonSchemaError, optional)

### 409 Conflict Error

The request could not be completed.

- `message` (string, required)
- `error` (ApiPricesV1TreatmentsPostResponsesContentApplicationJsonSchemaError, optional)

### 429 Too Many Requests Error

The request could not be completed.

- `message` (string, required)
- `error` (ApiPricesV1TreatmentsPostResponsesContentApplicationJsonSchemaError, optional)

### 502 Bad Gateway Error

The request could not be completed.

- `message` (string, required)
- `error` (ApiPricesV1TreatmentsPostResponsesContentApplicationJsonSchemaError, optional)

## Types

### TreatmentPredictionCreateAppointment

- `type` (string, required) — Appointment type as scheduled.
- `department` (string, optional)
- `location` (string, optional)
- `notes` (string, optional)
- `reference` (string, optional)
- `scheduled_for` (datetime, optional)
- `specialty` (string, optional)

### TreatmentPredictionCreatePatient

- `reference` (string, required) — Your patient id.
- `dob` (date, optional)
- `sex` (enum, optional)
  - Allowed values: `female`, `male`, `other`, `unknown`
- `state` (string, optional)

### TreatmentPredictionCreateInsurance

- `group_number` (string, optional)
- `member_id` (string, optional)
- `payer_id` (string, optional)
- `plan_name` (string, optional)

### TreatmentPredictionCreateProvider

- `npi` (string, optional)
- `taxonomy` (string, optional)

### TreatmentPredictionCandidatesItems

- `code` (string, required)
- `modifiers` (list of string, required)
- `probability` (double, required, nullable) — Likelihood the code is billed. Null on codes committed by your appointment-type configuration; check `selection` before sorting.
- `selection` (string, optional) — `model` (scored) or `route` (committed by configuration).
- `treatment_name` (string, optional, nullable)

### TreatmentPredictionPredictedItems

- `code` (string, required)
- `modifiers` (list of string, required)
- `probability` (double, required, nullable) — Likelihood the code is billed. Null on codes committed by your appointment-type configuration; check `selection` before sorting.
- `selection` (string, optional) — `model` (scored) or `route` (committed by configuration).
- `treatment_name` (string, optional, nullable)

### ApiPricesV1TreatmentsPostResponsesContentApplicationJsonSchemaError

- `candidates` (list of string, optional) — Matching payer ids when `payer_id` was ambiguous.
- `code` (string, optional)
- `message` (string, optional)
- `param` (string, optional) — The request field at fault.
- `retryable` (boolean, optional) — Retry unchanged only when true.
- `type` (string, optional)

## Examples

**Request**

```json
{
  "appointment": {
    "type": "string",
    "value": {
      "type": "string"
    }
  },
  "billing_provider_npi": {
    "0": "s",
    "1": "t",
    "2": "r",
    "3": "i",
    "4": "n",
    "5": "g",
    "value": "string"
  },
  "patient": {
    "reference": "string",
    "value": {
      "reference": "string"
    }
  }
}
```

**Response**

```json
{
  "candidates": [
    {
      "code": "string",
      "modifiers": [
        "string"
      ],
      "probability": 0.5,
      "selection": "string",
      "treatment_name": "string"
    }
  ],
  "created_at": "2024-01-15T09:30:00Z",
  "id": "string",
  "livemode": true,
  "object": "treatment_prediction",
  "predicted": [
    {
      "code": "string",
      "modifiers": [
        "string"
      ],
      "probability": 0.5,
      "selection": "string",
      "treatment_name": "string"
    }
  ],
  "model_version": "string",
  "selection_mode": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.taigabilling.com/api/prices/v1/treatments"

payload = {
    "appointment": {
        "type": "string",
        "value": { "type": "string" }
    },
    "billing_provider_npi": {
        "0": "s",
        "1": "t",
        "2": "r",
        "3": "i",
        "4": "n",
        "5": "g",
        "value": "string"
    },
    "patient": {
        "reference": "string",
        "value": { "reference": "string" }
    }
}
headers = {
    "Idempotency-Key": "Idempotency-Key",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```