Amazon Pharmacy Filters API
Amazon Pharmacy search filters are returned in the filters object, grouped by their headings on Amazon. The available groups and values depend on the query, language, and device.
To apply filters for an Amazon Pharmacy search, update the rh parameter with an appropriate value from the list below or the filters object. You can also follow a filter's serpapi_link. Department filters (n or n:...) are not supported, because searches are scoped to Amazon Pharmacy.
The API endpoint is https://serpapi.com/search?engine=amazon_pharmacy
Head to the playground for a live and interactive demo.
Common filter values
The following list contains common values for the rh parameter. The filters object contains the available filters for each search, including their names, links, and selected state.
| Filter | rh value |
|---|---|
| FSA or HSA Eligible | p_n_hba_program:17904039011 |
| Brand | p_n_feature_fourteen_browse-bin:19763603011 |
| Generic | p_n_feature_fourteen_browse-bin:19763604011 |
Prime Eligible (only with device: mobile) |
p_g_prime_group:2470955011 |
To apply multiple filters, use , (comma) to separate key:value pairs. For example:p_n_hba_program:17904039011,p_n_feature_fourteen_browse-bin:19763604011 filters for FSA or HSA Eligible and Generic medications.
API examples
Filters overview
{
"filters": {
"fsa_or_hsa_eligible": [
{
"position": 1,
"name": "FSA or HSA Eligible",
"rh": "p_n_hba_program:17904039011",
"link": "https://www.amazon.com/s?k=Levothyroxine&i=amazon-pharmacy&rh=n%3A19763358011%2Cp_n_hba_program%3A17904039011&dc&language=en_US&qid=1794915225&rnid=17904038011&ref=sr_nr_p_n_hba_program_1&ds=v1%3AncdJ4bCj3cdsZQjW5LTs6WvRDxSIKeb5GziDMupAwYU",
"serpapi_link": "https://serpapi.com/search.json?device=desktop&engine=amazon_pharmacy&k=Levothyroxine&language=en_US&rh=p_n_hba_program%3A17904039011"
}
],
"brand_preference": [
{
"position": 1,
"name": "Brand",
"rh": "p_n_feature_fourteen_browse-bin:19763603011",
"link": "https://www.amazon.com/s?k=Levothyroxine&i=amazon-pharmacy&rh=n%3A19763358011%2Cp_n_feature_fourteen_browse-bin%3A19763603011&dc&language=en_US&qid=1794915225&rnid=19763602011&ref=sr_nr_p_n_feature_fourteen_browse-bin_1&ds=v1%3Ayw2PdS0Wh3ThdviSL4h5ZKxL%2BlNHJ8f4xRdMgRYiF7o",
"serpapi_link": "https://serpapi.com/search.json?device=desktop&engine=amazon_pharmacy&k=Levothyroxine&language=en_US&rh=p_n_feature_fourteen_browse-bin%3A19763603011"
},
{
"position": 2,
"name": "Generic",
"rh": "p_n_feature_fourteen_browse-bin:19763604011",
"link": "https://www.amazon.com/s?k=Levothyroxine&i=amazon-pharmacy&rh=n%3A19763358011%2Cp_n_feature_fourteen_browse-bin%3A19763604011&dc&language=en_US&qid=1794915225&rnid=19763602011&ref=sr_nr_p_n_feature_fourteen_browse-bin_2&ds=v1%3AuzCM5TAXEnrbhkjq3C%2BBuQAQJ1FeVcdKsvN%2FNudNr3E",
"serpapi_link": "https://serpapi.com/search.json?device=desktop&engine=amazon_pharmacy&k=Levothyroxine&language=en_US&rh=p_n_feature_fourteen_browse-bin%3A19763604011"
}
]
}
}
JSON structure overview
{
"filters": {
"snake_case name of the filter group (e.g., 'brand_preference')": [
{
"position": "Integer - Position of the filter in its group",
"name": "String - Filter name (e.g., 'Generic')",
"rh": "String - Value for the 'rh' parameter (e.g., 'p_n_feature_fourteen_browse-bin:19763604011')",
"link": "String - Link to the Amazon Pharmacy search with the filter",
"serpapi_link": "String - SerpApi link to the search with the filter",
"used": "Boolean - Whether the filter is applied"
},
...
],
...
}
}