# Create a subscription Endpoint: POST /subscriptions Version: 2024-12-10 Security: BearerAuth ## Request fields (application/json): - `subscription` (object, required) - `subscription.backfill_previous_events` (boolean,null) Setting this to true will publish any historic events for the prescription if the Subscription is created after the prescription already has events logged. - `subscription.prescription_identity` (object, required) 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. - `subscription.prescription_identity.patient_first_name` (string, required) - `subscription.prescription_identity.patient_last_name` (string, required) - `subscription.prescription_identity.patient_state` (string, required) - `subscription.prescription_identity.patient_dob` (string, required) - `subscription.prescription_identity.erx_message_id` (string,null) 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. - `subscription.prescription_identity.prescriber_npi` (string, required) 10-digit National Provider Identifier (NPI) for the prescriber. - `subscription.prescription_identity.written_date` (string, required) - `subscription.prescription_identity.drug_ndc` (string, required) ## Response 201 fields (application/json): - `subscription` (object) - `subscription.id` (string, required) - `subscription.backfill_previous_events` (boolean,null, required) - `subscription.api_version` (string, required) - `subscription.cancelled_at` (string,null) - `subscription.prescription_identity` (object, required) This information should be used to match events to prescriptions as they are read from the events endpoint. - `subscription.prescription_identity.patient_first_name` (string, required) - `subscription.prescription_identity.patient_last_name` (string, required) - `subscription.prescription_identity.patient_state` (string, required) - `subscription.prescription_identity.patient_dob` (string, required) - `subscription.prescription_identity.erx_message_id` (string,null) - `subscription.prescription_identity.prescriber_npi` (string, required) - `subscription.prescription_identity.written_date` (string, required) - `subscription.prescription_identity.drug_ndc` (string, required) ## Response 400 fields (application/json): - `error` (string) ## Response 401 fields (application/json): - `error` (string) ## Response 422 fields (application/json): - `errors` (object)