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

# Quickstart — Coding

> Get a working code prediction in three steps.

Completing this quickstart gets you a working code prediction response from the Medera Coding API. You can then explore the full API and use cases from there.

## Prerequisites

* **A Medera Console account** — sign up at the [Medera Console](https://medera.info/contact).

* **A Developer API Key** — see [Creating Clients](/authentication/creating-clients) to generate one with `read:phi` and `write:phi` scopes for the appropriate project.

<Steps>
  <Step title="Install the SDK">
    Choose the SDK for your stack.

    <CodeGroup>
      ```bash JavaScript theme={"system"}
      npm install @medera/sdk # or pnpm add @medera/sdk 
      ```

      ```bash Python theme={"system"}
      pip install medera 
      ```
    </CodeGroup>
  </Step>

  <Step title="Initialize the client">
    Replace the placeholders with values from your Console.

    <CodeGroup>
      ```typescript JavaScript theme={"system"}
      import { MederaClient } from "@medera/sdk"; const client = new MederaClient({ apiKey: process.env.MEDERA_API_KEY!, baseUrl: "https://api.medera.info", }); 
      ```

      ```python Python theme={"system"}
      from medera import MederaClient import os client = MederaClient(api_key=os.environ["MEDERA_API_KEY"]) 
      ```
    </CodeGroup>

    The SDKs handle token acquisition, refresh, and retries automatically. There is no need to manage bearer tokens manually.
  </Step>

  <Step title="Send a prediction request">
    POST a clinical note (or a `documentId`) to `/api/therapy/suggest-codes`. The `code_systems` field controls which classifications are applied.

    \| Parameter | Type | Required | Description | | :--- | :--- | :--- | :--- | | `code_systems` | `string[]` | Yes | One or more coding systems. Recommended pairs in [Coding Systems](/coding/coding-systems). | | `context` | `object` | Yes | The clinical input: `{ "documentId": "doc_abc" }` or `{ "text": "..." }`. | | `min_confidence` | `number` | No | Filter out predictions below this threshold (default `0.5`). |

    <CodeGroup>
      ```typescript JavaScript theme={"system"}
      const response = await client.coding.suggestCodes({ code_systems: ["icd-10-cm", "cpt"], context: { documentId: "doc_abc" }, min_confidence: 0.7, }); 
      ```

      ```python Python theme={"system"}
      response = client.coding.suggest_codes(code_systems=["icd-10-cm", "cpt"], context={"documentId": "doc_abc"}, min_confidence=0.7,) 
      ```

      ```bash theme={"system"}
      cURL curl -X POST https://api.medera.info/api/therapy/suggest-codes \ -H "X-API-Key: $MEDERA_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "code_systems": ["icd-10-cm", "cpt"], "context": { "documentId": "doc_abc" }, "min_confidence": 0.7 }' 
      ```
    </CodeGroup>
  </Step>

  <Step title="Read the response">
    A successful response returns three top-level fields: - **`codes`** — the model's high-confidence predictions. Each entry includes `code`, `display`, `confidence`, `anchor` (with `documentId`, `span`, and `quote`), and optional `severity_qualifier_suggestions`. - **`candidates`** — lower-confidence codes worth reviewing. - **`usageInfo`** — credits consumed for this request.

    ```json theme={"system"}
    { "codes": [ { "system": "icd-10-cm", "code": "F32.1", "display": "Major depressive disorder, single episode, moderate", "confidence": 0.92, "anchor": { "documentId": "doc_abc", "span": { "start": 412, "end": 489 }, "quote": "Patient reports persistent low mood for 6 weeks..." }, "severity_qualifier_suggestions": ["severe"] }, { "system": "cpt", "code": "90834", "display": "Psychotherapy, 45 minutes", "confidence": 0.95, "anchor": { "documentId": "doc_abc", "span": { "start": 12, "end": 38 }, "quote": "45-minute individual psychotherapy" } } ], "candidates": [ { "system": "icd-10-cm", "code": "Z71.1", "display": "Person with feared complaint in whom no diagnosis is made", "confidence": 0.58 } ], "usageInfo": { "creditsConsumed": 1.0 } } 
    ```
  </Step>

  <Step title="Combine coding systems">
    Most US encounters require more than one coding system. Pass multiple values in `code_systems` — 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`.

    <CodeGroup>
      ```typescript JavaScript theme={"system"}
      const response = await client.coding.suggestCodes({ code_systems: ["icd-10-cm", "cpt", "hcpcs"], context: { documentId: "doc_abc" }, }); 
      ```

      ```python Python theme={"system"}
      response = client.coding.suggest_codes(code_systems=["icd-10-cm", "cpt", "hcpcs"], context={"documentId": "doc_abc"},) 
      ```
    </CodeGroup>

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

## Next steps

<CardGroup cols={3}>
  <Card title="Code Prediction" icon="https://mintcdn.com/medera-357fd587/iC-6rAuwl-0aQSw_/icons/ui/book.svg?fit=max&auto=format&n=iC-6rAuwl-0aQSw_&q=85&s=491b19a75d428ef8cd36d8afc2d3612c" href="/coding/introduction" width="40" height="40" data-path="icons/ui/book.svg">
    Endpoint, supported features, coding system options.
  </Card>

  <Card title="How it works" icon="https://mintcdn.com/medera-357fd587/iC-6rAuwl-0aQSw_/icons/ui/settings.svg?fit=max&auto=format&n=iC-6rAuwl-0aQSw_&q=85&s=d4e5b78d0364e67249682468c3175436" href="/coding/how-it-works" width="40" height="40" data-path="icons/ui/settings.svg">
    Request schema, response fields, evidence spans, filtering.
  </Card>

  <Card title="Use cases" icon="https://mintcdn.com/medera-357fd587/iC-6rAuwl-0aQSw_/icons/ui/briefcase.svg?fit=max&auto=format&n=iC-6rAuwl-0aQSw_&q=85&s=e3d3baf1f1b5e34ef4f39570ffe07db1" href="/coding/encounter-coding" width="40" height="40" data-path="icons/ui/briefcase.svg">
    Encounter coding, CDI review, revenue cycle.
  </Card>
</CardGroup>

<Note>
  Contact us if you need help getting started or run into issues. [medera.info/contact](https://medera.info/contact)
</Note>
