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

# Overview

> Getting started with the Prior Auth SDK.

The Prior Auth SDK is a high-level wrapper around the Simplex Prior Auth API. It resolves payer clinical question sets, fills fax PA forms, and transmits them — all without you having to know which line of business a patient's BIN/PCN maps to.

## Installation

<Tabs>
  <Tab title="Python">
    ```bash theme={null}
    pip install simplex
    ```
  </Tab>

  <Tab title="TypeScript">
    ```bash theme={null}
    npm install simplex-ts
    ```
  </Tab>
</Tabs>

## Quick Start

The minimal fax-PA workflow is two calls: resolve the canonical drug string, then pull the payer-specific clinical question set for that drug and diagnosis.

### 1. Search drugs

Resolve a free-text query (e.g. `"wegovy 1mg"`) into the canonical `Brand Strength Form` string expected by `drug_info.medication_strength` on [Fill Prior Authorization](/payer-portal-api/fax/fill-pa). The supported catalog currently covers Wegovy, Ozempic, Zepbound, and Mounjaro (all SKUs).

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    from simplex import SimplexClient

    client = SimplexClient()

    matches = client.search_drugs(query="wegovy 1mg")
    for m in matches:
        print(m["full_name"])
    ```
  </Tab>

  <Tab title="TypeScript">
    ```typescript theme={null}
    import { SimplexClient } from "simplex-ts";

    const client = new SimplexClient();

    const matches = await client.searchDrugs({ query: "wegovy 1mg" });
    for (const m of matches) {
      console.log(m.fullName);
    }
    ```
  </Tab>
</Tabs>

### 2. Get clinical questions

Pass the pharmacy claim's `(bin, state, drug_name, icd_code)` tuple to pin down the line of business and indication. `pcn`, `group_id`, and `member_id` are optional tiebreakers for shared-processor BINs (e.g. BIN `003858` / PCN `A4` hosts both ESI Commercial and Humana Part D — the leading alpha prefix of `member_id` disambiguates).

Each returned question carries a structured `citation` back to the underlying payer policy (URL, policy ID, section, verbatim quote), so you can show reviewers the source.

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    from simplex import SimplexClient, SimplexError

    client = SimplexClient()

    try:
        response = client.get_clinical_questions(
            bin="003858",
            state="CA",
            drug_name="wegovy",
            icd_code="E66.01",
            pcn="A4",
            member_id="4XS1234567",
        )

        print("matched:", response.get("matched"))
        print("coverage_status:", response.get("coverage_status"))
        print("lob_id:", response.get("lob_id"))

        routing = response.get("routing") or {}
        print(f"PBM: {routing.get('pbm_name')}")
        print(f"LOB: {routing.get('line_of_business')}")
        print(f"Plan/Group: {routing.get('plan_name_or_group')}")
        print(f"Confidence: {routing.get('confidence')}")

        for i, q in enumerate(response.get("questions") or [], 1):
            req = "required" if q.get("required") else "optional"
            print(f"{i}. [{q.get('input_type')}, {req}] {q.get('prompt')}")
            citation = q.get("citation")
            if citation:
                print(
                    f"   ↳ {citation.get('policy_id')} "
                    f"§{citation.get('section')} "
                    f"({citation.get('effective_date')})"
                )
    except SimplexError as e:
        print(f"Simplex error: {e}")
    ```
  </Tab>

  <Tab title="TypeScript">
    ```typescript theme={null}
    import { SimplexClient, SimplexError } from "simplex-ts";

    const client = new SimplexClient();

    try {
      const response = await client.getClinicalQuestions({
        bin: "003858",
        state: "CA",
        drugName: "wegovy",
        icdCode: "E66.01",
        pcn: "A4",
        memberId: "4XS1234567",
      });

      console.log("matched:", response.matched);
      console.log("coverage_status:", response.coverageStatus);
      console.log("lob_id:", response.lobId);

      const { routing } = response;
      console.log(`PBM: ${routing?.pbmName}`);
      console.log(`LOB: ${routing?.lineOfBusiness}`);
      console.log(`Plan/Group: ${routing?.planNameOrGroup}`);
      console.log(`Confidence: ${routing?.confidence}`);

      (response.questions ?? []).forEach((q, i) => {
        const req = q.required ? "required" : "optional";
        console.log(`${i + 1}. [${q.inputType}, ${req}] ${q.prompt}`);
        if (q.citation) {
          console.log(
            `   ↳ ${q.citation.policyId} §${q.citation.section} ` +
              `(${q.citation.effectiveDate})`
          );
        }
      });
    } catch (e) {
      if (e instanceof SimplexError) {
        console.error(`Simplex error: ${e.message}`);
      }
    }
    ```
  </Tab>
</Tabs>

## Next steps

* [Fill Prior Authorization](/payer-portal-api/fax/fill-pa) — fill a fax PA form with the patient/prescriber/drug data plus answers to the clinical questions returned above
* [Submit Prior Authorization](/payer-portal-api/fax/submit-pa) — transmit the filled form to the payer
* [Check Status](/payer-portal-api/fax/check-status) — poll a submitted PA for its current status
