openapi: 3.0.1
info:
  title: Intake API
  version: '2024-12-10'
  description: >
    This API allows prescribers to send new prescriptions to Gifthealth to be
    filled. This API is intended only for use by prescribers and their software
    vendors.


    {% admonition type="info" %}
      In order to use this API, you must have an active agreement and/or attestation with Gifthealth. If you are interested in using this API, please contact Gifthealth.
    {% /admonition %}
tags:
  - name: Events
    description: >
      Events allow you to receive updates about prescriptions as they move
      through the dispensing process.


      When an important part of the dispensing process happens for a
      prescription, we publish an `Event` to the event feed if there is a
      `Subscription` record with matching demographic and prescription
      information (termed `PrescriptionIdentity`). You don't need to worry about
      creating subscriptions if you use our Intake API to send prescriptions to
      Gifthealth. We automatically create subscriptions for you.


      The events endpoint is stateless, and assumes a single consumer. Events
      are not removed from the events endpoint when they are read.


      Events currently remain visible in the events endpoint indefinitely, but
      this may change in the future. Design your system with the understanding
      that event availability has a limited timeframe.


      You are responsible for tracking the `iterator` value as you process items
      from the queue. You can replay events as needed by resetting the
      `iterator` value to an earlier value.
  - name: Subscriptions
    description: >
      Events are published to your events endpoint when they match a
      `Subscription`. Subscriptions are created in one of two ways:


      1. Subscriptions are automatically created for prescriptions sent to
      Gifthealth through the Intake API.

      2. Subscriptions can be created for prescriptions received via fax or eRx
      using these endpoints. You are responsible for matching Gifthealth events
      to your own prescription records using the prescription's
      `PrescriptionIdentity` attributes.
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Base64-encoded bearer token of value `api_key:api_secret`
  schemas:
    ErrorMap:
      type: object
      additionalProperties:
        type: array
        items:
          type: string
    CollectionMeta:
      type: object
      properties:
        iterator:
          type: string
          nullable: true
        limit:
          type: integer
        done:
          type: boolean
      required:
        - iterator
        - limit
        - done
    Patient:
      type: object
      properties:
        first_name:
          type: string
        middle_name:
          type: string
          nullable: true
        last_name:
          type: string
        dob:
          type: string
          format: date
        gender:
          type: string
          enum:
            - M
            - F
            - 'N'
            - U
        primary_phone:
          type: string
        email:
          type: string
          nullable: true
        address:
          $ref: '#/components/schemas/Address'
      required:
        - first_name
        - last_name
        - dob
        - gender
        - primary_phone
        - address
    Allergy:
      type: object
      properties:
        source_of_information:
          type: string
          enum:
            - C
            - P
            - O
          description: >-
            Indicates where the sender received the allergy information if
            known. `P` for patient or patient representative or personal health
            record (PHR), `C` for clinician or provider, `O` for other source
        effective_date:
          type: string
          format: date
          nullable: true
        adverse_event:
          $ref: '#/components/schemas/AllergyAdverseEvent'
        drug_product:
          $ref: '#/components/schemas/AllergyDrugProduct'
        severity:
          $ref: '#/components/schemas/AllergySeverity'
      required:
        - source_of_information
        - adverse_event
        - drug_product
    AllergyAdverseEvent:
      type: object
      properties:
        text:
          type: string
        code:
          type: string
          description: SNOMED code for the adverse event.
          nullable: true
      required:
        - text
    AllergyDrugProduct:
      type: object
      properties:
        text:
          type: string
        code:
          type: string
          description: SNOMED code for the drug product.
          nullable: true
      required:
        - text
    AllergySeverity:
      type: object
      properties:
        text:
          type: string
        code:
          type: string
          description: SNOMED code for the severity.
          nullable: true
      required:
        - text
    Prescription:
      type: object
      properties:
        external_id:
          type: string
          description: Unique identifier for this prescription, provided by the prescriber
        written_date:
          type: string
          format: date
        number_of_refills:
          type: integer
        substitutions:
          type: integer
          description: >-
            NCPDP Dispense As Written/Product Selection Code. E.g. `0` for `No
            Product Selection Indicated` and `1` for `Substitution Not Allowed
            by Prescriber`
        sig_text:
          type: string
        note:
          type: string
        cancellation_requested_at:
          type: string
          format: date-time
          nullable: true
          description: >-
            A non-null value for this field indicates that the script has been
            flagged for Gifthealth to cancel the prescription as soon as
            possible.
        patient:
          $ref: '#/components/schemas/Patient'
        medication:
          $ref: '#/components/schemas/Medication'
        prescriber:
          $ref: '#/components/schemas/Prescriber'
        pharmacy:
          $ref: '#/components/schemas/Pharmacy'
        allergies:
          type: array
          description: >-
            An empty array indicates `No Known Allergies`. If the patient's
            allergy history is unknown, this will be `null`.
          items:
            $ref: '#/components/schemas/Allergy'
        originating_entity:
          type: string
      required:
        - external_id
        - written_date
        - number_of_refills
        - substitutions
        - patient
        - prescriber
        - medication
        - pharmacy
        - allergies
    Medication:
      type: object
      properties:
        name:
          type: string
        ndc:
          type: string
          description: NDC code for a medication dispensed by Gifthealth.
          enum:
            - '00002015204'
            - '00002024304'
            - '00002121404'
            - '00002134004'
            - '00002142304'
            - '00002200204'
        quantity:
          type: string
          format: decimal
        quantity_unit_code:
          type: string
          description: >-
            NCPDP Quantity Unit of Measure Code. E.g. `C28254` for
            `Milliliters`, `C64933` for `Each`
        days_supply:
          type: integer
          nullable: true
        diagnosis:
          $ref: '#/components/schemas/Diagnosis'
      required:
        - name
        - ndc
        - quantity
        - quantity_unit_code
    Diagnosis:
      type: object
      properties:
        primary_icd10_code:
          type: string
        primary_icd10_description:
          type: string
        secondary_icd10_code:
          type: string
          nullable: true
        secondary_icd10_description:
          type: string
          nullable: true
      required:
        - primary_icd10_code
        - primary_icd10_description
    Prescriber:
      type: object
      properties:
        first_name:
          type: string
        middle_name:
          type: string
          nullable: true
        last_name:
          type: string
        npi:
          type: string
        primary_phone:
          type: string
        fax:
          type: string
          nullable: true
        address:
          $ref: '#/components/schemas/Address'
      required:
        - first_name
        - last_name
        - npi
        - primary_phone
        - address
    Pharmacy:
      type: object
      properties:
        npi:
          type: string
        ncpdpid:
          type: string
        name:
          type: string
        address:
          $ref: '#/components/schemas/Address'
        primary_phone:
          type: string
        fax:
          type: string
          nullable: true
      required:
        - npi
        - ncpdpid
        - name
        - address
        - primary_phone
    Address:
      type: object
      properties:
        address1:
          type: string
        address2:
          type: string
          nullable: true
        city:
          type: string
        state:
          type: string
          description: Two-letter state abbreviation. Fifty US states and DC only.
        zip:
          type: string
          description: Five-digit ZIP code.
      required:
        - address1
        - city
        - state
        - zip
    PublishedEvent:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
          enum:
            - accepted
            - rejected
            - ordered
            - dispensed
            - delivered
          description: >-
            Name of the event that occurred. Additional information specific to
            each event is available in `payload`.
        prescription_identity:
          $ref: '#/components/schemas/PrescriptionIdentity'
        pharmacy_npi:
          type: string
          description: >-
            The NPI of the Gifthealth pharmacy that is managing this
            prescription.
        occurred_at:
          type: string
          format: date_time
          description: The time that the event happened.
        api_version:
          type: string
          description: >-
            The version of the API when this event was published. This is
            specified by the subscription under which the event was published.
            To get events for a newer API version, cancel the existing
            subscription for the script and then create a new one through the
            newer API version.
        subscription_id:
          type: string
          description: The subscription that triggered this event to be published.
        payload:
          description: >-
            Additional information about the event. This will be an empty object
            (`{}`) if there is no additional information for the event type.
          anyOf:
            - $ref: '#/components/schemas/EventRejectedPayload'
            - $ref: '#/components/schemas/EventOrderedPayload'
            - $ref: '#/components/schemas/EventDispensedPayload'
            - $ref: '#/components/schemas/EventDeliveredPayload'
      required:
        - id
        - prescription_identity
        - name
        - api_version
        - pharmacy_npi
        - occurred_at
        - subscription_id
        - payload
    PrescriptionIdentity:
      type: object
      description: >-
        This information should be used to match events to prescriptions as they
        are read from the events endpoint.
      properties:
        patient_first_name:
          type: string
        patient_last_name:
          type: string
        patient_state:
          type: string
        patient_dob:
          type: string
          format: date
        erx_message_id:
          type: string
          nullable: true
        prescriber_npi:
          type: string
        written_date:
          type: string
          format: date
        drug_ndc:
          type: string
      required:
        - patient_first_name
        - patient_last_name
        - patient_state
        - patient_dob
        - prescriber_npi
        - written_date
        - drug_ndc
    EventRejectedPayload:
      type: object
      properties:
        rejection_reasons:
          type: array
          items:
            type: string
      required:
        - rejection_reasons
    EventOrderedPayload:
      type: object
      properties:
        amount_paid_cents:
          type: integer
        amount_paid_currency:
          type: string
        rx_number:
          type: string
          description: >-
            Identifier for the prescription that was ordered, unique per
            `pharmacy_number`.
        fill_number:
          type: integer
          description: The fill number of the fill that was ordered.
      required:
        - amount_paid_cents
        - amount_paid_currency
        - rx_number
        - fill_number
    EventDispensedPayload:
      type: object
      properties:
        shipping_carrier:
          type: string
        shipping_tracking_number:
          type: string
        rx_number:
          type: string
          description: >-
            Identifier for the prescription that was dispensed, unique per
            `pharmacy_number`.
        fill_number:
          type: integer
          description: The fill number of the fill that was dispensed.
      required:
        - shipping_carrier
        - shipping_tracking_number
        - rx_number
        - fill_number
    EventDeliveredPayload:
      type: object
      properties:
        shipping_carrier:
          type: string
        shipping_tracking_number:
          type: string
        rx_number:
          type: string
          description: >-
            Identifier for the prescription that was delivered, unique per
            `pharmacy_number`.
        fill_number:
          type: integer
          description: The fill number of the fill that was delivered.
      required:
        - shipping_carrier
        - shipping_tracking_number
        - rx_number
        - fill_number
    Subscription:
      type: object
      properties:
        id:
          type: string
        backfill_previous_events:
          type: boolean
          nullable: true
          default: true
        api_version:
          type: string
        cancelled_at:
          type: string
          format: date_time
          nullable: true
        prescription_identity:
          $ref: '#/components/schemas/PrescriptionIdentity'
      required:
        - id
        - api_version
        - backfill_previous_events
        - prescription_identity
    PrescriptionIdentityInput:
      type: object
      description: >-
        Details are used to match your prescriptions to Gifthealth
        prescriptions. This information will be included and sent back to you
        for all events so you can match up the events to scripts in your system.
      properties:
        patient_first_name:
          type: string
        patient_last_name:
          type: string
        patient_state:
          type: string
        patient_dob:
          type: string
          format: date
        erx_message_id:
          type: string
          nullable: true
          description: >-
            Unique identifier for the eRx sent to Gifthealth. Although optional,
            including this value allows for a more exact match between
            Gifthealth events and your prescriptions.
        prescriber_npi:
          type: string
          description: 10-digit National Provider Identifier (NPI) for the prescriber.
        written_date:
          type: string
          format: date
        drug_ndc:
          type: string
      required:
        - patient_first_name
        - patient_last_name
        - patient_state
        - patient_dob
        - prescriber_npi
        - written_date
        - drug_ndc
    SubscriptionInput:
      type: object
      properties:
        subscription:
          type: object
          properties:
            backfill_previous_events:
              type: boolean
              nullable: true
              default: true
              description: >-
                Setting this to true will publish any historic events for the
                prescription if the Subscription is created after the
                prescription already has events logged.
            prescription_identity:
              $ref: '#/components/schemas/PrescriptionIdentityInput'
          required:
            - prescription_identity
      required:
        - subscription
    PrescriptionInput:
      type: object
      properties:
        prescription:
          type: object
          properties:
            external_id:
              type: string
              description: >-
                Your unique identifier for this prescription. You will use this
                value to query or cancel individual prescriptions.
            written_date:
              type: string
              format: date
            number_of_refills:
              type: integer
            substitutions:
              type: integer
              description: >-
                NCPDP Dispense As Written/Product Selection Code. E.g. `0` for
                `No Product Selection Indicated` and `1` for `Substitution Not
                Allowed by Prescriber`
            sig_text:
              type: string
            note:
              type: string
            patient:
              $ref: '#/components/schemas/PatientInput'
            medication:
              $ref: '#/components/schemas/MedicationInput'
            prescriber:
              $ref: '#/components/schemas/PrescriberInput'
            pharmacy:
              $ref: '#/components/schemas/PharmacyInput'
            allergies:
              type: array
              description: >-
                An empty array indicates `No Known Allergies`. If the patient's
                allergy history is unknown, pass `null` or omit this key.
              items:
                $ref: '#/components/schemas/AllergyInput'
            originating_entity:
              type: string
          required:
            - external_id
            - written_date
            - number_of_refills
            - substitutions
            - patient
            - medication
            - prescriber
            - pharmacy
      required:
        - prescription
    PatientInput:
      type: object
      properties:
        first_name:
          type: string
        middle_name:
          type: string
          nullable: true
        last_name:
          type: string
        dob:
          type: string
          format: date
          description: Patient date of birth, in format `YYYY-MM-DD`.
        gender:
          type: string
          enum:
            - M
            - F
            - 'N'
            - U
          description: Patient gender assigned at birth.
        address:
          $ref: '#/components/schemas/AddressInput'
        primary_phone:
          type: string
          description: Primary contact phone number for the patient. US phone numbers only.
        email:
          type: string
          nullable: true
      required:
        - first_name
        - last_name
        - dob
        - gender
        - primary_phone
        - address
    AllergyInput:
      type: object
      properties:
        source_of_information:
          type: string
          enum:
            - C
            - P
            - O
          description: >-
            Indicates where the sender received the allergy information if
            known. `P` for patient or patient representative or personal health
            record (PHR), `C` for clinician or provider, `O` for other source
        effective_date:
          type: string
          format: date
          nullable: true
        adverse_event:
          $ref: '#/components/schemas/AllergyAdverseEventInput'
        drug_product:
          $ref: '#/components/schemas/AllergyDrugProductInput'
        severity:
          $ref: '#/components/schemas/AllergySeverityInput'
      required:
        - source_of_information
        - adverse_event
        - drug_product
    AllergyAdverseEventInput:
      type: object
      properties:
        text:
          type: string
        code:
          type: string
          description: SNOMED code for the adverse event.
          nullable: true
      required:
        - text
    AllergyDrugProductInput:
      type: object
      properties:
        text:
          type: string
        code:
          type: string
          description: SNOMED code for the drug product.
          nullable: true
      required:
        - text
    AllergySeverityInput:
      type: object
      properties:
        text:
          type: string
        code:
          type: string
          description: SNOMED code for the severity.
          nullable: true
      required:
        - text
    AddressInput:
      type: object
      properties:
        address1:
          type: string
        address2:
          type: string
          nullable: true
        city:
          type: string
        state:
          type: string
          description: Two-letter state abbreviation. Fifty US states and DC only.
        zip:
          type: string
          description: Five-digit ZIP code.
      required:
        - address1
        - city
        - state
        - zip
    PrescriberInput:
      type: object
      properties:
        first_name:
          type: string
        middle_name:
          type: string
          nullable: true
        last_name:
          type: string
        suffix:
          type: string
          nullable: true
        npi:
          type: string
          description: 10-digit National Provider Identifier (NPI) for the prescriber.
        primary_phone:
          type: string
          description: Primary phone number for the prescriber. US phone numbers only.
        fax:
          type: string
          nullable: true
          description: Fax number for the prescriber. US phone numbers only.
        address:
          $ref: '#/components/schemas/AddressInput'
      required:
        - first_name
        - last_name
        - npi
        - primary_phone
        - address
    PharmacyInput:
      type: object
      properties:
        npi:
          type: string
          enum:
            - '1689411712'
          description: >-
            10-digit National Provider Identifier (NPI) for the receiving
            pharmacy for this prescription. Must be a valid NPI for a
            Gifthealth-managed pharmacy.
        ncpdpid:
          type: string
          enum:
            - '3692539'
          description: >-
            NCPDP ID for the receiving pharmacy for this prescription. Must be a
            valid NCPDP ID for a Gifthealth-managed pharmacy.
        name:
          type: string
        address:
          $ref: '#/components/schemas/AddressInput'
        primary_phone:
          type: string
          description: >-
            Primary contact phone number for the receiving pharmacy. US phone
            numbers only.
        fax:
          type: string
          nullable: true
          description: Fax number for the receiving pharmacy. US phone numbers only.
      required:
        - npi
        - ncpdpid
        - name
        - address
        - primary_phone
    DiagnosisInput:
      type: object
      properties:
        primary_icd10_code:
          type: string
        primary_icd10_description:
          type: string
        secondary_icd10_code:
          type: string
          nullable: true
        secondary_icd10_description:
          type: string
          nullable: true
      required:
        - primary_icd10_code
        - primary_icd10_description
    MedicationInput:
      type: object
      properties:
        name:
          type: string
        ndc:
          type: string
          description: NDC code for a medication dispensed by Gifthealth.
          enum:
            - '00002015204'
            - '00002024304'
            - '00002121404'
            - '00002134004'
            - '00002142304'
            - '00002200204'
        quantity:
          type: string
          format: decimal
        quantity_unit_code:
          type: string
          description: >-
            NCPDP Quantity Unit of Measure Code. E.g. `C28254` for
            `Milliliters`, `C64933` for `Each`
        days_supply:
          type: integer
          nullable: true
        diagnosis:
          $ref: '#/components/schemas/DiagnosisInput'
      required:
        - name
        - ndc
        - quantity
        - quantity_unit_code
servers:
  - url: https://{defaultHost}/intake_api/2024-12-10
    variables:
      defaultHost:
        default: app.gifthealth.com
security:
  - BearerAuth: []
paths:
  /events:
    get:
      summary: Get all events
      operationId: getEvents
      tags:
        - Events
      parameters:
        - name: iterator
          in: query
          required: false
          schema:
            type: string
        - name: limit
          in: query
          required: false
          description: >-
            Maximum number of events to return, anywhere from 1 to 250. Default
            is 250.
          schema:
            type: integer
      responses:
        '200':
          description: Success
          content:
            application/json:
              examples:
                default:
                  value:
                    events:
                      - id: 3d839a57-ce1d-47f3-b8f3-3ebfc74601c2
                        api_version: '2024-12-10'
                        name: rejected
                        occurred_at: '2025-02-25T04:50:46Z'
                        payload:
                          rejection_reasons:
                            - wrong_diagnosis
                            - wrong_medication_form
                        pharmacy_npi: '1689411712'
                        prescription_identity:
                          drug_ndc: '1234567890'
                          erx_message_id: '123456789'
                          patient_dob: '1980-01-01'
                          patient_first_name: Todd
                          patient_last_name: Smith
                          patient_state: CA
                          prescriber_npi: '1231231234'
                          written_date: '2025-02-25'
                        subscription_id: 3d839a57-ce1d-47f3-b8f3-3ebfc74601c2
                    meta:
                      limit: 1
                      iterator: M2Q4MzlhNTctY2UxZC00N2YzLWI4ZjMtM2ViZmM3NDYwMWMy
                      done: true
              schema:
                type: object
                properties:
                  events:
                    type: array
                    items:
                      $ref: '#/components/schemas/PublishedEvent'
                  meta:
                    $ref: '#/components/schemas/CollectionMeta'
        '401':
          description: Unauthorized
          content:
            application/json:
              examples:
                default:
                  value:
                    error: Unauthorized
              schema:
                type: object
                properties:
                  error:
                    type: string
  /events/{id}:
    get:
      summary: Get an event
      operationId: getEvent
      tags:
        - Events
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              examples:
                default:
                  value:
                    event:
                      id: 3d839a57-ce1d-47f3-b8f3-3ebfc74601c2
                      api_version: '2024-12-10'
                      name: rejected
                      occurred_at: '2025-02-25T04:50:46Z'
                      payload:
                        rejection_reasons:
                          - wrong_diagnosis
                          - wrong_medication_form
                      pharmacy_npi: '1689411712'
                      prescription_identity:
                        drug_ndc: '1234567890'
                        erx_message_id: '123456789'
                        patient_dob: '1980-01-01'
                        patient_first_name: Todd
                        patient_last_name: Smith
                        patient_state: CA
                        prescriber_npi: '1231231234'
                        written_date: '2025-02-25'
                      subscription_id: 3d839a57-ce1d-47f3-b8f3-3ebfc74601c2
              schema:
                type: object
                properties:
                  event:
                    $ref: '#/components/schemas/PublishedEvent'
        '401':
          description: Unauthorized
          content:
            application/json:
              examples:
                default:
                  value:
                    error: Unauthorized
              schema:
                type: object
                properties:
                  error:
                    type: string
        '404':
          description: Not found
          content:
            application/json:
              examples:
                default:
                  value:
                    error: Not found
              schema:
                type: object
                properties:
                  error:
                    type: string
  /prescriptions:
    post:
      summary: Send a prescription
      operationId: createPrescription
      tags:
        - Prescriptions
      parameters: []
      responses:
        '201':
          description: Created
          content:
            application/json:
              examples:
                default:
                  value:
                    prescription:
                      external_id: f1b3b1a2-361a-40b3-8089-5a235122e023
                      allergies:
                        - adverse_event:
                            code: '416098002'
                            text: Drug Allergy
                          drug_product:
                            code: 362O9ITL9D
                            text: ACETAMINOPHEN
                          effective_date: '2017-07-03'
                          severity:
                            code: '255604002'
                            text: Mild
                          source_of_information: C
                      cancellation_requested_at: null
                      medication:
                        days_supply: 30
                        diagnosis:
                          primary_icd10_code: J45.909
                          primary_icd10_description: Asthma, unspecified, uncomplicated
                          secondary_icd10_code: null
                          secondary_icd10_description: null
                        name: ZEPBOUND 2.5MG / 0.5ML SOLUTION
                        ndc: '00002015204'
                        quantity: '2.0'
                        quantity_unit_code: C28254
                      note: Please include a syringe
                      number_of_refills: 3
                      originating_entity: Telehealth Co
                      patient:
                        address:
                          address1: 123 Main St
                          address2: Apt 1
                          city: Springfield
                          state: IL
                          zip: '62701'
                        dob: '1980-01-01'
                        email: test@example.com
                        first_name: John
                        gender: M
                        last_name: Doe
                        middle_name: J
                        primary_phone: '+15555555555'
                      pharmacy:
                        address:
                          address1: 789 Elm St
                          address2: null
                          city: Springfield
                          state: IL
                          zip: '62701'
                        fax: '+15135555678'
                        name: Springfield Pharmacy
                        ncpdpid: '3692539'
                        npi: '1689411712'
                        primary_phone: '+15135551234'
                      prescriber:
                        address:
                          address1: 456 Elm St
                          address2: null
                          city: Springfield
                          state: IL
                          zip: '62701'
                        fax: null
                        first_name: Jane
                        last_name: Smith
                        middle_name: null
                        npi: '1234567890'
                        primary_phone: '+15135557390'
                      sig_text: Inject 0.5 ml subcutaneously every week
                      substitutions: 1
                      written_date: '2024-12-10'
              schema:
                type: object
                properties:
                  prescription:
                    $ref: '#/components/schemas/Prescription'
        '400':
          description: Bad request
          content:
            application/json:
              examples:
                default:
                  value:
                    error: Bad request
              schema:
                type: object
                properties:
                  error:
                    type: string
        '401':
          description: Unauthorized
          content:
            application/json:
              examples:
                default:
                  value:
                    error: Unauthorized
              schema:
                type: object
                properties:
                  error:
                    type: string
        '422':
          description: Invalid request
          content:
            application/json:
              examples:
                default:
                  value:
                    errors:
                      medication:
                        - is invalid
                      patient:
                        - can't be blank
                      prescriber:
                        - can't be blank
                      pharmacy:
                        - can't be blank
                      medication.quantity:
                        - can't be blank
              schema:
                type: object
                properties:
                  errors:
                    $ref: '#/components/schemas/ErrorMap'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PrescriptionInput'
            examples:
              default:
                summary: Send a prescription
                value:
                  prescription:
                    external_id: f1b3b1a2-361a-40b3-8089-5a235122e023
                    written_date: '2024-12-10'
                    number_of_refills: 3
                    substitutions: 1
                    sig_text: Inject 0.5 ml subcutaneously every week
                    note: Please include a syringe
                    originating_entity: Telehealth Co
                    medication:
                      name: ZEPBOUND 2.5MG / 0.5ML SOLUTION
                      ndc: '00002015204'
                      quantity: '2.0'
                      quantity_unit_code: C28254
                      days_supply: 30
                      diagnosis:
                        primary_icd10_code: J45.909
                        primary_icd10_description: Asthma, unspecified, uncomplicated
                    prescriber:
                      first_name: Jane
                      last_name: Smith
                      npi: '1234567890'
                      primary_phone: 513-555-7390
                      address:
                        address1: 456 Elm St
                        city: Springfield
                        state: IL
                        zip: '62701'
                    patient:
                      first_name: John
                      middle_name: J
                      last_name: Doe
                      dob: '1980-01-01'
                      gender: M
                      address:
                        address1: 123 Main St
                        address2: Apt 1
                        city: Springfield
                        state: IL
                        zip: '62701'
                      primary_phone: 555-555-5555
                      email: test@example.com
                    pharmacy:
                      npi: '1689411712'
                      ncpdpid: '3692539'
                      name: Springfield Pharmacy
                      primary_phone: 513-555-1234
                      fax: 513-555-5678
                      address:
                        address1: 789 Elm St
                        city: Springfield
                        state: IL
                        zip: '62701'
                    allergies:
                      - source_of_information: C
                        effective_date: '2017-07-03'
                        adverse_event:
                          text: Drug Allergy
                          code: '416098002'
                        drug_product:
                          text: ACETAMINOPHEN
                          code: 362O9ITL9D
                        severity:
                          text: Mild
                          code: '255604002'
  /prescriptions/{external_id}:
    get:
      summary: Get a prescription
      operationId: getPrescription
      tags:
        - Prescriptions
      parameters:
        - name: external_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              examples:
                default:
                  value:
                    prescription:
                      external_id: 80efb1a2-361a-40b3-8089-5a235122e023
                      allergies:
                        - adverse_event:
                            code: '416098002'
                            text: Drug Allergy
                          drug_product:
                            code: 362O9ITL9D
                            text: ACETAMINOPHEN
                          effective_date: '2017-07-03'
                          severity:
                            code: '255604002'
                            text: Mild
                          source_of_information: C
                      cancellation_requested_at: null
                      medication:
                        days_supply: 30
                        diagnosis:
                          primary_icd10_code: J45.909
                          primary_icd10_description: Asthma, unspecified, uncomplicated
                          secondary_icd10_code: null
                          secondary_icd10_description: null
                        name: ZEPBOUND 2.5MG / 0.5ML SOLUTION
                        ndc: '00002015204'
                        quantity: '2.0'
                        quantity_unit_code: C28254
                      note: Please include a syringe
                      number_of_refills: 3
                      originating_entity: Telehealth Co
                      patient:
                        address:
                          address1: 123 Main St
                          address2: Apt 1
                          city: Springfield
                          state: IL
                          zip: '62701'
                        dob: '1980-01-01'
                        email: test@example.com
                        first_name: John
                        gender: M
                        last_name: Doe
                        middle_name: Q
                        primary_phone: '+15135557890'
                      pharmacy:
                        address:
                          address1: 789 Elm St
                          address2: null
                          city: Springfield
                          state: IL
                          zip: '62701'
                        fax: '+15135555678'
                        name: Springfield Pharmacy
                        ncpdpid: '3692539'
                        npi: '1689411712'
                        primary_phone: '+15135551234'
                      prescriber:
                        address:
                          address1: 456 Elm St
                          address2: null
                          city: Springfield
                          state: IL
                          zip: '62701'
                        fax: null
                        first_name: Jane
                        last_name: Smith
                        middle_name: null
                        npi: '1234567890'
                        primary_phone: '+15135557390'
                      sig_text: Inject 0.5 ml subcutaneously every week
                      substitutions: 1
                      written_date: '2024-12-28'
              schema:
                type: object
                properties:
                  prescription:
                    $ref: '#/components/schemas/Prescription'
        '401':
          description: Unauthorized
          content:
            application/json:
              examples:
                default:
                  value:
                    error: Unauthorized
              schema:
                type: object
                properties:
                  error:
                    type: string
        '404':
          description: Not found
          content:
            application/json:
              examples:
                default:
                  value:
                    error: Not found
              schema:
                type: object
                properties:
                  error:
                    type: string
    delete:
      summary: Cancel a prescription
      operationId: cancelPrescription
      tags:
        - Prescriptions
      parameters:
        - name: external_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              examples:
                default:
                  value:
                    prescription:
                      external_id: 80efb1a2-361a-40b3-8089-5a235122e023
                      allergies:
                        - adverse_event:
                            code: '416098002'
                            text: Drug Allergy
                          drug_product:
                            code: 362O9ITL9D
                            text: ACETAMINOPHEN
                          effective_date: '2017-07-03'
                          severity:
                            code: '255604002'
                            text: Mild
                          source_of_information: C
                      cancellation_requested_at: '2024-12-09T00:00:00Z'
                      medication:
                        days_supply: 30
                        diagnosis:
                          primary_icd10_code: J45.909
                          primary_icd10_description: Asthma, unspecified, uncomplicated
                          secondary_icd10_code: null
                          secondary_icd10_description: null
                        name: ZEPBOUND 2.5MG / 0.5ML SOLUTION
                        ndc: '00002015204'
                        quantity: '2.0'
                        quantity_unit_code: C28254
                      note: Please include a syringe
                      number_of_refills: 3
                      originating_entity: Telehealth Co
                      patient:
                        address:
                          address1: 123 Main St
                          address2: Apt 1
                          city: Springfield
                          state: IL
                          zip: '62701'
                        dob: '1980-01-01'
                        email: test@example.com
                        first_name: John
                        gender: M
                        last_name: Doe
                        middle_name: Q
                        primary_phone: '+15135557890'
                      pharmacy:
                        address:
                          address1: 789 Elm St
                          address2: null
                          city: Springfield
                          state: IL
                          zip: '62701'
                        fax: '+15135555678'
                        name: Springfield Pharmacy
                        ncpdpid: '3692539'
                        npi: '1689411712'
                        primary_phone: '+15135551234'
                      prescriber:
                        address:
                          address1: 456 Elm St
                          address2: null
                          city: Springfield
                          state: IL
                          zip: '62701'
                        fax: null
                        first_name: Jane
                        last_name: Smith
                        middle_name: null
                        npi: '1234567890'
                        primary_phone: '+15135557390'
                      sig_text: Inject 0.5 ml subcutaneously every week
                      substitutions: 1
                      written_date: '2024-12-28'
              schema:
                type: object
                properties:
                  prescription:
                    $ref: '#/components/schemas/Prescription'
        '401':
          description: Unauthorized
          content:
            application/json:
              examples:
                default:
                  value:
                    error: Unauthorized
              schema:
                type: object
                properties:
                  error:
                    type: string
        '404':
          description: Not found
          content:
            application/json:
              examples:
                default:
                  value:
                    error: Not found
              schema:
                type: object
                properties:
                  error:
                    type: string
  /subscriptions:
    post:
      summary: Create a subscription
      operationId: createSubscription
      tags:
        - Subscriptions
      parameters: []
      responses:
        '201':
          description: Created
          content:
            application/json:
              examples:
                default:
                  value:
                    subscription:
                      id: ca101492-50c0-4c2f-9014-2dd926183f75
                      api_version: '2024-12-10'
                      backfill_previous_events: true
                      cancelled_at: null
                      prescription_identity:
                        drug_ndc: '1234567890'
                        erx_message_id: '123456789'
                        patient_dob: '1980-01-01'
                        patient_first_name: Todd
                        patient_last_name: Smith
                        patient_state: CA
                        prescriber_npi: '123231321'
                        written_date: '2025-02-25'
              schema:
                type: object
                properties:
                  subscription:
                    $ref: '#/components/schemas/Subscription'
        '400':
          description: Bad request
          content:
            application/json:
              examples:
                default:
                  value:
                    error: Bad request
              schema:
                type: object
                properties:
                  error:
                    type: string
        '401':
          description: Unauthorized
          content:
            application/json:
              examples:
                default:
                  value:
                    error: Unauthorized
              schema:
                type: object
                properties:
                  error:
                    type: string
        '422':
          description: Invalid request
          content:
            application/json:
              examples:
                default:
                  value:
                    errors:
                      prescription_identity:
                        - is invalid
                      prescription_identity.patient_first_name:
                        - can't be blank
                      prescription_identity.patient_dob:
                        - can't be blank
              schema:
                type: object
                properties:
                  errors:
                    $ref: '#/components/schemas/ErrorMap'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubscriptionInput'
            examples:
              default:
                summary: Create a subscription
                value:
                  subscription:
                    backfill_previous_events: true
                    prescription_identity:
                      erx_message_id: '123456789'
                      patient_first_name: Todd
                      patient_last_name: Smith
                      patient_state: CA
                      patient_dob: '1980-01-01'
                      prescriber_npi: '123231321'
                      written_date: '2025-02-25'
                      drug_ndc: '1234567890'
  /subscriptions/{id}:
    get:
      summary: Get a subscription
      operationId: getSubscription
      tags:
        - Subscriptions
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              examples:
                default:
                  value:
                    subscription:
                      id: 3d839a57-ce1d-47f3-b8f3-3ebfc74601c2
                      api_version: '2024-12-10'
                      backfill_previous_events: true
                      cancelled_at: null
                      prescription_identity:
                        drug_ndc: '1234567890'
                        erx_message_id: '123456789'
                        patient_dob: '1980-01-01'
                        patient_first_name: Todd
                        patient_last_name: Smith
                        patient_state: CA
                        prescriber_npi: '1231231234'
                        written_date: '2025-02-25'
              schema:
                type: object
                properties:
                  subscription:
                    $ref: '#/components/schemas/Subscription'
        '401':
          description: Unauthorized
          content:
            application/json:
              examples:
                default:
                  value:
                    error: Unauthorized
              schema:
                type: object
                properties:
                  error:
                    type: string
        '404':
          description: Not found
          content:
            application/json:
              examples:
                default:
                  value:
                    error: Not found
              schema:
                type: object
                properties:
                  error:
                    type: string
    delete:
      summary: Cancel a subscription
      operationId: cancelSubscription
      tags:
        - Subscriptions
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              examples:
                default:
                  value:
                    subscription:
                      id: 3d839a57-ce1d-47f3-b8f3-3ebfc74601c2
                      api_version: '2024-12-10'
                      backfill_previous_events: true
                      cancelled_at: '2024-12-09T00:00:00Z'
                      prescription_identity:
                        drug_ndc: '1234567890'
                        erx_message_id: '123456789'
                        patient_dob: '1980-01-01'
                        patient_first_name: Todd
                        patient_last_name: Smith
                        patient_state: CA
                        prescriber_npi: '1231231234'
                        written_date: '2025-02-25'
              schema:
                type: object
                properties:
                  subscription:
                    $ref: '#/components/schemas/Subscription'
        '401':
          description: Unauthorized
          content:
            application/json:
              examples:
                default:
                  value:
                    error: Unauthorized
              schema:
                type: object
                properties:
                  error:
                    type: string
        '404':
          description: Not found
          content:
            application/json:
              examples:
                default:
                  value:
                    error: Not found
              schema:
                type: object
                properties:
                  error:
                    type: string
