> ## 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.

# Fill Prior Authorization

> Fill a prior authorization fax form. Provide the patient's plan identifiers (bin, pcn, group, member_id, state), a `drug_slug` (from `/search_drugs`), the `icd10_diagnosis`, plus patient, prescriber, and clinical-question data; the backend looks up the full drug profile (medication_strength, qty, day_supply, directions, route, etc.) from its internal drug catalog, resolves the correct PA form, and fills it. Returns a form ID and a signed URL to preview the filled PDF. Call Submit Prior Authorization with the ID to transmit the fax to the payer.



## OpenAPI

````yaml POST /fill_pa
openapi: 3.0.1
info:
  title: Simplex API
  description: API for browser automation, web scraping, and workflow automation
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.simplex.sh
security:
  - bearerAuth: []
paths:
  /fill_pa:
    post:
      description: >-
        Fill a prior authorization fax form. Provide the patient's plan
        identifiers (bin, pcn, group, member_id, state), a `drug_slug` (from
        `/search_drugs`), the `icd10_diagnosis`, plus patient, prescriber, and
        clinical-question data; the backend looks up the full drug profile
        (medication_strength, qty, day_supply, directions, route, etc.) from its
        internal drug catalog, resolves the correct PA form, and fills it.
        Returns a form ID and a signed URL to preview the filled PDF. Call
        Submit Prior Authorization with the ID to transmit the fax to the payer.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                bin:
                  type: string
                pcn:
                  type: string
                group:
                  type: string
                member_id:
                  type: string
                state:
                  type: string
                drug_slug:
                  type: string
                  description: >-
                    Drug catalog slug (e.g.
                    `ozempic_1_mg_dose_4mg_3ml_pen_injectors`). Use [Search
                    Drugs](/payer-portal-api/fax/search-drugs) to resolve a
                    free-text query to a slug. The backend loads the drug's
                    `medication_strength`, `qty`, `quantity_qualifier`,
                    `day_supply`, `directions_frequency`,
                    `expected_length_therapy`, and `route_of_administration`
                    from the catalog so you don't assemble them yourself.
                icd10_diagnosis:
                  type: string
                  description: ICD-10 diagnosis code (e.g. `E11.9`, `E66.3`).
                patient:
                  $ref: '#/components/schemas/FaxPatient'
                prescriber:
                  $ref: '#/components/schemas/FaxPrescriber'
                form_specific_questions:
                  $ref: '#/components/schemas/FormSpecificQuestions'
                clinical_questions:
                  type: array
                  items:
                    $ref: '#/components/schemas/FaxClinicalAnswer'
                documents:
                  type: array
                  items:
                    type: string
                    format: binary
              required:
                - bin
                - pcn
                - member_id
                - state
                - drug_slug
                - icd10_diagnosis
                - patient
                - prescriber
            encoding:
              patient:
                contentType: application/json
              prescriber:
                contentType: application/json
              clinical_questions:
                contentType: application/json
              documents:
                contentType: application/pdf, image/*
              form_specific_questions:
                contentType: application/json
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaFaxFillFormResponse'
      x-codeSamples:
        - lang: python
          label: Fill Prior Authorization
          source: >-
            import requests

            import json


            url = 'https://api.simplex.sh/fill_pa'

            headers = {
                'X-API-Key': 'your_api_key_here'
            }


            patient = {
                'name': 'Michael Chen',
                'dob': '1985-03-14',
                'id': 'WLR482913057',
                'address': '4200 Cedar Springs Rd',
                'city': 'Dallas',
                'state': 'TX',
                'zip': '75201',
                'home_phone': '214-555-0173',
                'gender': 'M'
            }

            prescriber = {
                'name': 'Ravi Patel',
                'npi': '1528074691',
                'address': '8700 Beverly Blvd Ste 310',
                'city': 'Los Angeles',
                'state': 'CA',
                'zip': '90048',
                'office_phone': '310-555-0142',
                'fax': '310-555-0143',
                'contact_person': 'Lisa Nguyen'
            }

            clinical_questions = [
                {'question_id': 'cont_therapy_q1', 'answer': 'Yes'},
                {'question_id': 'cont_therapy_q3', 'answer': '4 months'},
                {'question_id': 'fda_approved_indication', 'answer': 'Yes'}
            ]


            data = {
                'bin': '003858',
                'pcn': 'A4',
                'group': 'RXINN01',
                'member_id': '4XS00000523646',
                'state': 'CA',
                'drug_slug': 'ozempic_1_mg_dose_4mg_3ml_pen_injectors',
                'icd10_diagnosis': 'E11.9',
                'patient': json.dumps(patient),
                'prescriber': json.dumps(prescriber),
                'clinical_questions': json.dumps(clinical_questions)
            }

            files = [
                ('documents', ('chart_notes.pdf', open('chart_notes.pdf', 'rb'), 'application/pdf')),
                ('documents', ('labs.pdf', open('labs.pdf', 'rb'), 'application/pdf'))
            ]


            response = requests.post(url, headers=headers, data=data,
            files=files)

            result = response.json()

            print(f"Form ID: {result['form_id']}")

            print(f"Preview PDF: {result['signed_url']}")
        - lang: curl
          label: Fill Prior Authorization
          source: |-
            curl -X POST https://api.simplex.sh/fill_pa \
              -H "X-API-Key: your_api_key_here" \
              -F "bin=003858" \
              -F "pcn=A4" \
              -F "group=RXINN01" \
              -F "member_id=4XS00000523646" \
              -F "state=CA" \
              -F "drug_slug=ozempic_1_mg_dose_4mg_3ml_pen_injectors" \
              -F "icd10_diagnosis=E11.9" \
              -F 'patient={"name":"Michael Chen","dob":"1985-03-14","id":"WLR482913057","address":"4200 Cedar Springs Rd","city":"Dallas","state":"TX","zip":"75201","home_phone":"214-555-0173","gender":"M"}' \
              -F 'prescriber={"name":"Ravi Patel","npi":"1528074691","address":"8700 Beverly Blvd Ste 310","city":"Los Angeles","state":"CA","zip":"90048","office_phone":"310-555-0142","fax":"310-555-0143","contact_person":"Lisa Nguyen"}' \
              -F 'clinical_questions=[{"question_id":"cont_therapy_q1","answer":"Yes"},{"question_id":"fda_approved_indication","answer":"Yes"}]' \
              -F "documents=@chart_notes.pdf" \
              -F "documents=@labs.pdf"
components:
  schemas:
    FaxPatient:
      type: object
      properties:
        first_name:
          type: string
        last_name:
          type: string
        dob:
          type: string
          format: date
        id:
          type: string
        address:
          type: string
        city:
          type: string
        state:
          type: string
        zip:
          type: string
        home_phone:
          type: string
        gender:
          type: string
          enum:
            - M
            - F
      required:
        - first_name
        - last_name
        - dob
        - id
        - address
        - city
        - state
        - zip
        - home_phone
        - gender
    FaxPrescriber:
      type: object
      properties:
        first_name:
          type: string
        last_name:
          type: string
        npi:
          type: string
        address:
          type: string
        city:
          type: string
        state:
          type: string
        zip:
          type: string
        office_phone:
          type: string
      required:
        - first_name
        - last_name
        - npi
        - address
        - city
        - state
        - zip
        - office_phone
    FormSpecificQuestions:
      type: object
      properties:
        prescription_date:
          type: string
          format: date
        secondary_icd10:
          type: string
        daw:
          type: string
          enum:
            - 'Y'
            - 'N'
          description: >-
            Dispense As Written — set to `Y` to request brand-only (DAW-1)
            review, `N` to allow generic substitution. Omitting defaults to
            substitution allowed; payers that require an explicit value
            (Caremark) will reject a blank. Only set `Y` when the prescriber has
            a clinical reason to refuse substitution.
        failed_medications:
          type: array
          maxItems: 10
          items:
            type: string
        expedited_urgent_review:
          type: boolean
    FaxClinicalAnswer:
      type: object
      properties:
        question_id:
          type: string
        answer:
          oneOf:
            - type: string
            - type: number
            - type: boolean
            - type: array
              items:
                type: string
      required:
        - question_id
        - answer
    PaFaxFillFormResponse:
      type: object
      properties:
        succeeded:
          type: boolean
        form_id:
          type: string
          format: uuid
        signed_url:
          type: string
          format: url
        expires_at:
          type: string
          format: date-time
      required:
        - succeeded
        - form_id
        - signed_url
  securitySchemes:
    bearerAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Simplex API Key

````