1. Pharmacies
  2. By Chain

Pharmacies

Pharmacies by Chain

Inside Rx provides an endpoint that will return pharmacies found in the region specified by zip code for a given chain. This is ideal in situations where data about a chain's specific locations in a region is desired. An X-API-KEY is used with the pharmacies endpoint to automatically configure metadata for the request. This ensures that pharmacies are associated with the correct group for the provisioned account.

HTTP Request

        GET https://services.insiderx.com/pharmacies/v1/chain HTTP/1.1
Content-Type: application/json
x-api-key: zW7PKpzy6X7UHlI4NymTG8QmYhSlFwVd44xapRCt

      

HTTP Query Params

param Description
limit string (optional) Limits number of retail pharmacies returned to [1...10], defaults to 10.
index string (optional) Starting index position of records returned for pagination, defaults to 0.
zip string Five digit zip code used to specify the region to price in.
chainCode string Unique pharmacy chain identifier.
lat float (optional) Latitude used to calculate distance to the returned pharmacy. Cannot be empty if lng is provided.
lng float (optional) Longitude used to calculate distance to the returned pharmacy. Cannot be empty if lat is provided.

Response Types

Code Description
200 Successful pharmacies returned.
400 Incorrect or missing required parameters.
403 Lack of permissions to use pharmacy service.
404 Zip or chainCode not found, or not covered.
500 Internal server error, something went wrong.

Response Attributes

The following attributes are returned as an object within the response body. Dot notation is used to represent nested objects. Square bracket notation represents items that are nested within an array.

Attribute Description
id string Internal ID used for tracking purposes.
pharmacies[] array Array of Retail Pharmacy Objects that contain data about the returned pharmacies.
pagination object Pagination Object giving information about pagination over returned pharmacies.
statusCode integer (optional) HTTP status code in case of failure.
message string (optional) Error description.
errorCode string (optional) Error Code for validation failures. See Error Codes.

Example CURL Request

        curl https://services.insiderx.com/pharmacies/v1/chain?limit=5&chainCode=CVS&zip=10003&lat=30.478914099999997&lng=-97.76958809999999 \
  -H "Content-Type: application/json" \
  -H "x-api-key: zW7PKpzy6X7UHlI4NymTG8QmYhSlFwVd44xapRCt"

      

Where x-api-key is the private key provided when provisioning an account. The example key above is for demonstration purposes.

Example JSON Response

        {
  "id": "d54c54ad-40be-4305-8a34-0ab44710b90d",
  "pharmacies": [
    {
      "type": "retail",
      "name": "Walgreens #11271",
      "npi": "1902089667",
      "phone": "5125555555",
      "geo": {
        "lat": "31.1231231",
        "lng": "-95.834291"
      },
      "distance": "7.07",
      "address": {
        "street": "1910 W Braker Ln",
        "city": "Austin",
        "state": "TX",
        "zip": "78758"
      }
    },
    {
      "type": "retail",
      "name": "Walgreens #54271",
      "npi": "1902089661",
      "phone": "5125555555",
      "geo": {
        "lat": "31.1231231",
        "lng": "-95.834291"
      },
      "distance": "5.07",
      "address": {
        "street": "11724 Research Blvd",
        "city": "Austin",
        "state": "TX",
        "zip": "78759"
      }
    },
    {
      "type": "retail",
      "name": "Walgreens #11271",
      "npi": "1902089662",
      "phone": "5125555555",
      "geo": {
        "lat": "31.1231231",
        "lng": "-95.834291"
      },
      "distance": "2.63",
      "address": {
        "street": "4501 Guadalupe St",
        "city": "Austin",
        "state": "TX",
        "zip": "78751"
      }
    },
    {
      "type": "retail",
      "name": "Walgreens #11271",
      "npi": "1902089663",
      "phone": "5125555555",
      "geo": {
        "lat": "31.1231231",
        "lng": "-95.834291"
      },
      "distance": "0.45",
      "address": {
        "street": "3921 W Parmer Ln",
        "city": "Austin",
        "state": "TX",
        "zip": "78727"
      }
    },
    {
      "type": "retail",
      "name": "Walgreens #11271",
      "npi": "1902089664",
      "phone": "5125555555",
      "geo": {
        "lat": "31.1231231",
        "lng": "-95.834291"
      },
      "distance": "2.45",
      "address": {
        "street": "2525 W Anderson Ln Bldg 2",
        "city": "Austin",
        "state": "TX",
        "zip": "75749"
      }
    }
  ],
  "pagination": {
    "size": 31,
    "index": 0,
    "limit": 5
  }
}

      

Example JSON Response for Missing or Incorrect Request Data

        {
  "id": "d54c54ad-40be-4305-8a34-0ab44710b90d",
  "message": "Incorrect or missing required parameters.",
  "statusCode": 400,
  "errorCode": "LIMIT_INCORRECT_OR_MISSING"
}

      

Pharmacy Types

The following pharmacy types can be returned.

Code Description
retail Retail A retail pharmacy with a physical store near the Zip code provided.

Response Attribute Objects

Retail Pharmacy Object

Object representing a retail pharmacy with a physical store in the region containing the zip code provided.

Attribute Description
pharmacies[].type string Identifier for the type of pharmacy priced at. See pharmacy types.
pharmacies[].name string Display name of pharmacy.
pharmacies[].npi string Unique pharmacy identifier.
pharmacies[].phone string Phone number of pharmacy.
pharmacies[].geo.lat string Latitude of the pharmacy.
pharmacies[].geo.lng string Longitude of the pharmacy.
pharmacies[].distance string The distance between provided geo coordinates and returned pharmacy. It will be null if lat and lng are not provided.
pharmacies[].address.street string Street address of the pharmacy.
pharmacies[].address.city string City of the pharmacy.
pharmacies[].address.state string State of the pharmacy.
pharmacies[].address.zip string Zip Code of the pharmacy.

Pagination Object

Pagination object to specify the details of the pharmacies found.

Attribute Description
pagination.size integer Total number of pharmacies found in the given zip code's region under a chain.
pagination.index integer Starting index position of records returned out of total records.
pagination.limit integer Maximum number of records returned per response.

Error Codes

Error Code Description
LIMIT_INCORRECT_OR_MISSING HTTP Query parameter limit is invalid.
ZIP_INCORRECT_OR_MISSING Required HTTP Query parameter zip is either missing or invalid.
CHAIN_CODE_INCORRECT_OR_MISSING Required HTTP Query parameter chainCode is either missing or invalid.
INDEX_INCORRECT_OR_MISSING HTTP Query parameter index is invalid.
GEOLOCATION_INCORRECT_OR_MISSING HTTP Query parameter lng or lat is invalid.