# Compute E/M codes

```
POST 
/compute-em-codes
```

Deterministic, fast recomputation of Evaluation & Management (E/M) CPT codes from structured encounter inputs. No transcript or note is required.

Use this endpoint to recompute codes after the user changes encounter info (modality, payer, total encounter time, etc.) without re-running the full AI pipeline. When the visit type changes, call [`POST /generate-em-codes-async`](/core-api/reference/server/generate-em-codes-async.md) instead.

warning

This feature is a U.S. product release only; this should not be used outside of U.S. markets.

## Request[​](#request "Direct link to request")

## Responses[​](#responses "Direct link to Responses")

* 200

The recomputed E/M codes for the given encounter context.

## Operation spec

```json
{
  "method": "post",
  "path": "/compute-em-codes",
  "operationId": "compute-em-codes",
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "description": "Input for deterministic E/M code computation.",
          "properties": {
            "specialty": {
              "type": "string",
              "description": "The medical specialty of the provider.",
              "nullable": true,
              "enum": [
                "ADDICTION_MEDICINE",
                "PAIN_MEDICINE",
                "ALLERGY_AND_IMMUNOLOGY",
                "ANESTHESIOLOGY",
                "ONCOLOGY",
                "CARDIOLOGY",
                "SURGERY",
                "DERMATOLOGY",
                "DIABETOLOGY",
                "ENDOCRINOLOGY",
                "GENETICS",
                "GERIATRICS",
                "GYNECOLOGY",
                "HEMATOLOGY",
                "HEPATOLOGY",
                "GASTROENTEROLOGY",
                "SPORTS_MEDICINE",
                "OCCUPATIONAL_MEDICINE",
                "GENERAL_MEDICINE",
                "FORENSIC_MEDICINE",
                "PHYSICAL_MEDICINE_AND_REHABILITATION",
                "NEPHROLOGY",
                "NEUROLOGY",
                "NUTRITION",
                "DIETETICS",
                "OPHTHALMOLOGY",
                "ENT",
                "PEDIATRICS",
                "PULMONOLOGY",
                "PSYCHIATRY",
                "RHEUMATOLOGY",
                "RADIOLOGY",
                "IMMUNOLOGY",
                "INFECTIOUS_DISEASE",
                "SEXUAL_MEDICINE",
                "TOXICOLOGY",
                "UROLOGY",
                "MIDWIFE",
                "EMERGENCY_MEDICINE",
                "NURSE",
                "PSYCHOLOGY",
                "PSYCHOTHERAPY",
                "INTERNAL_MEDICINE",
                "FAMILY_MEDICINE",
                "DENTIST",
                "VETERINARIAN",
                "PHYSIOTHERAPY",
                "CHIROPRACTIC",
                "OSTEOPATHIC_MEDICINE",
                "ORTHOPEDICS",
                "OTHER",
                "LACTATION_CONSULTANT",
                "PODIATRY",
                "GENERAL_PRACTICE",
                "HOSPITAL_MEDICINE",
                "BEHAVIORAL_HEALTH",
                "MENTAL_HEALTH",
                "SUBSTANCE_USE_DISORDER",
                "VASCULAR_MEDICINE",
                "LIFESTYLE_MEDICINE",
                "PREVENTIVE_MEDICINE",
                "PUBLIC_HEALTH",
                "ADOLESCENT_MEDICINE",
                "WOUND_CARE",
                "NEUROSURGERY",
                "PLASTIC_SURGERY",
                "PALLIATIVE_CARE",
                "TRANSPLANT_MEDICINE",
                "OBESITY_MEDICINE",
                "CASE_MANAGEMENT",
                "CARE_MANAGEMENT",
                "CARE_COORDINATION",
                "SOCIAL_WORK",
                "PATHOLOGY",
                "RADIATION_ONCOLOGY",
                "SLEEP_MEDICINE",
                "AUDIOLOGY",
                "REPRODUCTIVE_ENDOCRINOLOGY",
                "PHARMACIST",
                "OCCUPATIONAL_THERAPY",
                "SPEECH_LANGUAGE_PATHOLOGY"
              ],
              "example": "GENERAL_PRACTICE",
              "title": "specialty_kind"
            },
            "modality": {
              "type": "string",
              "description": "The modality of the encounter.",
              "enum": [
                "OFFICE",
                "VIDEO",
                "AUDIO"
              ],
              "example": "OFFICE",
              "title": "em_modality"
            },
            "patient_type": {
              "type": "string",
              "description": "Whether the patient is new or established with this provider.",
              "enum": [
                "NEW",
                "ESTABLISHED"
              ],
              "example": "ESTABLISHED",
              "title": "em_patient_type"
            },
            "follow_medicare_rules": {
              "type": "boolean",
              "description": "Whether to apply Medicare coding rules. Set to `true` for Medicare patients, `false` for commercial payers."
            },
            "patient_age_years": {
              "type": "integer",
              "minimum": 0,
              "description": "The patient's age in years. Patients under 1 year old should be specified as `0`.",
              "example": 35
            },
            "visit_type": {
              "description": "The type of visit. Must be consistent with `mdm_level`: `mdm_level` is required when `visit_type` is `sick_visit` or `split_visit`, and must be omitted when `visit_type` is `preventive`.",
              "type": "string",
              "enum": [
                "SICK_VISIT",
                "PREVENTIVE",
                "SPLIT_VISIT"
              ],
              "example": "SICK_VISIT",
              "title": "em_visit_type"
            },
            "mdm_level": {
              "description": "The MDM level to use for code selection. Typically the value returned by a previous call to `POST /generate-em-codes-async`, or an alternative value chosen by the user. Required for `sick_visit` and `split_visit`; must be absent for `preventive`.",
              "type": "string",
              "enum": [
                "STRAIGHTFORWARD",
                "LOW",
                "MODERATE",
                "HIGH"
              ],
              "example": "MODERATE",
              "title": "em_mdm_level"
            },
            "total_time_minutes": {
              "type": "integer",
              "minimum": 0,
              "description": "Total encounter time in minutes. When provided, a time-based coding basis entry is included in `em_codes`. Not applicable for `preventive` or `split_visit` encounters.",
              "example": 38
            }
          },
          "required": [
            "specialty",
            "modality",
            "patient_type",
            "follow_medicare_rules",
            "patient_age_years",
            "visit_type"
          ],
          "title": "compute_em_codes_request"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "The recomputed E/M codes for the given encounter context.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "description": "The result of a deterministic E/M code computation.",
            "properties": {
              "visit_type": {
                "description": "The visit type used for coding, echoed from the request.",
                "type": "string",
                "enum": [
                  "SICK_VISIT",
                  "PREVENTIVE",
                  "SPLIT_VISIT"
                ],
                "example": "SICK_VISIT",
                "title": "em_visit_type"
              },
              "em_codes": {
                "type": "array",
                "description": "The computed E/M CPT codes. May contain multiple entries for different coding bases (MDM-based, time-based, categorical preventive codes).",
                "items": {
                  "type": "object",
                  "description": "A suggested E/M CPT code with its coding basis.",
                  "properties": {
                    "code": {
                      "type": "string",
                      "description": "The CPT code, e.g. `\"99214\"`.",
                      "example": "99214"
                    },
                    "modifiers": {
                      "type": "array",
                      "description": "List of CPT modifiers to append to the code, e.g. `[\"25\"]`.",
                      "items": {
                        "type": "string"
                      },
                      "example": [
                        "25"
                      ]
                    },
                    "coding_basis": {
                      "type": "string",
                      "description": "The basis used to determine this E/M code. - `MDM`: code is based on Medical Decision Making complexity. - `TIME`: code is based on total encounter time. - `CATEGORICAL`: code is a categorical (e.g. preventive) code not derived from MDM or time.",
                      "enum": [
                        "MDM",
                        "TIME",
                        "CATEGORICAL"
                      ],
                      "example": "MDM",
                      "title": "em_coding_basis"
                    },
                    "description": {
                      "type": "string",
                      "description": "Human-readable rationale for why this code was suggested.",
                      "example": "MDM=moderate, established patient, office modality"
                    }
                  },
                  "required": [
                    "code",
                    "modifiers",
                    "coding_basis",
                    "description"
                  ],
                  "title": "em_code"
                }
              }
            },
            "required": [
              "visit_type",
              "em_codes"
            ],
            "title": "compute_em_codes_response"
          }
        }
      }
    }
  }
}
```
