Skip to main content
fill_pa resolves the correct prior-authorization form for a (bin, pcn, state) tuple, stamps patient / prescriber / drug / clinical-answer data onto the template, merges any attached documents (e.g. chart notes) into a single fax-ready PDF, and uploads it to S3. The response includes a short-lived signed URL. Drug metadata (strength, quantity, day supply, route of administration) is assembled server-side from the drug_slug — callers should not pass it directly. Use Search Drugs to resolve a slug. The clinical_questions payload is the decision-tree answer set collected from the UI that renders Get Clinical Questions. It can be a flat {question_id: value} dict or the wrapped export shape {"answers": {...}, "resolved": [...]}. Chart-note attachments are required when the clinical answers imply them (Q1 weight-loss subprompt, Q4 chart notes submitted). If the backend rejects the request for a missing attachment it returns HTTP 400; the SDK raises WorkflowError.

Parameters

NameTypeRequiredDescription
binstringyesPharmacy claim BIN (6 digits).
pcnstringyesProcessor control number from the patient’s insurance card.
statestringyesTwo-letter USPS state code where the prescription will be filled.
member_idstringyesCardholder ID (302-C2).
drug_slugstringyesCanonical drug identifier from Search Drugs (e.g. "wegovy_4mg_tablets").
icd10_diagnosisstringyesICD-10 diagnosis code (e.g. "E66.9").
patientobjectyesPatient demographics. See PatientInfo.
prescriberobjectyesPrescriber information. See PrescriberInfo.
groupstringnoNCPDP Group ID (301-C1). Optional.
form_specific_questionsobjectnoForm-specific answers (e.g. prescription_date). Shape is form-dependent.
clinical_questionsobject or arraynoDecision-tree answers from the PA UI.
documentsarraynoFiles to merge into the filled PDF. Each entry may be a path string or a (filename, bytes) tuple.

PatientInfo

FieldTypeDescription
first_namestringPatient first name.
last_namestringPatient last name.
dobstringDate of birth as MM/DD/YYYY or YYYY-MM-DD.
idstringMember / cardholder ID.
addressstringStreet address (line 1).
citystringCity.
statestringTwo-letter USPS state code.
zipstring5-digit ZIP.
home_phonestringHome phone number.
genderstring"M" or "F".

PrescriberInfo

FieldTypeDescription
first_namestringPrescriber first name.
last_namestringPrescriber last name.
npistringNational Provider Identifier (10 digits).
addressstringOffice address (line 1).
citystringCity.
statestringTwo-letter USPS state code.
zipstring5-digit ZIP.
office_phonestringOffice phone number.

Example

from simplex import (
    CaremarkGlobalPaFormQuestions,
    ClinicalAnswers,
    FillPaResponse,
    PatientInfo,
    PrescriberInfo,
    SimplexClient,
    SimplexError,
)

client = SimplexClient()

PATIENT: PatientInfo = {
    "first_name": "Jordan",
    "last_name": "WHITAKER",
    "dob": "1987-08-22",
    "id": "PSHP8839241076",
    "address": "4412 SE STEELE ST",
    "city": "PORTLAND",
    "state": "OR",
    "zip": "97206",
    "home_phone": "5035550142",
    "gender": "F",
}

PRESCRIBER: PrescriberInfo = {
    "first_name": "Evelyn",
    "last_name": "Harper",
    "npi": "1427389056",
    "address": "2130 NW Lovejoy St, Suite 400",
    "city": "Portland",
    "state": "OR",
    "zip": "97210",
    "office_phone": "5035550318",
}

FORM_SPECIFIC_QUESTIONS: CaremarkGlobalPaFormQuestions = {
    "prescription_date": "04/24/2026",
}

# Wrapped {answers, resolved} payload from the clinical-question UI.
# `answers` drives form-fill decisions; `resolved` is preserved for audit.
CLINICAL_ANSWERS: ClinicalAnswers = {
    "answers": {
        "indication_selector": "wm_adult_injection",
        "wm_adult_injection_phase": "initiation",
        "wm_adult_init_age_18_or_older": "18",
        "wm_adult_init_diet_and_activity": "yes",
        "wm_adult_init_6mo_wm_program": "yes",
        "wm_adult_init_bmi_branch": "bmi_ge_30",
        "wm_adult_init_bmi_value": "30",
    },
    "resolved": [
        {
            "question_id": "indication_selector",
            "prompt": "Which indication is this prior authorization for?",
            "answer_value": "wm_adult_injection",
            "answer_label": "Weight management (Adult) — Wegovy Injection",
        },
        {
            "question_id": "wm_adult_init_bmi_value",
            "prompt": "What is the patient's baseline BMI (kg/m²)?",
            "answer_value": "30",
            "answer_label": "30 kg/m²",
        },
    ],
}

# 1. Resolve drug_slug.
match = client.search_drugs("wegovy 2.4mg auto-injectors")["matches"][0]

# 2. Fill the PA.
try:
    response: FillPaResponse = client.fill_pa(
        bin="004336",
        pcn="ADV",
        state="OR",
        member_id="PSHP8839241076",
        drug_slug=match["slug"],
        icd10_diagnosis="E66.9",
        patient=PATIENT,
        prescriber=PRESCRIBER,
        form_specific_questions=FORM_SPECIFIC_QUESTIONS,
        clinical_questions=CLINICAL_ANSWERS,
        documents=["chart_notes.pdf"],
    )
    print(response["signed_url"])
except SimplexError as e:
    print(f"error: {e}")

Response

{
  "succeeded": true,
  "form_id": "a2d18bab-8e4e-4873-b558-b65958b48400",
  "signed_url": "https://s3.us-west-1.amazonaws.com/simplex-prior-auth-submissions/a2d18bab-.../preview.pdf?...",
  "expires_at": "2026-04-25T06:15:18.958231+00:00"
}
FieldDescription
succeededtrue when the form was filled and uploaded.
form_idUUID for the submission. Also appears in the signed URL.
signed_urlShort-lived HTTPS URL where the filled PDF can be downloaded. Valid for ~24 hours.
expires_atISO-8601 timestamp when signed_url expires.