API Documentation
REST Endpoints
SECURITY
We’ve added various security measures in order to secure our platform.
Every request must have two headers:
SECURITY
account-id; // UUID format. This can be obtained from the Integrations screen.
secret; // Secret string. This can be obtained from the Integrations screen.
Creates new patient
Endpoint
Request Fields
external_id | Unique identifier for this patient in your system, which you can reference to create a prescription or refill. |
first_name | First name of the patient. |
last_name | Last name of the patient. |
phone_number | Patient’s contact phone number. Format is +1####### |
birth_date | Date of birth in YYYY-MM-DD format. |
Response Fields
success | Boolean whether the request was processed successfully or not. |
message | Should have the request failed, this gives insight as to why. |
errorCode | Code that describes what happened, if applicable (see below). |
Possible Errors
DUPLICATE_ID | External identifier already exists, most likely this means that the patient has already been created. |
PATIENT_REQUIRED | External identifier is a required field. |
WRONG_DATE_FORMAT | Birth date was specified in the wrong format. Expected format is ‘yyyy-MM-dd’. |
WRONG_PHONE_FORMAT | Phone Number was specified in the wrong format. Expected format is ‘+1####’. |
Example Request
curl --location --request POST
'https://api.precisioncompoundingpharmacy.net/v2/patients/create' \
--header 'Content-Type: application/json' \
--header 'account-id: AAAAAAAAAAAAAAA' \
--header 'secret: XXXXXXXXXX' \
--data-raw '{
"external_id": "MM7",
"first_name": "Mike",
"last_name": "Montana",
"phone_number": "+13051234567",
"birth_date": "1978-05-12"
}'
GET PATIENTS
Endpoint
Request Fields
external_id | Unique identifier for this patient in your system. |
first_name | First name of the patient. |
last_name | Last name of the patient. |
Response Fields
success | Boolean whether the request was processed successfully or not. |
message | Should have the request failed, this gives insight as to why. |
errorCode | Code that describes what happened, if applicable (see below). |
rows | Array containing all the patient objects that satisfy the search. This field will not be included if there are error(s) processing the request. |
Example Request
curl --location --request POST
'https://api.precisioncompoundingpharmacy.net/v2/patients' \
--header 'Content-Type: application/json' \
--header 'account-id: AAAAAAAAAAAAAAA' \
--header 'secret: XXXXXXXXXX' \
--data-raw '{
"external_id": "MM7"
}'
GET PATIENTS BY ID
Endpoint
Request Fields
success | Boolean whether the request was processed successfully or not. |
message | Should have the request failed, this gives insight as to why. |
errorCode | Code that describes what happened, if applicable (see below). |
patient | Object that satisfy the search. This field will not be included if there are error(s) processing the request. |
Example Request
curl --location GET 'https://api.precisioncompoundingpharmacy.net/v2/patients/MM7' \
--header 'account-id: AAAAAAAAAAAAAAA' \
--header 'secret: XXXXXXXXXX' \
CREATE NEW PRESCRIPTION
Endpoint
Request Fields
external_id | ERX identifier, obtained from Surescripts for example. |
reference_id | Your identifier for the order, this can be an internal identification generated by your system such as the order id. |
external_patient_id | Your own patient identifier, specified when the patient was created. This is required. |
doctor_npi | National Provider Identifier of the doctor that prescribed the medication to the patient. You can add this or the correct Doctor’s first_name and last_name. |
doctor_first_name | First name of the doctor that prescribed the medication to the patient. Required when this is a controlled substance. |
doctor_last_name | Last name of the doctor that prescribed the medication to the patient. Required when this is a controlled substance. |
medication_id | UUID of the medication prescribed, this code also specifies the delivery form and strength of the medication. This code is provided by the pharmacy. |
quantity | Amount of the medication prescribed which depends on the delivery form of the item. So for example, if the item_id is tablets, then this is the number of tablets to include in the bottle, if the item_id is a foam, quantity is the number of mL units. |
instructions | Instructions that will be included in the order for the patient to follow. |
shipping_address1 | DEPRECATED Address where the medication will be shipped to. |
shipping_address2 | DEPRECATED Address line 2 (apartment #, etc) where the medication will be shipped to. |
shipping_city | DEPRECATED City where the medication will be shipped to. |
shipping_state | DEPRECATED State where the medication will be shipped to. |
shipping_zip_code | DEPRECATED Zip code where the medication will be shipped to. |
medications | DEPRECATED Array containing the items and quantities in the prescription. |
item_id | DEPRECATED UUID of the item ordered, this code also specifies the delivery form and strength of the medication |
quantity | DEPRECATED Amount of the item ordered which depends on the delivery form of the item. So for example, if the item_id is tablets, then this is the number of tablets to include in the bottle, if the item_id is a foam, quantity is the number of mL units. |
instructions | DEPRECATED Instructions that will be included in the order for the patient to follow. |
Response Fields
success | Boolean whether the request was processed successfully or not. |
message | Should have the request failed, this gives insight as to why. |
errorCode | Code that describes what happened, if applicable (see below). |
Possible Errors
ID_REQUIRED | Either the external_id or reference_id is required. |
PATIENT_REQUIRED | Either the patient_id or external_patient_id is required. |
DOCTOR_REQUIRED | When the prescription is a controlled substance, the doctor first/last name are required fields. |
DUPLICATE_ID | External identifier (or Reference identifier) already exists, most likely this means that the prescription has already been created. |
PATIENT_NOT_FOUND | Patient does not exist. Please check patient_id or external_patient_id. |
Example Request
curl --location --request POST
'https://api.precisioncompoundingpharmacy.net/v2/prescriptions/create' \
--header 'Content-Type: application/json' \
--header 'account-id: AAAAAAAAAAAAAAA' \
--header 'secret: XXXXXXXXXX' \
--data-raw '{
"external_id": "CCITEST01",
"external_patient_id": "MM7",
"doctor_npi": "555",
"doctor_first_name": "TEST",
"doctor_last_name": "TEST",
"medication_id": "507b02b6-05b7-4a17-a99d-aef196ec31c4",
"quantity": 5,
"instructions": "Drink water every two hours."
}'
ASSIGN ID TO PRESCRIPTION
Endpoint
Request Fields
external_id | ERX identifier, obtained from Surescripts for example. |
reference_id | Your identifier for the order, this can be an internal identification generated by your system such as the order id. |
Response Fields
success | Boolean whether the request was processed successfully or not. |
message | Should have the request failed, this gives insight as to why. |
errorCode | Code that describes what happened, if applicable (see below). |
Possible Errors
EXTERNAL_ID_NOT_FOUND | Prescription does not exist. Please check external_id to see if the correct id was specified. |
Example Request
curl --location --request POST
'https://api.precisioncompoundingpharmacy.net/v2/prescriptions/assign' \
--header 'Content-Type: application/json' \
--header 'account-id: AAAAAAAAAAAAAAA' \
--header 'secret: XXXXXXXXXX' \
--data-raw '{
"external_id": "1111222333",
"reference_id": "TEST1"
}'
CANCEL PRESCRIPTION
Cancels an existing prescription so that no more refills can be created. If there is a refill in process, it will be completed unless it is independently canceled.
Endpoint
POST /v2/prescriptions/cancel
Request Fields
prescription_external_id | ERX identifier, obtained from Surescripts for example, specified when the prescription was created. This or prescription_reference_id is required. |
prescription_reference_id | Your identifier for the order, this can be an internal identification generated by your system such as the order id. This or prescription_external_id is required. |
Response Fields
success | Boolean whether the request was processed successfully or not. |
message | Should have the request failed, this gives insight as to why. |
errorCode | Code that describes what happened, if applicable (see below). |
Possible Errors
PRESCRIPTION_ID_REQUIRED | Either the prescription_external_id or prescription_reference_id is required. |
PRESCRIPTION_NOT_FOUND | Prescription does not exist. Please check prescription_reference_id or prescription_external_id. |
ALREADY_CANCELED | The prescription is already canceled, so there is nothing else to do. |
Example Request
curl --location --request POST
'https://api.precisioncompoundingpharmacy.net/v2/prescriptions/cancel' \
--header 'Content-Type: application/json' \
--header 'account-id: AAAAAAAAAAAAAAA' \
--header 'secret: XXXXXXXXXX' \
--data-raw '{
"prescription_external_id": "CCITEST01"
}'
CREATE NEW FILL
Endpoint
Request Fields
refill_external_id | Refill identifier generated by your system. |
refill_reference_id | Refill identifier generated by your system. |
packaging_id | UUID of the packaging to use to ship the order. |
shipping_address1 | Address where the order will be shipped to. |
shipping_address2 | Address line 2 (apartment #, etc) where the order will be shipped to. |
shipping_city | City where the order will be shipped to. |
shipping_state | State where the order will be shipped to. |
shipping_zip_code | Zip code where the order will be shipped to. |
carrier | Name of the carrier preselected for the order packages. Options: “fedex” or “usps”. |
shipping_method | Indicate the service type preselected for the carrier selected used for the order packages. Options for FedEx (carrier = “fedex”): > fedex_first_overnight > fedex_priority_overnight > fedex_standard_overnight > fedex_2_day > fedex_2_day_am > fedex_express_saver Options for USPS (carrier = “usps”): > usps_first_class_mail_flat > usps_first_class_mail_letter > usps_first > usps_parcel_select > usps_priority > usps_first_class_package_international_service > usps_priority_mail_international > usps_media_mail > usps_first_class_mail_international > usps_priority_mail_express_international > usps_priority_express |
prescriptions_external_ids | Array of ERX identifiers, obtained from Surescripts for example, specified when the prescription was created. This or prescriptions_reference_ids is required. |
prescriptions_reference_ids | Array of your identifiers for the order, this can be an internal identification generated by your system such as the order id. This or prescriptions_external_ids is required. |
item_ids | Array of non-controlled items and quantities to include in the order. |
item_id | UUID of the item ordered. This code is provided by the pharmacy. |
quantity | Amount of the item ordered. The unit depends on the item_id provided by the pharmacy. |
internal_notes | Notes that are seen by the pharmacy only. This can be used to communicate anything about the order to the pharmacy, such as “this is a test do not fulfill”, etc. |
prescription_external_id | DEPRECATED ERX identifier, obtained from Surescripts for example, specified when the prescription was created. This or prescription_reference_id is required. |
prescription_reference_id | DEPRECATED Your identifier for the order, this can be an internal identification generated by your system such as the order id. This or prescription_external_id is required. |
Response Fields
success | Boolean whether the request was processed successfully or not. |
message | Should have the request failed, this gives insight as to why. |
errorCode | Code that describes what happened, if applicable (see below). |
Possible Errors
PRESCRIPTION_ID_REQUIRED | Either the prescription_external_id or prescription_reference_id is required. |
REFILL_ID_REQUIRED | The refill_reference_id field is required. |
PRESCRIPTION_NOT_FOUND | Prescription does not exist. Please check prescription_reference_id or prescription_external_id. |
SHIPPING_ADDRESS_MISSING | Patient does not have a shipping address on file, it must be specified. |
Example Request
curl --location --request POST
'https://api.precisioncompoundingpharmacy.net/refills/create' \
--header 'Content-Type: application/json' \
--header 'account-id: AAAAAAAAAAAAAAA' \
--header 'secret: XXXXXXXXXX' \
--data-raw '{
"prescriptions_external_ids": ["CCITEST01"],
"refill_external_id": "TEST11",
"shipping_address1": "123 First",
"shipping_address2": "",
"shipping_city": "City",
"shipping_state": "ST",
"shipping_zip_code": "12345"
}'
CANCEL FILL
Endpoint
Request Fields
refill_reference_id | Refill identifier generated by your system. |
Response Fields
success | Boolean whether the request was processed successfully or not. |
message | Should have the request failed, this gives insight as to why. |
errorCode | Code that describes what happened, if applicable (see below). |
Possible Errors
REFILL_ID_REQUIRED | The refill_reference_id field is required. |
REFILL_NOT_FOUND | The fill does not exist. Please check the refill_reference_id field. |
REFILL_ALREADY_SHIPPED | The fill cannot be canceled as it has already shipped or had been delivered. |
Example Request
curl --location --request POST
'https://api.precisioncompoundingpharmacy.net/v2/fills/cancel' \
--header 'Content-Type: application/json' \
--header 'account-id: AAAAAAAAAAAAAAA' \
--header 'secret: XXXXXXXXXX' \
--data-raw '{
"refill_reference_id": "CCITEST01"
}'
Webhooks
SECURITY
How this is verified is easier explained with code. Here we provide an example with Node:
SECURITY
account-id; // UUID format. This can be obtained from the Integrations screen.
secret; // Secret string. This can be obtained from the Integrations screen.
RECEIVED EVENT
Parameters
test | Indicates whether if this is a test or real production transaction. |
type | Identifies the type of event being notified, this being “received”. |
external_id | Transaction identification that was sent to us (this is an id you use to reference the transaction) when creating the prescription. |
reference_id | Transaction identification that was sent to us (this is an id you use to reference the transaction) when creating the prescription. |
patient_first_name | Patient’s first name as written in the e-prescription sent by the doctor. |
patient_last_name | Patient’s last name as written in the e-prescription sent by the doctor. |
patient_birth_date | Patient’s date of birth. Format is YYYY-MM-DD. |
doctor_npi | NPI (National Provider Identifier) of the doctor that ordered the prescription. |
doctor_first_name | First name of the doctor that ordered the prescription. |
doctor_last_name | Last name of the doctor that ordered the prescription. |
doctor_address | Doctor’s physical address registered in the e-prescription system. |
WARNING EVENT
Parameters
test | Indicates whether if this is a test or real production transaction. |
type | Identifies the type of event being notified, this being “warning”. |
event_for | What type of transaction the warning is for. This can be “prescription” or “fill”. |
prescription_external_id | Transaction identification that was sent to us (this is an id you use to reference the transaction) when creating the prescription. |
prescription_reference_id | Transaction identification that was sent to us (this is an id you use to reference the transaction) when creating the prescription. |
fill_external_id | Transaction identification that was sent to us (this is an id you use to reference the transaction) when creating the fill. |
fill_reference_id | Transaction identification that was sent to us (this is an id you use to reference the transaction) when creating the fill. |
first_fill_date | When the reason_code is 1140 (Controlled substance too soon), we will send back the date that the prescription will be able to be filled. |
reason_code > 1010 > 1020 > 1030 > 1040 > 1050 > 1060 > 1070 > 1080 > 1090 > 1100 > 1110 > 1120 > 1130 > 1140 > 1150 > 1160 > 2010 | Indicates the reason why the warning flag was raised for this order, these include: > Quantity verification (for prescription) > Drug verification (for prescription) > Direction verification (for prescription) > Patient shipping address verification (for fill) > Patient allergies needed (for prescription) > Patient name clarification (for prescription) > Patient DOB clarification (for prescription) > Drug interaction detected (for prescription) > Duplicate prescription received (for prescription) > Strength verification (for prescription) > Dosage form verification (for prescription) > Device verification (for prescription) > Request shipping method (for fill) > Controlled substance too soon (for prescription) > Prescription requires code (for prescription) > Fax not legible (for prescription) > Problem delivering package (for fill) |
SHIPPED EVENT
Parameters
test | Indicates whether if this is a test or real production transaction. |
type | Identifies the type of event being notified, this being “shipped”. |
fill_external_id | Transaction identification that was sent to us (this is an id you use to reference the transaction) when creating the fill. |
fill_reference_id | Transaction identification that was sent to us (this is an id you use to reference the transaction) when creating the fill. |
prescription_external_id | Transaction identification that was sent to us (this is an id you use to reference the transaction) when creating the prescription. |
prescription_reference_id | Transaction identification that was sent to us (this is an id you use to reference the transaction) when creating the prescription. |
total_packages | Total number of packages that this order is comprised of. When this is greater than 1, the order will be shipped in more than one physical package. |
package_number | Package number out of the total packages that the tracking number applies to. |
carrier | Name of the carrier that was used to ship the order. That is FedEx, USPS or UPS. |
tracking_number | Tracking number for the specified package. |
ESTIMATED DELIVERY EVENT
Parameters
test | Indicates whether if this is a test or real production transaction. |
type | Identifies the type of event being notified, this being “estimate”. |
fill_external_id | Transaction identification that was sent to us (this is an id you use to reference the transaction) when creating the fill. |
fill_reference_id | Transaction identification that was sent to us (this is an id you use to reference the transaction) when creating the fill. |
prescription_external_id | Transaction identification that was sent to us (this is an id you use to reference the transaction) when creating the prescription. |
prescription_reference_id | Transaction identification that was sent to us (this is an id you use to reference the transaction) when creating the prescription. |
total_packages | Total number of packages that this order is comprised of. When this is greater than 1, the order will be shipped in more than one physical package. |
package_number | Package number out of the total packages that the tracking number applies to. |
carrier | Name of the carrier that was used to ship the order. That is FedEx, USPS or UPS. |
tracking_number | Tracking number for the specified package. |
DELIVERED EVENT
Parameters
test | Indicates whether if this is a test or real production transaction. |
type | Identifies the type of event being notified, this being “delivered”. |
fill_external_id | Transaction identification that was sent to us (this is an id you use to reference the transaction) when creating the fill. |
fill_reference_id | Transaction identification that was sent to us (this is an id you use to reference the transaction) when creating the fill. |
prescription_external_id | Transaction identification that was sent to us (this is an id you use to reference the transaction) when creating the prescription. |
prescription_reference_id | Transaction identification that was sent to us (this is an id you use to reference the transaction) when creating the prescription. |