Amazon Pharmacy API
Our Amazon Pharmacy API allows you to scrape medications from Amazon Pharmacy search results and compare their average insurance price, Prime member price, and retail price, including coupon discounts. Results can be narrowed with Amazon's filters, like generic medications only, and are for a US delivery location you can choose by ZIP code.
The API endpoint is https://serpapi.com/search?engine=amazon_pharmacy
Head to the playground for a live and interactive demo.
API parameters
Advanced parameters
delivery_zip
Optional
Parameter defines the five-digit US ZIP code to deliver to (e.g., 02108). Pass it as a string to preserve leading zeroes. Without it, results are for a delivery location in the US.
The delivery information is for the ZIP code. For some locations, like Alaska, Hawaii, and Puerto Rico, Amazon Pharmacy doesn't show details, prices, or delivery information.
s
Optional
Parameter is used for sorting results. Available options:relevancerank - Featured (default)price-asc-rank - Price: Low to Highprice-desc-rank - Price: High to Lowreview-rank - Avg. Customer Reviewdate-desc-rank - Newest Arrivalsexact-aware-popularity-rank - Best Sellers
Amazon Pharmacy returns a different set of results when they're sorted, often a smaller one, and its price order is approximate.
Advanced filters
rh
Optional
Parameter defines how to filter results based on their attributes. The structure is a list of key:value pairs separated by ,.
For example, p_n_feature_fourteen_browse-bin:19763604011 filters for Generic medications.
Head to Amazon Pharmacy Filters for common filter values. Available filters depend on the query, language, and device and are returned in filters. Follow a filter's serpapi_link to apply it.
Department filters (n or n:...) are not supported, because searches are scoped to Amazon Pharmacy.
SerpApi parameters
device
Optional
Parameter defines the device to use to get the results. It can be set to desktop (default) to use a regular browser, tablet to use a tablet browser (currently using iPads), or mobile to use a mobile browser.
no_cache
Optional
Parameter will force SerpApi to fetch the Amazon Pharmacy results even if a cached version is already present. A cache is served only if the query and all parameters are exactly the same. Cache expires after 1h. Cached searches are free, and are not counted towards your searches per month. It can be set to false (default) to allow results from the cache, or true to disallow results from the cache. no_cache and async parameters should not be used together.
async
Optional
Parameter defines the way you want to submit your search to SerpApi. It can be set to false (default) to open an HTTP connection and keep it open until you got your search results, or true to just submit your search to SerpApi and retrieve them later. In this case, you'll need to use our Searches Archive API to retrieve your results. async and no_cache parameters should not be used together. async should not be used on accounts with Ludicrous Speed enabled.
zero_trace
Optional
Enterprise only. Parameter enables ZeroTrace mode. It can be set to false (default) or true. Enable this mode to skip storing search parameters, search files, and search metadata on our servers. This may make debugging more difficult.
output
Optional
Parameter defines the format of the result. It can be set to json (default) to get a structured JSON of the results, html to get the raw HTML retrieved, or md to get a Markdown-formatted version optimized for LLMs and AI agents.
json_restrictor
Optional
Parameter defines the fields you want to include in the output, reducing payload size for faster response. See the JSON Restrictor documentation for more details.
API results
JSON results
JSON output includes structured data for Organic Results, Filters, search_information, and serpapi_pagination.
A search status is accessible through search_metadata.status.
It flows this way: Processing -> Success || Error.
If a search has failed, error will contain an error message.
search_metadata.id is the search ID inside SerpApi.
HTML results
HTML output is useful to debug JSON results or support features not yet supported by SerpApi. It gives you the raw HTML results from Amazon Pharmacy.
Markdown results
Markdown output is optimized for LLMs and AI agents. It provides a curated view of the JSON results
in a token-efficient format using tables, markdown links, and YAML frontmatter.
To access, use the output=md parameter, the /search.md endpoint, or request header Accept: text/markdown.
API examples
Example results for k: Levothyroxine
{
"organic_results": [
{
"position": 1,
"asin": "B08429CF3B",
"title": "Levothyroxine (Generic for Levoxyl, Synthroid, Unithroid)",
"link": "https://pharmacy.amazon.com/LEVOTHYROXINE-50-MCG-TAB/dp/B08429CF3B?ref_=sr_1_1&s=amazon-pharmacy&keywords=Levothyroxine&dib_tag=se&dib=eyJ2IjoiMSJ9.jMYqODqsOrYKydkLODjVU0VTNZ34GaypcPXSl_xOHesHYHOK0psPXqa2BAG3UT_WhZ7AS-IP32hSHd7u57_GiU9CzrwSTHru-tz5I8JEii9y-J4E2q3adUNupAWKyC9xVmBNRJDj0ml8hy7bp4cWaSICOlJDH2zl0bxDrOfCZ3feNhQYZLTweDGZ70zPPYvm16JQibp1VqJMwjamoCR63FOkRkLtG74jXyA0MspwrMY.MzJ6IgOKeELD3KFPjV8XXh7wR20hGubfIlWo7UlR7rk&qid=1794915225&sr=1-1",
"link_clean": "https://pharmacy.amazon.com/LEVOTHYROXINE-50-MCG-TAB/dp/B08429CF3B/",
"thumbnail": "https://m.media-amazon.com/images/I/21jAbapttrL._UY218_.jpg",
"details": [
"Tablet",
"50mcg",
"30 days supply"
],
"form": "Tablet",
"strength": "50mcg",
"supply": "30 days supply",
"badges": [
"Prescription Required"
],
"delivery": [
"FREE delivery"
],
"insurance_estimate": "$2.00",
"extracted_insurance_estimate": 2.0,
"prime_price": "$3.98",
"extracted_prime_price": 3.98,
"retail_price": "$13.50",
"extracted_retail_price": 13.5,
"currency": "USD"
},
{
"position": 2,
"asin": "B08SXX11VK",
"title": "Levothyroxine (Generic for Tirosint)",
"link": "https://pharmacy.amazon.com/LEVOTHYROXINE-75-MCG-CAP/dp/B08SXX11VK?ref_=sr_1_2&s=amazon-pharmacy&keywords=Levothyroxine&dib_tag=se&dib=eyJ2IjoiMSJ9.jMYqODqsOrYKydkLODjVU0VTNZ34GaypcPXSl_xOHesHYHOK0psPXqa2BAG3UT_WhZ7AS-IP32hSHd7u57_GiU9CzrwSTHru-tz5I8JEii9y-J4E2q3adUNupAWKyC9xVmBNRJDj0ml8hy7bp4cWaSICOlJDH2zl0bxDrOfCZ3feNhQYZLTweDGZ70zPPYvm16JQibp1VqJMwjamoCR63FOkRkLtG74jXyA0MspwrMY.MzJ6IgOKeELD3KFPjV8XXh7wR20hGubfIlWo7UlR7rk&qid=1794915225&sr=1-2",
"link_clean": "https://pharmacy.amazon.com/LEVOTHYROXINE-75-MCG-CAP/dp/B08SXX11VK/",
"thumbnail": "https://m.media-amazon.com/images/I/61fJBXO6qqL._UY218_.jpg",
"details": [
"Capsule",
"75mcg",
"30 days supply"
],
"form": "Capsule",
"strength": "75mcg",
"supply": "30 days supply",
"badges": [
"Prescription Required"
],
"delivery": [
"FREE delivery"
],
"insurance_estimate": "$9.00",
"extracted_insurance_estimate": 9.0,
"retail_price": "$118.80",
"extracted_retail_price": 118.8,
"currency": "USD"
}
],
"serpapi_pagination": {
"current": 1,
"next": "https://serpapi.com/search.json?device=desktop&engine=amazon_pharmacy&k=Levothyroxine&language=en_US&page=2"
}
}
Example with page: 2 and s: price-asc-rank
{
"organic_results": [
{
"position": 1,
"asin": "B0846H3GZ2",
"title": "Urea",
"link": "https://pharmacy.amazon.com/UREA-20-CREAM/dp/B0846H3GZ2?ref_=sr_1_17&s=amazon-pharmacy&keywords=cream&dib_tag=se&dib=eyJ2IjoiMSJ9.jBpTPUgtckrrwSGAOo5tPflOoZ8siVSNT3LYty1P1MNR9zy5aEWC4TcRNOA4hadeomlTOsLpnhsAb1JkO_ex6ys3TOuvfQWSjR_pdaqjSp8Xk9bTb9qIOGKx2SJUZZz5k774bl8n5Yp8pc-GAkInTKA5juxM2wdLG4DZzoDJSPetwEkPhLzkESVnweEkE13MxVqkwNhZr7VUF9U2qsQrAZHxdc4NpoOdvP1rRPOclYw.qt-yuMCUvOhFtmAee7VEPfPodRyJw-1fwPMyrkJiUQM&qid=1790277189&sr=1-17",
"link_clean": "https://pharmacy.amazon.com/UREA-20-CREAM/dp/B0846H3GZ2/",
"thumbnail": "https://m.media-amazon.com/images/I/41rBtT8NcnL._UY218_.jpg",
"details": [
"Cream",
"20%",
"30 days supply"
],
"form": "Cream",
"strength": "20%",
"supply": "30 days supply",
"badges": [
"Prescription Required"
],
"delivery": [
"FREE delivery"
],
"insurance_estimate": "$12.00",
"extracted_insurance_estimate": 12.0,
"prime_price": "$12.25",
"extracted_prime_price": 12.25,
"retail_price": "$14.45",
"extracted_retail_price": 14.45,
"currency": "USD"
}
],
"serpapi_pagination": {
"current": 2,
"previous": "https://serpapi.com/search.json?device=desktop&engine=amazon_pharmacy&k=cream&language=en_US&page=1&s=price-asc-rank",
"next": "https://serpapi.com/search.json?device=desktop&engine=amazon_pharmacy&k=cream&language=en_US&page=3&s=price-asc-rank"
}
}
Example with rh parameter
{
"organic_results": [
{
"position": 1,
"asin": "B08429CF3B",
"title": "Levothyroxine (Generic for Levoxyl, Synthroid, Unithroid)",
"link": "https://pharmacy.amazon.com/LEVOTHYROXINE-50-MCG-TAB/dp/B08429CF3B?ref_=sr_1_1&s=amazon-pharmacy&keywords=Levothyroxine&dib_tag=se&dib=eyJ2IjoiMSJ9.jMYqODqsOrYKydkLODjVU0VTNZ34GaypcPXSl_xOHetHV89bHaEU4kcAdwPDafPctxqmVsczAMQuILnkEZ0E9AYguGDdJP2zaeyVTao2zygVhXN3a0evi_1iFDW-5OC1fkQVUutWn29_mKWbjM3L5h_kD5j3IiDh72Kb2py3frl-rAHNBq-1iEWy4FVFSdiwWsfBgr_K96EKnNHrzy3MKg.Orrfr_G2PCiow8wE9w9AKfcMRxCa0xZSoGGu2aPeyQA&qid=1794915230&sr=1-1&refinements=p_n_feature_fourteen_browse-bin%3A19763604011",
"link_clean": "https://pharmacy.amazon.com/LEVOTHYROXINE-50-MCG-TAB/dp/B08429CF3B/",
"thumbnail": "https://m.media-amazon.com/images/I/21jAbapttrL._UY218_.jpg",
"details": [
"Tablet",
"50mcg",
"30 days supply"
],
"form": "Tablet",
"strength": "50mcg",
"supply": "30 days supply",
"badges": [
"Prescription Required"
],
"delivery": [
"FREE delivery"
],
"insurance_estimate": "$2.00",
"extracted_insurance_estimate": 2.0,
"prime_price": "$3.98",
"extracted_prime_price": 3.98,
"retail_price": "$13.50",
"extracted_retail_price": 13.5,
"currency": "USD"
},
{
"position": 2,
"asin": "B08SXX11VK",
"title": "Levothyroxine (Generic for Tirosint)",
"link": "https://pharmacy.amazon.com/LEVOTHYROXINE-75-MCG-CAP/dp/B08SXX11VK?ref_=sr_1_2&s=amazon-pharmacy&keywords=Levothyroxine&dib_tag=se&dib=eyJ2IjoiMSJ9.jMYqODqsOrYKydkLODjVU0VTNZ34GaypcPXSl_xOHetHV89bHaEU4kcAdwPDafPctxqmVsczAMQuILnkEZ0E9AYguGDdJP2zaeyVTao2zygVhXN3a0evi_1iFDW-5OC1fkQVUutWn29_mKWbjM3L5h_kD5j3IiDh72Kb2py3frl-rAHNBq-1iEWy4FVFSdiwWsfBgr_K96EKnNHrzy3MKg.Orrfr_G2PCiow8wE9w9AKfcMRxCa0xZSoGGu2aPeyQA&qid=1794915230&sr=1-2&refinements=p_n_feature_fourteen_browse-bin%3A19763604011",
"link_clean": "https://pharmacy.amazon.com/LEVOTHYROXINE-75-MCG-CAP/dp/B08SXX11VK/",
"thumbnail": "https://m.media-amazon.com/images/I/61fJBXO6qqL._UY218_.jpg",
"details": [
"Capsule",
"75mcg",
"30 days supply"
],
"form": "Capsule",
"strength": "75mcg",
"supply": "30 days supply",
"badges": [
"Prescription Required"
],
"delivery": [
"FREE delivery"
],
"insurance_estimate": "$9.00",
"extracted_insurance_estimate": 9.0,
"retail_price": "$118.80",
"extracted_retail_price": 118.8,
"currency": "USD"
}
]
}
Example with delivery_zip: 02108
The delivery information is for the ZIP code. For some locations, like Alaska, Hawaii, and Puerto Rico, Amazon Pharmacy doesn't show details, prices, or delivery information.
{
"organic_results": [
{
"position": 1,
"asin": "B0846GYP6Y",
"title": "Amoxicillin",
"link": "https://pharmacy.amazon.com/AMOXICILLIN-500-MG-TAB/dp/B0846GYP6Y?ref_=sr_1_1&s=amazon-pharmacy&keywords=amoxicillin&dib_tag=se&dib=eyJ2IjoiMSJ9.QuEzN4hvA6Wau0Bt29D5dIScn7hyLBgzWPm5eLmrFUdjqeDasTurcMIdoldV4RR4d_8Ofri5WIhSoNl7rnTGbQKDbsq99ix_D5rejaOV6-fFCPPmhBH4EsoqAZZs-NJ2ETI3o422gVE9OCxHDZhHbZ1goRsOai58Yff3Nf70Bc9klP-vjJrdiY5Jz5gtKOoAqs6cVwmD0_9XiDC-FbCldEa3h4dJxjmk2ILMut0RCDw._84kR8W5GgCVC-Sl-s7nk7BD3Bxa_TWUS4_V9Rtyavo&qid=1794483420&sr=1-1",
"link_clean": "https://pharmacy.amazon.com/AMOXICILLIN-500-MG-TAB/dp/B0846GYP6Y/",
"thumbnail": "https://m.media-amazon.com/images/I/31Sc8T2DnKL._UY218_.jpg",
"details": [
"Tablet",
"500mg",
"10 days supply"
],
"form": "Tablet",
"strength": "500mg",
"supply": "10 days supply",
"badges": [
"Prescription Required"
],
"delivery": [
"FREE delivery"
],
"insurance_estimate": "$2.00",
"extracted_insurance_estimate": 2.0,
"retail_price": "$5.50",
"extracted_retail_price": 5.5,
"currency": "USD"
},
{
"position": 2,
"asin": "B0846FTSSN",
"title": "Amoxicillin - Clavulanate",
"link": "https://pharmacy.amazon.com/AMOXICILLIN-CLAVULANATE-1000-62-5-TAB/dp/B0846FTSSN?ref_=sr_1_2&s=amazon-pharmacy&keywords=amoxicillin&dib_tag=se&dib=eyJ2IjoiMSJ9.QuEzN4hvA6Wau0Bt29D5dIScn7hyLBgzWPm5eLmrFUdjqeDasTurcMIdoldV4RR4d_8Ofri5WIhSoNl7rnTGbQKDbsq99ix_D5rejaOV6-fFCPPmhBH4EsoqAZZs-NJ2ETI3o422gVE9OCxHDZhHbZ1goRsOai58Yff3Nf70Bc9klP-vjJrdiY5Jz5gtKOoAqs6cVwmD0_9XiDC-FbCldEa3h4dJxjmk2ILMut0RCDw._84kR8W5GgCVC-Sl-s7nk7BD3Bxa_TWUS4_V9Rtyavo&qid=1794483420&sr=1-2",
"link_clean": "https://pharmacy.amazon.com/AMOXICILLIN-CLAVULANATE-1000-62-5-TAB/dp/B0846FTSSN/",
"thumbnail": "https://m.media-amazon.com/images/I/31aBB47PyiL._UY218_.jpg",
"details": [
"Extended Release Tablet",
"1000mg-62.5mg",
"7 days supply"
],
"form": "Extended Release Tablet",
"strength": "1000mg-62.5mg",
"supply": "7 days supply",
"badges": [
"Prescription Required"
],
"delivery": [
"FREE delivery"
],
"insurance_estimate": "$25.00",
"extracted_insurance_estimate": 25.0,
"prime_price": "$104.94",
"extracted_prime_price": 104.94,
"retail_price": "$189.00",
"extracted_retail_price": 189.0,
"currency": "USD"
}
],
"serpapi_pagination": {
"current": 1,
"next": "https://serpapi.com/search.json?delivery_zip=02108&device=desktop&engine=amazon_pharmacy&k=amoxicillin&language=en_US&page=2"
}
}
Example with a misspelled k: metfromin
When Amazon corrects the spelling of the query, the results are for the spelling in search_information.spelling_fix. To get results for the exact spelling, set dc to true.
{
"search_information": {
"total_results": 41,
"query_displayed": "metformin",
"store": "amazon-pharmacy",
"page": 1,
"spelling_fix": "metformin",
"organic_results_state": "Some results for exact spelling but showing fixed spelling"
},
"organic_results": [
{
"position": 1,
"asin": "B0842996SB",
"title": "Metformin",
"link": "https://pharmacy.amazon.com/METFORMIN-850-MG-TAB/dp/B0842996SB?ref_=sr_1_1&s=amazon-pharmacy&keywords=metformin&dib_tag=se&dib=eyJ2IjoiMSJ9.8NziMkvXlyNUpwitsM9nSiwg9zxNBRlACvHum6kqYb1p9T7J7aTMTGkjuxNcvCcWsqD1s_Egu3-yhMBho1oKE_CCyEh7VzXs1fcwNi6kQf4puGdjz_SOoD9uZOWvqMzcdfS6irWehclssSo-XxY-yQaU6IHdwyQC3L5MYrL4q9VRXIM6jRpOytZLMRRPqrRnwu0WcCVKQVLAYET0IRmqU4g6rrUJ2X-5qt5qnkveQaY.-BN2s7D1XUwu3Klgaxaro1ddL3IpEdIFEKR_EBPh_mQ&qid=1794483416&sr=1-1",
"link_clean": "https://pharmacy.amazon.com/METFORMIN-850-MG-TAB/dp/B0842996SB/",
"thumbnail": "https://m.media-amazon.com/images/I/415ok4nNXsL._UY218_.jpg",
"details": [
"Tablet",
"850mg",
"30 days supply"
],
"form": "Tablet",
"strength": "850mg",
"supply": "30 days supply",
"badges": [
"Prescription Required"
],
"delivery": [
"FREE delivery"
],
"insurance_estimate": "$1.00",
"extracted_insurance_estimate": 1.0,
"prime_price": "$4.40",
"extracted_prime_price": 4.4,
"retail_price": "$29.10",
"extracted_retail_price": 29.1,
"currency": "USD"
}
],
"serpapi_pagination": {
"current": 1,
"next": "https://serpapi.com/search.json?device=desktop&engine=amazon_pharmacy&k=metformin&language=en_US&page=2"
}
}
JSON structure overview
{
"search_information": {
"total_results": "Integer - Number of results Amazon reports for the query",
"query_displayed": "String - Query Amazon searched for, which is the corrected spelling when Amazon corrected it",
"store": "String - Amazon store of the results (amazon-pharmacy)",
"page": "Integer - Current page number",
"spelling_fix": "String - Spelling Amazon searched for instead of the query, or suggested for it",
"organic_results_state": "String - Whether the results are for the query or for the spelling fix, or 'Fully empty' when there are no results"
},
"organic_results": [
{
"position": "Integer - Result position",
"asin": "String - Amazon Standard Identification Number",
"title": "String - Medication name",
"link": "String - Product link",
"link_clean": "String - Product link without tracking parameters",
"thumbnail": "String - Product image URL",
"details": [
"String - Medication detail, in Amazon's order of form, strength, and supply (e.g., 'Tablet', '50mcg', '30 days supply'). Products only show the details they have, and Spanish pages leave out the supply"
],
"form": "String - Medication form (e.g., 'Tablet'), when all three details are shown, or two on Spanish pages",
"strength": "String - Medication strength (e.g., '50mcg'), when all three details are shown, or two on Spanish pages",
"supply": "String - Supply the prices are for (e.g., '30 days supply'), when all three details are shown",
"badges": [
"String - Badge (e.g., 'Prescription Required')"
],
"delivery": [
"String - Delivery information (e.g., 'FREE delivery')"
],
"insurance_estimate": "String - Average insurance price, or the lowest price with insurance for some medications (e.g., '$2.00')",
"extracted_insurance_estimate": "Float - Extracted numeric insurance price",
"prime_price": "String - Price for Prime members without insurance (e.g., '$3.98')",
"extracted_prime_price": "Float - Extracted numeric Prime price",
"retail_price": "String - Price without insurance or Prime, including the coupon discount when there's one (e.g., '$13.50')",
"extracted_retail_price": "Float - Extracted numeric retail price",
"old_price": "String - Crossed-out price before the coupon discount",
"extracted_old_price": "Float - Extracted numeric price before the coupon discount",
"currency": "String - Currency of the prices (USD)",
"save_with_insurance_coupon": "String - Coupon discount on the price with insurance and its conditions (e.g., 'Includes up to $100.00 off with coupon if eligible.')",
"save_with_coupon": "String - Coupon discount on the retail price and its conditions (e.g., 'Includes up to $12.15 off with coupon if eligible.')"
},
...
],
"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"
},
...
],
...
},
"serpapi_pagination": {
"current": "Integer - Current page number",
"previous": "String - SerpApi link to the previous page",
"next": "String - SerpApi link to the next page"
}
}