The GoodRx API supplies clients with the ability to get the latest pricing information for over 6,000 prescription medications.

Before getting started, request an API key. Please review our terms of use before deploying API integration to avoid any unexpected account issues.

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


Signing Requests

All API requests must 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.

To sign a request:

  1. Build the URL query string, making sure to encode any variable values:

    1. Simply create the API call with the parameters required:
      name=Lipitor

    2. Append your API key to the query string:
      name=Lipitor&api_key=MY_API_KEY

  2. Sign the entire query string payload using the secret key given to you by GoodRx
    Python: hmac.new(secret_key, msg=querystring, 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);

  3. Encode the string so that it can be included in the URL, making sure to translate “/” and “+” symbols to underscores
    Python: base64.b64encode(signature, "__")
    C#:
    String signature = Convert.ToBase64String(hmBytes);
    signature = signature.Replace("+", "_");
    signature = signature.Replace("/", "_");
    signature = HttpUtility.UrlEncode(signature);

  4. Append the signature to the URL using the sig variable
    ?name=Lipitor&api_key=MY_API_KEY&sig=gn9UAFOfMaEOMEmzH0hpk7k_QnRe1inD_=
    C#: String sSignedQueryString = String.Format("?{0}&sig={1}", sQueryString, signature);

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
api_key
  • Required
name
  • Required if ndc excluded
  • Expected Data Type: String
  • Example: “lipitor”
form
  • Optional
  • Expected Data Type: String
  • Example: “tablet”
dosage
  • Optional
  • Expected Data Type: Float
  • Examples: 20, 2.5, 14.0
manufacturer
  • Optional
  • Expected Data Type: String of "brand", "generic" or "match"
  • Example: “brand”
ndc
  • Required if name excluded
  • Expected Data Type: String
  • Example: “55154242200”
  • Note: NDC must be in the 11 character format stripped of dashes
Response JSON

The following keys will be available, encompassed in the data element:

brand

List of equivalent brand drugs
Example: ["lipitor",]

generic

List of equivalent generic drugs
Example: ["atorvastatin",]

display

String representing a display format for generic and brand equivalents
Example: "Lipitor (atorvastatin)"

form

String representing the dosage form of the prescription medication
Example: "tablet"

dosage

String representing the dosage measurement of the prescription medication
Example: "10mg"

quantity

Float representing the quantity used to derive price
Example: 30

price

Float representing the price at the referenced quantity, dosage, and form
Example: 79.99

url

String referencing the GoodRx price page
Example: "https://www.goodrx.com/lipitor"

manufacturer

String referencing the manufacturer type of drug, either brand or generic
Example: "brand"

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
api_key
  • Required
name
  • Required if ndc excluded
  • Expected Data Type: String
  • Example: "lipitor"
form
  • Optional
  • Expected Data Type: String
  • Example: "tablet"
dosage
  • Optional
  • Expected Data Type: Float
  • Examples: 20, 2.5, 14.0
quantity
  • Optional
  • Expected Data Type: Float
  • Example: 30
manufacturer
  • Optional
  • Expected Data Type: String of "brand", "generic" or "match"
  • Example: "brand"
ndc
  • Required if name excluded
  • Expected Data Type: String
  • Example: '55154242200'
  • Note: NDC must be in the 11 character format stripped of dashes
Response JSON

The following keys will be available, encompassed in the data element:

brand

List of equivalent brand drugs
Example: ["lipitor",]

generic

List of equivalent generic drugs
Example: ["atorvastatin",]

display

String representing a display format for generic and brand equivalents
Example: "Lipitor (atorvastatin)"

form

String representing the dosage form of the prescription medication
Example: "tablet"

dosage

String representing the dosage measurement of the prescription medication
Example: "10mg"

quantity

Float representing the quantity used to derive price
Example: 30

price

Float representing the price at the referenced quantity, dosage, and form
Example: 79.99

url

String referencing the GoodRx price page
Example: "https://www.goodrx.com/lipitor"

manufacturer

String referencing the manufacturer type of drug, either brand or generic
Example: "brand"

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
api_key
  • Required
name
  • Required if ndc excluded
  • Expected Data Type: String
  • Example: “lipitor”
form
  • Optional
  • Expected Data Type: String
  • Example: “tablet”
dosage
  • Optional
  • Expected Data Type: Float
  • Examples: 20, 2.5, 14.0
quantity
  • Optional
  • Expected Data Type: Float
  • Example: 30
manufacturer
  • Optional
  • Expected Data Type: String of "brand", "generic" or "match"
  • Example: "brand"
ndc
  • Required if name excluded
  • Expected Data Type: String
  • Example: '55154242200'
  • Note: NDC must be in the 11 character format stripped of dashes
Response JSON

The following keys will be available, encompassed in the data element:

brand

List of equivalent brand drugs
Example: ["lipitor",]

generic

List of equivalent generic drugs
Example: ["atorvastatin",]

display

String representing a display format for generic and brand equivalents
Example: "Lipitor (atorvastatin)"

form

String representing the dosage form of the prescription medication
Example: "tablet"

dosage

String representing the dosage measurement of the prescription medication
Example: "10mg"

quantity

Float representing the quantity used to derive price
Example: 30

prices

List of floats representing the lowest prices at the referenced quantity, dosage, and form
Example: [79.99, 80.53, 99.99]

price_detail

Object with price, savings, url, type, and pharmacy properties ordered by price
Example: "price_detail": { "url": [ ], "savings": [ ], "price": [ ], "type": [ ], "pharmacy": [ ] }

price_detail: price

Three lowest prices for this drug, ordered by price. All other properties reference these prices by using the same index.
Example: "http://www.goodrx.com/coupon/apex?drug_id=4703&pharmacy_id=115179&quantity=60"

price_detail: url

URLs (if available) to either GoodRx coupons or Savings programs, referencing the prices in the same indicies in the price list.
Example: "http://www.goodrx.com/coupon/apex?drug_id=4703&pharmacy_id=115179&quantity=60"

price_detail: savings

Percentage of savings over cash price (if available), referencing the prices in the same indicies in the price list.
Example: "37%"

price_detail: type

Description of what kind of price the value represents (e.g. 'coupon', 'cash', or 'memebership')
Example: "coupon"

price_detail: pharmacy

The name of the pharmacy the price represents, referencing the prices in the same indicies in the price list
Example: "CVS Pharmacy"

url

String referencing the GoodRx price page
Example: "https://www.goodrx.com/lipitor"

manufacturer

String referencing the manufacturer type of drug, either brand or generic
Example: "brand"

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": [
              "http://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
api_key
  • Required
name
  • Expected Data Type: String
  • Example: “lipitor”
Response JSON

The following keys will be available, encompassed in the data element:

drugs

Object containing available forms for the dosages represented by the name with individual links to those dosages
Example: { "tablet": { "10mg": "http://...", "20mg": ..., ... } }

quantities

Object containing common quantities for the dosages represented by the name
Example: { "tablet": { "10mg": [5, 7, 30, 45, 90], "20mg": [...], ... } }

Example Response Object
{ success=true, errors=[], data=
   {
     "drugs":
     {
       "tablet":
       {
         "10mg": "http://www.goodrx.com/lipitor?grx_ref=api&strength=10mg&form=tablet&label=Lipitor",
         "20mg": "http://www.goodrx.com/lipitor?grx_ref=api&strength=20mg&form=tablet&label=Lipitor",
         "40mg": "http://www.goodrx.com/lipitor?grx_ref=api&strength=40mg&form=tablet&label=Lipitor",
         "80mg": "http://www.goodrx.com/lipitor?grx_ref=api&strength=80mg&form=tablet&label=Lipitor"
       }
     }
   }
}
    

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
api_key
  • Required
query
  • Expected Data Type: String
  • Example: "lipitor"
Response JSON

The following keys will be available encompassed in the data element:

candidates

List of five candidates best matching query
Example: ["lipitor", "oleptro", "zipsor", "calcipotriene", "citalopram"]

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, such as U&C and Medicare pricing. 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.

Copyright ©2016 GoodRx, Inc.

GoodRx is not sponsored by or affiliated with any of the pharmacies identified in its price comparisons. All trademarks, brands, logos and copyright images are property of their respective owners and rights holders and are used solely to represent the products of these rights holders. This information is for informational purposes only and is not meant to be a substitute for professional medical advice, diagnosis or treatment. GoodRx is not offering advice, recommending or endorsing any specific prescription drug, pharmacy or other information on the site. GoodRx provides no warranty for any of the pricing data or other information. Please seek medical advice before starting, changing or terminating any medical treatment.