Before getting started, request an API key. Please review our terms of use before deploying API integration to avoid any unexpected account issues.
API V2 Documentation
Detailed information about GoodRx API V2 can be found here.
API Errors
All responses from the GoodRx API will include two parameters, errors and success, defining the response state. The HTTP Status header will reflect the information within the content.
-
success
- Boolean of whether the desired action was achieved -
errors
- List of errors or warnings raised during the action
Responses to V2 API requests have a different response format, and can be seen here.
Request Authentication and Signing
All requests must have an API key and be signed using a private key. By adding a signature to your API request we can verify that it is actually you making the request and not an unauthorized agent using your API key.
Even for POST requests, the API key should be provided as a query string instead of in the POST body.
To sign a request:
-
Build the URL query string, making sure to encode any variable values:
-
Simply create the API call with the parameters required:
name=lipitor
-
Append your API key to the query string:
name=Lipitor&api_key=MY_API_KEY
-
If a POST request, append the POST body to the string from #2. For example,
name=lipitor&form=tablet&api_key=MY_API_KEYmypostparam=mypostvalue
. Note that there is no concatenation character joining the query string portion and the POST body portion. -
Note that if the value contains URL unsafe characters such as =, +, etc., it should first be url encoded prior to signing. For example
param=value%3D
instead ofparam=value=
In Python, this can be done using the
urllib.quote_plus
function
-
-
Sign the entire query string payload with the secret key given to you by GoodRx.
Python:signature = hmac.new(SECRET_KEY.encode("utf-8"), msg=query_string.encode("utf-8"), digestmod=hashlib.sha256).digest()
C#:ASCIIEncoding encoder = new ASCIIEncoding(); Byte[] code = encoder.GetBytes(SECRET_KEY); HMAC hmSha256 = new HMACSHA256(code); Byte[] hashMe = encoder.GetBytes(sQueryString); Byte[] hmBytes = hmSha256.ComputeHash(hashMe);
Java:byte[] code = SECRET_KEY.getBytes(StandardCharsets.US_ASCII); Mac hmSha256 = Mac.getInstance("HmacSHA256"); hmSha256.init(new SecretKeySpec(code, "HmacSHA256")); byte[] hashMe = queryString.getBytes(); byte[] hmBytes = hmSha256.doFinal(hashMe);
-
Encode the string so that it can be included in the URL, making sure to translate “/” and “+” symbols to underscores
Python:signature_encoded = base64.b64encode(signature, b"__").decode("utf-8")
C#:String signature = Convert.ToBase64String(hmBytes); signature = signature.Replace("+", "_"); signature = signature.Replace("/", "_"); signature_encoded = HttpUtility.UrlEncode(signature);
Java:String signature = Base64.getEncoder().encodeToString(hmBytes); signature = signature.replace("+", "_").replace("/", "_"); signature_encoded = URLEncoder.encode(signature, "UTF-8");
-
Append the signature to the URL using the
sig
variable.
Python:signed_query_string = "?%s&sig=%s" % (query_string, signature_encoded)
C#:String sSignedQueryString = String.Format("?{0}&sig={1}", sQueryString, signature_encoded);
Java:String signedQueryString = String.format("?%s&sig=%s", queryString, signature_encoded);
When GoodRx receives your request, we will take the query string you sent us, with the signature truncated, and create our own version of the signature to verify it matches yours.
Invalid signatures will result in an HTTP 400, Bad Request
error.
Invalid API Keys will result in an HTTP 401, Unauthorized
error.
API Resources
The GoodRx API expects HTTP URL request parameters and returns JSON responses. All requests must include your API Key and the parameters must be signed using the provided shared private key.
Before making any requests, be sure to request an API key.
The Fair Price API
The Fair Price API allows clients to retrieve the maximum price that a consumer, with or without insurance, should pay for this drug at a local pharmacy. One caveat to this API is that you cannot define the quantity desired since GoodRx only calculates the Fair Price for the most common quantity prescribed (usually a 30 days supply).
Queries to the Fair Price API can range in specificity, and only requires the name of the drug being queried for.
At the highest level, queries will return the fair price available for both the generic and brand equivalents. For example, if one were to query…
https://api.goodrx.com/fair-price?name=lipitor&api_key=MY_API_KEY&sig=...
…the resulting price object will be that of the fair price for the generic atorvastatin, even though lipitor was the searched drug name. To override which version of the drug is returned, the manufacturer parameter can be included…
https://api.goodrx.com/fair-price?name=lipitor&manufacturer=brand&api_key=MY_API_KEY&sig=...
…which will return a price object for Lipitor.
Low level queries can call for absolute matches, for example, using something as specific as an NDC will return the exact drug queried for:
https://api.goodrx.com/fair-price?ndc=55154242200&api_key=MY_API_KEY&sig=...
Available Requests
GET /fair-price | Return fair price for the desired prescription medication |
---|---|
URL | https://api.goodrx.com/fair-price |
Format | JSON |
URL Parameters |
|
Response |
JSON
The following keys will be available, encompassed in the data element:
|
Example Response Object |
{ success=true, errors=[], data= { brand:["lipitor"], generic: ["atorvastatin"], display: "Lipitor (atorvastatin)" form:"tablet", dosage:"10mg", quantity:"30", price:99.99, url: "https://www.goodrx.com/lipitor", manufacturer: "brand" } } |
The Low Price API
The Low Price API allows clients to retrieve the lowest available price for a prescription medication, queried from a predefined set of national chains and mail order pharmacies. The API will use its extensive data set to select the most common forms and quantities if not provided, as well as including generic or brand equivalents.
Queries to the Low Price API can range in specificity, and only require the name of the drug being queried for.
At the highest level, queries will return the lowest price available for both the generic and brand equivalents. For example, if one were to query…
https://api.goodrx.com/low-price?name=lipitor&api_key=MY_API_KEY&sig=...
…the resulting price object will be that of the lowest price for the generic atorvastatin, even though lipitor was the searched drug name. To override which version of the drug is returned, the manufacturer parameter can be included…
https://api.goodrx.com/low-price?name=lipitor&manufacturer=brand&api_key=MY_API_KEY&sig=...
…which will return a price object for Lipitor.
Low level queries can call for absolute matches, for example, using something as specific as an NDC will return the exact drug queried for:
https://api.goodrx.com/low-price?ndc=55154242200&api_key=MY_API_KEY&sig=...
Available Requests
GET /low-price | Return low price for the desired prescription medication |
---|---|
URL | https://api.goodrx.com/low-price |
Format | JSON |
URL Parameters |
|
Response |
JSON
The following keys will be available, encompassed in the data element:
|
Example Response Object |
{ success=true, errors=[], data= { brand:["lipitor"], generic: ["atorvastatin"], display: "Lipitor (atorvastatin)" form:"tablet", dosage:"10mg", quantity:"30", price:99.99, url: "https://www.goodrx.com/lipitor", manufacturer: "brand" } } |
The Compare Price API
The Compare Price API allows clients to retrieve the three lowest available prices for a prescription medication, queried from a predefined set of national chains and mail order pharmacies. The API will use our extensive data set to select the most common forms and quantities if not provided, as well as including generic or brand equivalents.
Queries to the Compare Price API can range in specificity, and only require the name of the drug being queried for.
At the highest level, queries will return the lowest price available for both the generic and brand equivalents. For example, if one were to query…
https://api.goodrx.com/compare-price?name=lipitor&api_key=MY_API_KEY&sig=...
…the resulting price object will be that of the lowest price for the generic atorvastatin, even though lipitor was the searched drug name. To override which version of the drug is returned, the manufacturer parameter can be included…
https://api.goodrx.com/compare-price?name=lipitor&manufacturer=brand&api_key=MY_API_KEY&sig=...
…which will return a price object for Lipitor.
Low level queries can call for absolute matches, for example, using something as specific as an NDC will return the exact drug queried for:
https://api.goodrx.com/compare-price?ndc=55154242200&api_key=MY_API_KEY&sig=...
Available Requests
GET /compare-price | Return three lowest prices for the desired prescription medication |
---|---|
URL | https://api.goodrx.com/compare-price |
Format | JSON |
URL Parameters |
|
Response |
JSON
The following keys will be available, encompassed in the data element:
|
Example Response Object |
{ success=true, errors=[], data= { brand:["glucophage"], generic: ["metformin"], display: "Glucophage (metformin)" form:"tablet", dosage:"500mg", quantity:"60", prices: [2.18, 3.5, 3.33], price_detail": { "url": [ "https://www.goodrx.com/coupon/apex?drug_id=4703&pharmacy_id=115179&quantity=60", null, "http://www.walgreens.com/pharmacy/psc/psc_overview_page.jsp" ], "price": [ 2.18, 3.5, 3.33 ], "savings": [ "37%", null, null ], "type": [ "coupon", "cash", "membership" ], "pharmacy": [ "CVS Pharmacy", "HealthWarehouse", "Walgreens" ] }, url: "https://www.goodrx.com/lipitor", manufacturer: "brand" } } |
The Drug Info API
The Drug Info API allows clients to retrieve details about the drugs available on GoodRx. Using the drug search API to obtain the string that represents the name of the drug, a client can then use this API to determine the dosages, forms and common quantities available
https://api.goodrx.com/drug-info?name=lipitor&api_key=MY_API_KEY&sig=...
…the resulting object will be an object of properties that represent the different forms of the drug. Those properties represent objects that have properties of the dosages for that form. They will be ordered by the strength of the dosage, and will have values of the URL to GoodRx for that specific form and dosage…
Available Requests
GET /drug-info | Return forms and dosages for the drug name |
---|---|
URL | https://api.goodrx.com/drug-info |
Format | JSON |
URL Parameters |
|
Response |
JSON
The following keys will be available, encompassed in the data element:
|
Example Response Object |
{ success=true, errors=[], data= { "drugs": { "tablet": { "10mg": "https://www.goodrx.com/lipitor?grx_ref=api&strength=10mg&form=tablet&label=Lipitor", "20mg": "https://www.goodrx.com/lipitor?grx_ref=api&strength=20mg&form=tablet&label=Lipitor", "40mg": "https://www.goodrx.com/lipitor?grx_ref=api&strength=40mg&form=tablet&label=Lipitor", "80mg": "https://www.goodrx.com/lipitor?grx_ref=api&strength=80mg&form=tablet&label=Lipitor" } } } } |
The Drug Search API
The Drug Search API allows clients to query the GoodRx drug database with strings in order to retrieve the best match possible. It can be used to correct user misspellings or to differentiate between different drug spellings, such as using dashes instead of forward-slashes.
Available Requests
GET /drug-search | Return the top five candidates that are closest to the given query |
---|---|
URL | https://api.goodrx.com/drug-search |
Format | JSON |
URL Parameters |
|
Response |
JSON
The following keys will be available encompassed in the data element:
|
Example Response Object |
{ "errors": [ ], "data": { "candidates": [ "lipitor", "oleptro", "zipsor", "calcipotriene", "citalopram" ] }, "success": true } |
Data
In addition to the APIs, we sometimes offer access to our data. If you would like to learn more, please contact us at info@goodrx.com.
API Terms of Use
Attribution
Clients must use a GoodRx image somewhere within the page using the data.
Available sizes:
Tiny |
![]() |
|
---|---|---|
Small |
![]() |
|
Medium |
![]() |
|
Large |
![]() |
|
Extra Large |
![]() |
The image must either point to the GoodRx homepage (https://www.goodrx.com) or use the URL provided in the JSON Response object.
Failure to implement the proper attribution may result in account suspension.
Rate Limits
The GoodRx API by default will not impose rate limiting on accounts. However, API usage is tracked and any abuse of the system will result in an account suspension and an inquiry into the high activity.
If your company is planning on high activity, please contact info@goodrx.com with a request for an unrestricted rate limit.