API Reference (V1)

Warning: This version of the API is deprecated

Unless you've been told otherwise, please use version 5 of the API, which is documented at: https://demo.rxspark.com/api-reference/v5

Introduction

Welcome to the Hola Doctor Farmacia API Reference. Here you will find details about how to use the Hola Doctor Farmacia API and the endpoints it provides.

Authentication

API calls should be made to the following base URL:

https://demo.rxspark.com/api/v1

Authenticate by including your API key in the headers of each request within a custom header named Api-Key. See the following example using curl:

curl -X POST --header "Api-Key: secret_key"...

Replace secret_key with your Hola Doctor Farmacia API key.


Drug Prices

GET /prices

Find availability and prices for a given drug at pharmacy locations. Search by drug name (or optionally by NDC11 or GCN Sequence Number (GSN) to specify different drug strengths and/or forms). Narrow results down by zip code or pharmacy identifier (NPI) for individual pharmacies.
Parameters
drug_name string (Required if $gsn, $ndc11 not present) Name of the drug to search for.
gsn string (Required if $drug_name, $ndc11 not present) GCN Sequence Number. Use as a more accurate way to search for a drug form / strength.
ndc11 string (Required if $gsn, $drug_name not present) NDC11. Use as a more accurate way to search for a drug form / strength.
npi string (Optional) NPI pharmacy identifier - use to narrow results down to a single pharmacy. Overrides zip code if present in request.
brand_type string (Optional / Default "A") Search for brand name or generic version of drug. Possible values: B = Brand; G = Generic; A = Brand or Generic.
qty int (Optional / Default null) Requested quantity of drug.
zip string Zip code for the search.
Note: Either zip code or lat/long is required. If both are provided, lat/long will take precedence.
latitude string (Optional) Latitude for the search.
longitude string (Optional) Longitude for the search.
num_results string (Optional / Default: 10) Number of pharmacy results to return.
info_language string (Optional / Default: 'en') 2 character language code to specify an alternative language for the returned drug information. Currently only Spanish 'es' is supported.
pretty boolean (Optional / Default: false) Pretty print results (helpful for debugging / testing).
Show/Hide Examples

Create a User

POST /users

Register a user to the site, and return a link to the user's savings card download URL.
Parameters
first_name string (Optional) First name of the user.
last_name string (Optional) Last name of the user.
email string Email address of the user.
password string (Optional) Password of the user.
If password is not provided we will generate a temporary password and the user will be forced to change it upon their first login.
gender string (Optional) Gender of the user.
address_1 string (Optional) Address of the user.
address_2 string (Optional) Additional address information of the user (ex. Suite #, Apt. #, etc.).
city string (Optional) City of the user.
zip string (Optional) Zip code of the user.
phone string (Optional) Main phone number of the user.
mobile_phone string (Optional) Mobile phone number of the user.
insurance string (Optional) Name of user's insurance company.
facebook_id string (Optional) Facebook ID of the user.
aff_ref string (Optional) Referral ID of the referring user.
If aff_ref is not provided, we will not be able to attribute commissions to your partner account.
ref_member_id string (Optional) Member ID (ex. 'RX25') of the referring user, or Ignitor Referral Code (ex. 'IG10'). Overrides 'aff_ref' parameter.
sid string (Optional) Custom sub id data field to facilitate tracking.
drugs array (Optional) Drugs user is taking; keys: 'name', 'form', 'dosage', 'quantity'. See example #2.
suppress_welcome boolean (Optional / Default: false) Suppress the new user welcome email. Cannot be suppressed if password not included in request.
pretty boolean (Optional / Default: false) Pretty print results (helpful for debugging / testing).
Show/Hide Examples

Update User

POST /users/{id}

Update a user
Parameters
hashedEmail string MD5 hash of user's email address (ex. in PHP md5(strtolower($email))).
first_name string (Optional) First name of the user.
last_name string (Optional) Last name of the user.
gender string (Optional) Gender of the user.
address_1 string (Optional) Address of the user.
address_2 string (Optional) Additional address information of the user (ex. Suite #, Apt. #, etc.).
city string (Optional) City of the user.
zip string (Optional) Zip code of the user.
phone string (Optional) Main phone number of the user.
mobile_phone string (Optional) Mobile phone number of the user.
pretty boolean (Optional / Default: false) Pretty print results (helpful for debugging / testing).

Drug Autocomplete

GET /autocomplete

Autocomplete drug names. Provide a partial drug name and get back a list of potential matches.
Parameters
prefix string prefix text (partial or complete name of the drug to search for); minimum 3 characters.
pretty boolean (Optional / Default: false) Pretty print results (helpful for debugging / testing).
Show/Hide Examples

Apple Wallet Card

GET /wallet-card

Download an apple wallet version of the discount card
Parameters
user_id integer (Optional) ID of the user.
member_id string (Optional) Member ID of the user. If a valid user_id is supplied, the user's Member ID will be used. If neither user_id nor member_id is provided, a Member ID will be generated for the user's card.
aff_ref string (Optional) Partner's referral id (Also known as 'aff_id') to allow for white-labeling (if enabled for partner's account)

Apple Wallet Voucher

GET /wallet-voucher

Download an apple wallet version of a discount voucher
Parameters
code string (Required) Voucher code (found in drug price endpoint response data).
member_id string (Optional) Member ID of the user. If member_id is not supplied, a Member ID will be generated for the user's voucher.
aff_ref string (Optional) Partner's referral id (Also known as 'aff_id') to allow for white-labeling (if enabled for partner's account).

Get Drug Info

GET /drug-info

Get information about a drug including description, side effects, dosage information and contraindications.
Parameters
ndc11 string The NDC of the drug for which the drug information is desired.
pretty boolean (Optional / Default: false) Pretty print results (helpful for debugging / testing).
Show/Hide Examples

Convert Drug Codes

GET /drug-codes

Find a drug by various identifiers for use subsquently in the price search endpoint. Only one code may be specified.
Parameters
ndc9 string The National Drug Code (NDC) is a unique product identifier used in the United States for drugs intended for human use.
ndc10 string The National Drug Code (NDC) is a unique product identifier used in the United States for drugs intended for human use.
ndc11 string The National Drug Code (NDC) is a unique product identifier used in the United States for drugs intended for human use.
gtin12 string The GTIN-12 is the only GTIN that can be used in UPC-A barcodes
gtin14 string A uniform grouping of trade items is a standard and stable grouping of identical trade items
nhric string The National Health Related Items Code (NHRIC) is a system for identification and numbering of marketed device packages that is compatible with other numbering systems such as the National Drug Code (NDC) or Universal Product Code (UPC).
nspck string
pin string
upcb string
pretty boolean (Optional / Default: false) Pretty print results (helpful for debugging / testing).
Show/Hide Examples

Send a Voucher

POST /send-voucher

Send a pharmacy voucher to a member via email or SMS. If a member_id is provided, email or phone will be pulled from the member's record. If no member_id is provided, a phone number (for sms) or email address (for email) must be provided and a generic member_id will be issued.
Parameters
couponCode string (Required) Coupon code of voucher to send
Tip: Retrieve the couponCode via the 'Drug Prices' endpoint.
member_id string (Optional) Member ID of member receiving voucher - required if email and phone not provided
type string (Optional) Type of voucher to send (sms/email), defaults to email
phone integer (Optional) Phone number for SMS if member_id omitted
email string (Optional) Email address if member_id omitted

User Drugs

POST /user-drugs

Store list of drugs taken by user. This will overwrite any existing drugs; so send the complete list of drugs each time this endpoint is used.
Parameters
member_id string Member ID of user (required if email not present)
email string Email of user (required if member_id not present)
drugs array Drugs user is taking; keys: 'name', 'form', 'dosage', 'quantity'.

Get Condition Info

GET /conditions

Get information about a condition.
Parameters
name string (At least one of "name", "ICD9", "ICD10", "SNOMEDCT" required) The condition name; if no exact match is found, a list of possible matches will be returned.
icd9 string (At least one of "name", "ICD9", "ICD10", "SNOMEDCT" required) The ICD9 condition identifier.
icd10 string (At least one of "name", "ICD9", "ICD10", "SNOMEDCT" required) The ICD10 condition identifier.
snomedCt string (At least one of "name", "ICD9", "ICD10", "SNOMEDCT" required) The SNOMEDCT condition identifier.
relatedDrugs boolean (Optional / Default: false) Include up to 50 drugs related to the condition.
allConditionNames boolean (Optional / Default: false) Retrieve a list of all valid condition names (does not support '$relatedDrugs' option).
pretty boolean (Optional / Default: false) Pretty print results (helpful for debugging / testing).
Show/Hide Examples

Pharmacies

GET /pharmacies

Search for pharmacies by npi, phone, or by location (various combinations of street_1, street_2, city, state, and zip).
Parameters
npi string NPI of the pharmacy.
phone string Phone of the pharmacy.
street_1 string
street_2 string
city string
state string
zip string
pretty boolean (Optional / Default: false) Pretty print results (helpful for debugging / testing).

Blog

GET /blog

Get blog posts
Parameters
pretty boolean (Optional / Default: false) Pretty print results (helpful for debugging / testing).

Blog Post

GET /blog/{id}

Retrieve a blog post
Parameters
id integer ID of the desired blog post.
pretty boolean (Optional / Default: false) Pretty print results (helpful for debugging / testing).

Privacy Policy

GET /privacy

Program privacy policy
Parameters
pretty boolean (Optional / Default: false) Pretty print results (helpful for debugging / testing).

Terms and Conditions

GET /terms

Program terms and conditions
Parameters
pretty boolean (Optional / Default: false) Pretty print results (helpful for debugging / testing).

Disclaimer

GET /disclaimer

Program disclaimer
Parameters
pretty boolean (Optional / Default: false) Pretty print results (helpful for debugging / testing).

Multiauth

GET /multiauth

Get a token to log a user in. You can pass this token into any URL on the site to auto-log a user in. To pass in the token, you can append ?multiauth=XXXXXXX to any URL. Tokens are valid for 5 minutes, then they expire.
Parameters
user_id integer (Required) ID of the user.
Show/Hide Examples

Delete User

GET /users/delete/{user_id}

Delete user
Parameters
user_id integer ID of the user being requested.
pretty boolean (Optional / Default: false) Pretty print results (helpful for debugging / testing).

Forgot Password

POST /forgot-password

Trigger a password reset email to be sent to a user.
Parameters
email string (Required) email of the user.

Partners - Shop Status

POST /partners/shop-status

Enable / disable your RxSpark Partner Shop
Parameters
enable boolean (Required) 1 to enable the shop, 0 to disable
toggle boolean (Optional / Default: false) Toggle the current setting (will override $enable)
Show/Hide Examples

Partners - Shop Name

GET /partners/shop-name

Get the name of your RxSpark Partner Shop
Show/Hide Examples

Partners - Update Shop Name

POST /partners/shop-name

Update the name of your RxSpark Partner Shop
Parameters
name boolean (Required)
Show/Hide Examples

Partners - Product Status

POST /partners/product-status

Enable / disable a product in your RxSpark Partner Shop
Parameters
product_id int (Required) The product id for the product to be enabled/disabled
enable boolean (Required) 1 to enable the shop, 0 to disable
toggle boolean (Optional / Default: false) Toggle the current setting (will override $enable)
Show/Hide Examples

Partners - Product Categories

GET /partners/product-categories

List product categories
Parameters
pretty boolean (Optional / Default: false) Pretty print results (helpful for debugging / testing).

Partners - Products

GET /partners/products

List the products in your RxSpark Partner Shop
Parameters
title string (Optional / Default: false) Filter products by title
category_id array (Optional / Default: false) Filter products by product category based on provided of category_id values.
Tip: Retrieve a list of product categories and their IDs via the 'Product Categories' endpoint.
condition_id array (Optional / Default: false) Filter products by condition based on provided of ICD10 codes.
Tip: Retrieve ICD10 codes via the 'Conditions' endpoint.
drug_id array (Optional / Default: false) Filter products by drug based on provided of NDC9 codes
promoted boolean (Optional / Default: false) Include promoted products (products from other Advertisers for which you have enabled promotion)
supplementary_images boolean (Optional / Default: false) Include supplementary product images
pretty boolean (Optional / Default: false) Pretty print results (helpful for debugging / testing).
Show/Hide Examples

Partners - Create Product from Shopify

POST /partners/products/from-shopify

Create a product from Shopify product JSON

Partners - Product

GET /partners/products/{product_id}

Get the details of a product in your RxSpark Partner Shop
Parameters
pretty boolean (Optional / Default: false) Pretty print results (helpful for debugging / testing).
Show/Hide Examples

Partners - User

GET /partners/users/{user_id}

Get a user
Parameters
user_id integer ID of the user being requested.
pretty boolean (Optional / Default: false) Pretty print results (helpful for debugging / testing).

Partners - User Transactions

GET /partners/users/{user_id}/transactions

Get transactions for a user
Parameters
user_id integer ID of the user being requested.
pretty boolean (Optional / Default: false) Pretty print results (helpful for debugging / testing).
Show/Hide Examples

Partners - Register Affiliate

POST /partners/affiliate

Register a sub-partner affiliate under your partnership
Parameters
first_name string First name of the user.
last_name string Last name of the user.
email string Email address of the user.
password string (Optional) Password of the user.
If password is not provided we will generate a temporary password and the user will be forced to change it upon their first login. Disregard this field if the user will authenticate via SSO/SAML.
gender string (Optional) Gender of the user.
address_1 string (Optional) Address of the user.
address_2 string (Optional) Additional address information of the user (ex. Suite #, Apt. #, etc.).
city string (Optional) City of the user.
zip string (Optional) Zip code of the user.
phone string (Optional) Main phone number of the user.
mobile_phone string (Optional) Mobile phone number of the user.
sid string (Optional) Custom sub ID field to facilitate tracking (ex. an affiliate ID from your internal system).
sid2 string (Optional) Additional custom sub ID field.
pretty boolean (Optional / Default: false) Pretty print results (helpful for debugging / testing).

Partners - Get Affiliate by Email

GET /partners/affiliate-by-email

Check if a sub-partner affiliate exists under your partnership
Parameters
email string Email address of the user.
pretty boolean (Optional / Default: false) Pretty print results (helpful for debugging / testing).

Webhooks

Los socios Hola Doctor Farmacia tienen disponibles webhooks que les permiten suscribirse a notificaciones push. Éstas contienen información sobre ciertos eventos relacionados con su cuenta.

Events

user.created

Recibir una notificación cuando un usuario referido se registre en Hola Doctor Farmacia

Example Notification Payload:
{
    "type": "user.created",
    "user": {
        "id": 25,
        "first_name": "George",
        "last_name": "Washington III",
        "email": "george@aol.com",
        "gender": null,
        "address_1": "143 Airport Blvd",
        "address_2": "Apt. 92",
        "city": "Mars",
        "state": "NY",
        "zip": "30004",
        "phone": "8052102807",
        "mobile_phone": null,
        "created_at": "2017-04-19 22:31:51",
        "updated_at": "2017-12-07 22:18:39",
        "downloaded_card": 1,
        "sid": "42"
}

user.transaction

Recibir una notificación cuando un usuario referido realice una transacción.

Example Notification Payload:
{
    "type": "user.transaction",
    "user": {
        "member_id": "RX25",
        "total_billed": "108.13",
        "brand_name": "ARMOUR THYROID",
        "generic_name": "THYROID, PORK",
        "transaction_date": "2017-04-06",
        "pharmacy_name": "PEACHTREE PHARMACY",
        "pharmacy_address": "5270 PEACHTREE PKWY STE 114A",
        "pharmacy_city": "PEACHTREE CORNERS",
        "pharmacy_state": "GA",
        "pharmacy_zip": "30092-2508",
        "drug_form": "TABLET"
        "quantity": null,
        "days_supply": null,
        "ndc": null
    }
}