Skip to content
Pharmacies
By Chain

By Chain

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

paramDescription
limitstring (optional) Limits number of retail pharmacies returned to [1...10], defaults to 10.
indexstring (optional) Starting index position of records returned for pagination, defaults to 0.
zipstring Five digit zip code used to specify the region to price in.
chainCodestring Unique pharmacy chain identifier.
latfloat (optional) Latitude used to calculate distance to the returned pharmacy. Cannot be empty if lng is provided.
lngfloat (optional) Longitude used to calculate distance to the returned pharmacy. Cannot be empty if lat is provided.

Response Types

CodeDescription
200Successful pharmacies returned.
400Incorrect or missing required parameters.
403Lack of permissions to use pharmacy service.
404Zip or chainCode not found, or not covered.
500Internal 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.

AttributeDescription
idstring Internal ID used for tracking purposes.
pharmacies[]array Array of Retail Pharmacy Objects that contain data about the returned pharmacies.
paginationobject Pagination Object giving information about pagination over returned pharmacies.
statusCodeinteger (optional) HTTP status code in case of failure.
messagestring (optional) Error description.
errorCodestring (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"
      }
    },
    ...
  ],
  "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.

CodeDescription
retailRetail 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.

AttributeDescription
pharmacies[].typestring Identifier for the type of pharmacy priced at. See pharmacy types.
pharmacies[].namestring Display name of pharmacy.
pharmacies[].npistring Unique pharmacy identifier.
pharmacies[].phonestring Phone number of pharmacy.
pharmacies[].geo.latfloat Latitude of the pharmacy.
pharmacies[].geo.lngfloat Longitude of the pharmacy.
pharmacies[].distancefloat The distance between provided geo coordinates and returned pharmacy. It will be null if lat and lng are not provided.
pharmacies[].address.streetstring Street address of the pharmacy.
pharmacies[].address.citystring City of the pharmacy.
pharmacies[].address.statestring State of the pharmacy.
pharmacies[].address.zipstring Zip Code of the pharmacy.

Pagination Object

Pagination object to specify the details of the pharmacies found.

AttributeDescription
pagination.sizeinteger Total number of pharmacies found in the given zip code’s region under a chain.
pagination.indexinteger Starting index position of records returned out of total records.
pagination.limitinteger Maximum number of records returned per response.

Error Codes

Error CodeDescription
LIMIT_INCORRECT_OR_MISSINGHTTP Query parameter limit is invalid.
ZIP_INCORRECT_OR_MISSINGRequired HTTP Query parameter zip is either missing or invalid.
CHAIN_CODE_INCORRECT_OR_MISSINGRequired HTTP Query parameter chainCode is either missing or invalid.
INDEX_INCORRECT_OR_MISSINGHTTP Query parameter index is invalid.
GEOLOCATION_INCORRECT_OR_MISSINGHTTP Query parameter lng or lat is invalid.