Oystehr
eRx
Pharmacy Search

Pharmacy Search

Pharmacy search allows you to find pharmacies by name, address, and specialty. In this guide, we'll cover the basic functionality of pharmacy search as well as a recommended approach for how and when to use pharmacy search in your EHR.

Access Policy

To search for pharmacies, your user needs to have the following access policy:

{
  "rule": [
    {
      "action": "eRx:SearchPharmacy",
      "resource": "eRx:Pharmacy",
    },
  ],
}

Code Examples

Here is an example of how to search for pharmacies.

pharmacy-search-by-name.ts
import Oystehr from '@oystehr/sdk';
 
const osytehr = new Oystehr({
  accessToken: "<your_access_token>",
});
 
const { pharmacies } = await oystehr.erx.searchPharmacies({
  name: 'CVS',
});

Example 200 response:

{
  "data": [
    {
      "id": 5285,
      "name": "CVS",
      "address1": "123 Main St",
      "city": "Anytown",
      "state": "MO",
      "zip": "12345",
      "phone": "555-123-4567",
      "specialties": ["retail"]
    },
  ],
  "metadata": {
    "hasNext": false,
    "hasPrevious": false,
    "total": 1,
    "currentPage": 1,
    "totalPages": 1,
    "pageSize": 10
  }
}