---
title: "Predict Codes"
method: POST
path: "/tools/coding/"
tags: ["Codes"]
---

# Predict Codes

`POST /tools/coding/`

Predict medical codes from provided context.<br/><Note>This is a stateless endpoint, designed to predict ICD-10-CM, ICD-10-PCS, ICD-10 (international), ICD-10-UK, CIM-10-FR, ICD-10-GM, OPCS-4, OPS, CCAM and CPT codes based on input text string or documentId.<br/><br/>More than one code system may be defined in a single request.<br/><br/>Code prediction requests have two possible values for context:<br/>- `text`: One set of code prediction results will be returned based on all input text defined.<br/>- `documentId`: Code prediction will be based on that defined document only.<br/><br/>The response includes two sets of results:<br/>- `Codes`: Codes predicted by the model.<br/>- `Candidates`: Lower-confidence codes the model considered potentially relevant but excluded from the predicted set.<br/><br/>All predicted code results are based on input context defined in the request only (not other external data or assets associated with an interaction).</Note>

## Headers

- `Tenant-Name` string, required — Identifies a distinct entity within Corti's multi-tenant system. Ensures correct routing and authentication of the request.

## Request body

- CodesGeneralPredictRequest
  - `system` CommonCodingSystemEnum[], required — List of coding systems for prediction
  - `context` CommonAIContext[], required — Select either `text` or `documentId` as input context to the model for code prediction. Evidence indices in the response map to this array.
    - union
      - CommonTextContext
        - `type` 'text', required — The type of context, always "text" in this context.
        - `text` string, required — A text string to be used as input to the model.
      - CommonDocumentIDContext
        - `type` 'documentId', required — The type of context, always "documentId" in this context.
        - `documentId` string, required — A referenced document ID to be used as input to the model.
  - `filter` CodesFilter — Optional filter to restrict the set of codes the model can predict.
    - `include` string[] — Codes or categories to include. When empty, the full set of codes for the requested systems is used.
    - `exclude` string[] — Codes or categories to subtract from the include set.
    - `expand` boolean — When true (default), category codes are expanded to their leaf codes.

## Response `200`

List of predicted codes and candidate codes per system defined in the request, including evidence supporting the code prediction.

- CodesGeneralResponse
  - `codes` CodesGeneralReadResponse[], required — Codes predicted by the model.
    - `system` 'icd10cm-inpatient' | 'icd10cm-outpatient' | 'icd10pcs' | 'cpt' | 'icd10int-inpatient' | 'icd10int-outpatient' | 'icd10uk-inpatient' | 'icd10uk-outpatient' | 'cim10fr-inpatient' | 'cim10fr-outpatient' | 'icd10gm-inpatient' | 'icd10gm-outpatient' | 'opcs4' | 'ops' | 'ccam' | 'snomedctint', required
    - `code` string, required — The medical code
    - `display` string, required — Description of the medical code
    - `evidences` object[] — The evidence for the prediction
      - `contextIndex` integer, required — Index from the context input array
      - `text` string, required — Part of input text
      - `start` integer, required — 0-based start character offset of the evidence span (inclusive)
      - `end` integer, required — 0-based end character offset of the evidence span (exclusive)
    - `alternatives` object[] — Codes the model also considered for this prediction.
      - `code` string, required — The medical code
      - `display` string, required — Description of the medical code
  - `candidates` CodesGeneralReadResponse[], required — Lower-confidence codes the model considered potentially relevant but excluded from the predicted set.
    - `system` 'icd10cm-inpatient' | 'icd10cm-outpatient' | 'icd10pcs' | 'cpt' | 'icd10int-inpatient' | 'icd10int-outpatient' | 'icd10uk-inpatient' | 'icd10uk-outpatient' | 'cim10fr-inpatient' | 'cim10fr-outpatient' | 'icd10gm-inpatient' | 'icd10gm-outpatient' | 'opcs4' | 'ops' | 'ccam' | 'snomedctint', required
    - `code` string, required — The medical code
    - `display` string, required — Description of the medical code
    - `evidences` object[] — The evidence for the prediction
      - `contextIndex` integer, required — Index from the context input array
      - `text` string, required — Part of input text
      - `start` integer, required — 0-based start character offset of the evidence span (inclusive)
      - `end` integer, required — 0-based end character offset of the evidence span (exclusive)
    - `alternatives` object[] — Codes the model also considered for this prediction.
      - `code` string, required — The medical code
      - `display` string, required — Description of the medical code
  - `usageInfo` CommonUsageInfo, required — Credits consumed for this request.
    - `creditsConsumed` number, required

## Other responses

- `400` — RFC9457
- `403` — RFC9457
- `500` — RFC9457
- `502` — RFC9457
- `504` — RFC9457

---

[API](https://skmtc.net/corti/apis/admin-api.md) · [All operations](https://skmtc.net/corti/apis/admin-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/corti/admin-api/revisions/5d1895a1b3fc/schema)
