> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corti.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart & First Request

> Get started with the Corti Medical Coding API

<Tip>
  Completing this quickstart will get you a working code prediction response from the Corti Medical Coding API. You can then explore the full API and use cases from there.
</Tip>

## Prerequisites

* **A Corti Console account** — sign up at the [Corti Console](https://console.corti.app/) to get started.
* **An API client** — your tenant name, `clientId`, and `clientSecret` are all found in your API client configuration. See [Creating API clients](https://docs.corti.ai/authentication/creating_clients) to set one up.

<Steps titleSize="h2">
  <Step title="Send a prediction request">
    POST a clinical note to the code prediction endpoint. The `system` field determines which classification is applied.

    <Note>Your environment (`eu` or `us`) is set in your API client — see [Creating API clients](https://docs.corti.ai/authentication/creating_clients).</Note>

    | Parameter | Type       | Required | Description                                                                                                                             |
    | --------- | ---------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------- |
    | `system`  | `string[]` | Yes      | One or more coding systems. Up to 4 per request. See [Coding Systems](/coding/coding-systems) for all options and recommended pairings. |
    | `context` | `object[]` | Yes      | The clinical input to code. Each item is a `text` string or a `documentId` referencing a document stored in Corti.                      |
    | `filter`  | `object`   | No       | Restrict predictions to specific codes or categories. See [Code Prediction](/coding/introduction) for details.                          |

    <CodeGroup>
      ```bash title="JavaScript" theme={null}
      npm install @corti/sdk
      # or
      yarn add @corti/sdk
      # or
      pnpm add @corti/sdk
      ```

      ```bash title="C# .NET" theme={null}
      dotnet add package Corti.Sdk

      # Alternatively, in your .csproj:
      # <PackageReference Include="Corti.Sdk" Version="*" />
      ```
    </CodeGroup>

    <CodeGroup>
      ```ts title="JavaScript" theme={null}
      import { CortiClient } from "@corti/sdk";

      // Replace these with your values
      const CLIENT_ID = "<your-client-id>";
      const CLIENT_SECRET = "<your-client-secret>";
      const ENVIRONMENT = "<eu-or-us>";
      const TENANT = "<your-tenant-name>";

      const client = new CortiClient({
          environment: ENVIRONMENT,
          tenantName: TENANT,
          auth: {
              clientId: CLIENT_ID,
              clientSecret: CLIENT_SECRET,
          },
      });
      ```

      ```csharp title="C# .NET" theme={null}
      using Corti;

      // Replace these with your values
      const string CLIENT_ID = "<your-client-id>";
      const string CLIENT_SECRET = "<your-client-secret>";
      const string ENVIRONMENT = "<eu-or-us>";
      const string TENANT = "<your-tenant-name>";

      var client = new CortiClient(
          tenantName: TENANT,
          environment: ENVIRONMENT,
          auth: CortiClientAuth.ClientCredentials(
              clientId: CLIENT_ID,
              clientSecret: CLIENT_SECRET)
      );
      ```
    </CodeGroup>

    <CodeGroup>
      ```ts title="JavaScript" theme={null}
      const response = await client.codes.predict({
        system: ["icd10cm-inpatient"],
        context: [
          {
            type: "text",
            text: "Discharge Summary: 82-year-old male admitted with acute STEMI, treated with primary PCI to LAD with drug-eluting stent placement. Hospital course complicated by cardiogenic shock requiring vasopressors for 48 hours. Also managed acute on chronic systolic heart failure (EF 25%), type 2 diabetes with peripheral neuropathy, and stage 3 CKD. Discharged to skilled nursing facility on dual antiplatelet therapy, beta blocker, ACE inhibitor, and insulin.",
          },
        ],
      });
      ```

      ```csharp title="C# .NET" theme={null}
      var response = await client.Codes.PredictAsync(new CodesGeneralPredictRequest
      {
          System = [CommonCodingSystemEnum.Icd10CmInpatient],
          Context =
          [
              new CommonTextContext
              {
                  Type = CommonTextContextType.Text,
                  Text = "Discharge Summary: 82-year-old male admitted with acute STEMI, treated with primary PCI to LAD with drug-eluting stent placement. Hospital course complicated by cardiogenic shock requiring vasopressors for 48 hours. Also managed acute on chronic systolic heart failure (EF 25%), type 2 diabetes with peripheral neuropathy, and stage 3 CKD. Discharged to skilled nursing facility on dual antiplatelet therapy, beta blocker, ACE inhibitor, and insulin.",
              },
          ],
      });
      ```

      ```python title="Python" theme={null}
      import requests

      # Replace these with your values
      ENVIRONMENT = "<eu-or-us>"
      TENANT = "<your-tenant-name>"
      TOKEN = "<your-access-token>"

      response = requests.post(
          f"https://api.{ENVIRONMENT}.corti.app/v2/tools/coding/",
          headers={
              "Authorization": f"Bearer {TOKEN}",
              "Tenant-Name": TENANT,
              "Content-Type": "application/json",
          },
          json={
              "system": ["icd10cm-inpatient"],
              "context": [
                  {
                      "type": "text",
                      "text": "Discharge Summary: 82-year-old male admitted with acute STEMI, treated with primary PCI to LAD with drug-eluting stent placement. Hospital course complicated by cardiogenic shock requiring vasopressors for 48 hours. Also managed acute on chronic systolic heart failure (EF 25%), type 2 diabetes with peripheral neuropathy, and stage 3 CKD. Discharged to skilled nursing facility on dual antiplatelet therapy, beta blocker, ACE inhibitor, and insulin.",
                  }
              ],
          },
      )
      response.raise_for_status()
      result = response.json()
      ```

      ```bash title="cURL" theme={null}
      # Replace these with your values
      ENVIRONMENT="<eu-or-us>"
      TENANT="<your-tenant-name>"
      TOKEN="<your-access-token>"

      curl -X POST "https://api.${ENVIRONMENT}.corti.app/v2/tools/coding/" \
        -H "Authorization: Bearer ${TOKEN}" \
        -H "Tenant-Name: ${TENANT}" \
        -H "Content-Type: application/json" \
        -d '{
          "system": ["icd10cm-inpatient"],
          "context": [
            {
              "type": "text",
              "text": "Discharge Summary: 82-year-old male admitted with acute STEMI, treated with primary PCI to LAD with drug-eluting stent placement. Hospital course complicated by cardiogenic shock requiring vasopressors for 48 hours. Also managed acute on chronic systolic heart failure (EF 25%), type 2 diabetes with peripheral neuropathy, and stage 3 CKD. Discharged to skilled nursing facility on dual antiplatelet therapy, beta blocker, ACE inhibitor, and insulin."
            }
          ]
        }'
      ```
    </CodeGroup>

    <Tip>The SDK handles OAuth 2.0 token acquisition and refresh automatically using your `clientId` and `clientSecret` — no need to manage bearer tokens manually.</Tip>
  </Step>

  <Step title="Read the response">
    A successful response returns three top-level fields:

    * **`codes`** — the model's high-confidence predictions. Each entry includes the `code`, a human-readable `display`, `evidences` (the exact passages from the note that support the prediction, with `contextIndex`, `text`, and `start`/`end` character offsets), and `alternatives` (other codes the model considered for the same finding).
    * **`candidates`** — lower-confidence codes worth reviewing. Intended for coder review rather than automatic assignment.
    * **`usageInfo`** — credits consumed for this request.

    ```json theme={null}
    {
    "codes": [
    {
    "system": "icd10cm-outpatient",
    "code": "E11649",
    "display": "Type 2 diabetes mellitus with hypoglycemia without coma",
    "evidences": [
    {
      "contextIndex": 0,
      "text": "occasional mild hypoglycemia",
      "start": 90,
      "end": 118
    }
    ],
    "alternatives": [
    {
      "code": "E1165",
      "display": "Type 2 diabetes mellitus with hyperglycemia"
    }
    ]
    },
    {
    "system": "icd10cm-outpatient",
    "code": "M1711",
    "display": "Primary osteoarthritis, right knee",
    "evidences": [
    {
      "contextIndex": 0,
      "text": "bilateral knee pain consistent with osteoarthritis",
      "start": 174,
      "end": 224
    }
    ]
    }
    ],
    "candidates": [
    {
    "system": "icd10cm-outpatient",
    "code": "Z794",
    "display": "Long-term (current) use of insulin"
    }
    ],
    "usageInfo": {
    "creditsConsumed": 1.5
    }
    }
    ```
  </Step>

  <Step title="Combine coding systems">
    Most US encounters require more than one coding system. Pass multiple values in `system` — for example, pairing ICD-10-CM with CPT for an outpatient visit. The response includes codes from all requested systems in the same `codes` array, each tagged with its `system` value.

    <CodeGroup>
      ```ts title="JavaScript" theme={null}
      const response = await client.codes.predict({
        system: ["icd10cm-outpatient", "cpt"],
        context: [
          {
            type: "text",
            text: "Subjective: 58-year-old male presents for routine diabetes management. HbA1c is 7.2%. Reports occasional mild hypoglycemia. Currently on metformin 1000mg twice daily. Also notes bilateral knee pain worsening over past 3 months.\n\nAssessment and Plan: 1. Type 2 diabetes mellitus — well controlled on current regimen, continue metformin, recheck HbA1c in 3 months. 2. Bilateral knee osteoarthritis — refer to orthopedics, start topical diclofenac. 3. Hypoglycemia episodes — counseled on timing of meals relative to medication.",
          },
        ],
      });
      ```

      ```csharp title="C# .NET" theme={null}
      var response = await client.Codes.PredictAsync(new CodesGeneralPredictRequest
      {
          System = [CommonCodingSystemEnum.Icd10CmOutpatient, CommonCodingSystemEnum.Cpt],
          Context =
          [
              new CommonTextContext
              {
                  Type = CommonTextContextType.Text,
                  Text = "Subjective: 58-year-old male presents for routine diabetes management. HbA1c is 7.2%. Reports occasional mild hypoglycemia. Currently on metformin 1000mg twice daily. Also notes bilateral knee pain worsening over past 3 months.\n\nAssessment and Plan: 1. Type 2 diabetes mellitus — well controlled on current regimen, continue metformin, recheck HbA1c in 3 months. 2. Bilateral knee osteoarthritis — refer to orthopedics, start topical diclofenac. 3. Hypoglycemia episodes — counseled on timing of meals relative to medication.",
              },
          ],
      });
      ```

      ```python title="Python" theme={null}
      import requests

      # Replace these with your values
      ENVIRONMENT = "<eu-or-us>"
      TENANT = "<your-tenant-name>"
      TOKEN = "<your-access-token>"

      response = requests.post(
          f"https://api.{ENVIRONMENT}.corti.app/v2/tools/coding/",
          headers={
              "Authorization": f"Bearer {TOKEN}",
              "Tenant-Name": TENANT,
              "Content-Type": "application/json",
          },
          json={
              "system": ["icd10cm-outpatient", "cpt"],
              "context": [
                  {
                      "type": "text",
                      "text": "Subjective: 58-year-old male presents for routine diabetes management. HbA1c is 7.2%. Reports occasional mild hypoglycemia. Currently on metformin 1000mg twice daily. Also notes bilateral knee pain worsening over past 3 months.\n\nAssessment and Plan: 1. Type 2 diabetes mellitus — well controlled on current regimen, continue metformin, recheck HbA1c in 3 months. 2. Bilateral knee osteoarthritis — refer to orthopedics, start topical diclofenac. 3. Hypoglycemia episodes — counseled on timing of meals relative to medication.",
                  }
              ],
          },
      )
      response.raise_for_status()
      result = response.json()
      ```

      ```bash title="cURL" theme={null}
      # Replace these with your values
      ENVIRONMENT="<eu-or-us>"
      TENANT="<your-tenant-name>"
      TOKEN="<your-access-token>"

      curl -X POST "https://api.${ENVIRONMENT}.corti.app/v2/tools/coding/" \
        -H "Authorization: Bearer ${TOKEN}" \
        -H "Tenant-Name: ${TENANT}" \
        -H "Content-Type: application/json" \
        -d '{
          "system": ["icd10cm-outpatient", "cpt"],
          "context": [
            {
              "type": "text",
              "text": "Subjective: 58-year-old male presents for routine diabetes management. HbA1c is 7.2%. Reports occasional mild hypoglycemia. Currently on metformin 1000mg twice daily. Also notes bilateral knee pain worsening over past 3 months.\n\nAssessment and Plan: 1. Type 2 diabetes mellitus — well controlled on current regimen, continue metformin, recheck HbA1c in 3 months. 2. Bilateral knee osteoarthritis — refer to orthopedics, start topical diclofenac. 3. Hypoglycemia episodes — counseled on timing of meals relative to medication."
            }
          ]
        }'
      ```
    </CodeGroup>

    See [Coding Systems](/coding/coding-systems) for recommended pairings by encounter type.
  </Step>
</Steps>

## Next steps

<Columns cols={3}>
  <Card title="Code Prediction" href="/coding/introduction">
    Learn about the endpoint, supported features, and coding system options.
  </Card>

  <Card title="How it works" href="/coding/how-it-works">
    Understand the request schema, response fields, evidence spans, and filtering options.
  </Card>

  <Card title="Use cases" href="/coding/encounter-coding">
    Encounter coding, CDI review, HCC capture, and revenue cycle workflows.
  </Card>
</Columns>

<Note>Please [contact us](https://help.corti.app) if you need help getting started or run into issues with your first request.</Note>
