NAV
shell

Introduction

Welcome to the DrugBank API! You can use our API to access DrugBank API endpoints, which can get information on drugs, drug products, and drug interactions in our database.

The DrugBank API is organized around REST. Our API has predictable, resource-oriented URLs, and uses HTTP response codes to indicate API errors. We use built-in HTTP features, like HTTP authentication and HTTP verbs, which are understood by off-the-shelf HTTP clients. JSON is returned by all API responses, including errors, although our API libraries convert responses to appropriate language-specific objects.

We have language bindings in Shell, Ruby, and Javascript. You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.

Selecting your country/region

The DrugBank API is optionally scoped by region of availability (currently only U.S. and Canada are available). The URL you use to access the API will determine the drugs, products, etc. that are returned.

If a product / drug appears in the results under a region scope, it means it is available in that region. Once a drug is no longer available (if a drug is withdrawn for example), it will no longer appear in the results.

For example, to search for available drug products by name in Canada, you would use the following URL:

https://api.drugbankplus.com/v1/ca/drug_names?search=abacavir

The following country/codes are available:

Country Code Base URL
United States us https://api.drugbankplus.com/v1/us
Canada ca https://api.drugbankplus.com/v1/ca

Searching without a region

You can search for all drugs / products by not providing a region scope. This will allow you to get information about drugs that are not marketed (experimental, illicit, etc.).

Authentication

To authorize, use this code:

# With cURL, you can just pass the correct header with each request
curl -L 'https://api.drugbankplus.com/v1/endpoint' 
-H 'Authorization: mytoken'

Make sure to replace mytoken with your API key.

DrugBank uses API keys to allow access to the API. To request an API contact us.

All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.

DrugBank expects for the API key to be included in all API requests to the server in a header that looks like the following:

Authorization: mytoken

Errors

The DrugBank API uses conventional HTTP response codes to indicate the success or failure of an API request. In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted), and codes in the 5xx range indicate an error with DrugBank servers (these are rare).

The DrugBank API uses the following error codes:

Error Code Meaning
400 Bad Request – Your request is invalid
401 Unauthorized – Your API key is wrong
404 Not Found – The specified resource could not be found
405 Method Not Allowed – You tried to access a resource with an invalid method
406 Not Acceptable – You requested a format that isn’t json
410 Gone – The resource requested has been removed from our servers
429 Too Many Requests – You’re making too many requests! Slow down!
500 Internal Server Error – We had a problem with our server. Try again later.
503 Service Unavailable – We’re temporarially offline for maintanance. Please try again later.

Drug Names / Autocomplete

This endpoint returns a list of drugs/product information suitable for use with autocomplete forms, for quickly finding the right drugs/products.

curl -L 'https://api.drugbankplus.com/v1/drug_names.json?search=tylenol' 
-H 'Authorization: mytoken'

The above command returns JSON structured like this (only the first result shown):

{
  "products": [
    {
      "hits": [
        {
          "field": "name",
          "value": "<em>Viagra</em>"
        }
      ],
      "name": "Viagra",
      "ndc_product_codes": [
        "55154-2727",
        "..."
      ],
      "dosage_form": "tablet, film coated",
      "strength_number": "25",
      "strength_unit": "mg/1",
      "route": "oral",
      "generic": false,
      "otc": false,
      "mixture": false,
      "ingredients": [
        {
          "drugbank_id": "DB00203",
          "name": "Sildenafil",
          "cas": "139755-83-2",
          "strength_number": "25",
          "strength_unit": "mg/1"
        }
      ],
      "images": [
        {
          "ndc_id": "55154-2727",
          "description": "sildenafil 25 MG Oral Tablet [Viagra]",
          "image_url_original": "...",
          "image_url_tiny": "...",
          "image_url_thumb": "...",
          "image_url_medium": "..."
        }
      ]
    }
  ]
}

HTTP Request

GET https://api.drugbankplus.com/v1/us/drug_names.json

Query Parameters

Parameter Default Description
search null The string you want to search with.
fuzzy false If set to true, enable fuzzy search (see fuzzy searching below)

Notice the hits array returned in the results. The hits contain highlighted snippets from the match. You can use these highlights in autocomplete applications. The matching part of the text is wrapped in an <em> tag, which you can style as you wish in your application.

curl -L 'https://api.drugbankplus.com/v1/drug_names/simple.json?search=tylenol' 
-H 'Authorization: mytoken'

The above command returns JSON structured like this (only the first result shown):

{
  "products": [
    {
      "hits": [
        {
          "field": "name",
          "value": "<em>Viagra</em> 50 MG Oral Tablet"
        }
      ],
      "name": "Viagra 50 MG Oral Tablet",
      "brands": [
        "Viagra"
      ],
      "ndc_product_codes": [
        "21695-157"
      ],
      "dosage_forms": [
        "tablet, film coated"
      ],
      "strength_number": "50",
      "strength_unit": "mg/1",
      "route": "oral",
      "ingredients": [
        {
          "drugbank_id": "DB00203",
          "name": "Sildenafil",
          "cas": "139755-83-2",
          "strength_number": "50",
          "strength_unit": "mg/1"
        }
      ]
    }
  ]
}

Prescribable name (simple) search uses the concept of a prescribable name, the normalized, most common name used to describe a medication. The results of this search will not contain multiple brand names for a given drug. Instead the prescribable name will be unique for a dosage strength/form and a name.

This type of search is useful when logging medications a customer/patient may be taking. You can combine a name and a dosage strength to quickly filter your search. For example searching for viagra 25 mg will quickly return the most likely drug that the individual is taking.

HTTP Request

GET https://api.drugbankplus.com/v1/us/drug_names/simple.json

Query Parameters

Parameter Default Description
search null The string you want to search with.
fuzzy false If set to true, enable fuzzy search (see fuzzy searching below)

Notice the hits array returned in the results. The hits contain highlighted snippets from the match. You can use these highlights in autocomplete applications. The matching part of the text is wrapped in an <em> tag, which you can style as you wish in your application.

Fuzzy Searching

This example demonstrates a misspelling of “Advil”, with fuzzy search enabled you will still get a result (try it yourself!).

curl -L 'https://api.drugbankplus.com/v1/drug_names.json?search=addvil&fuzzy=true' 
-H 'Authorization: mytoken'

Fuzzy searching allows for misspellings, but is not enabled by default, you must set fuzzy=true. By setting fuzzy=true you are telling the API to allow a certain number of misspellings to still count as a match (defaults to 2). You can also pass a number of misspellings in to increase the likelyhood of a match (for example, fuzzy=4 will allow 4 misspelled letters).

Products

Get a specific U.S. product

curl -L 'https://api.drugbankplus.com/v1/products/55154-2727' 
-H 'Authorization: mytoken'

The above command returns JSON structured like this:

{
  "ndc_product_code": "55154-2727",
  "dpd_id": null,
  "name": "Viagra",
  "started_marketing_on": "1998-03-27",
  "approved_on": null,
  "schedule": null,
  "dosage_form": "tablet, film coated",
  "route": "oral",
  "application_number": "NDA020895",
  "generic": false,
  "otc": false,
  "approved": true,
  "country": true,
  "mixture": false,
  "ingredients": {
    "ingredient": {
      "name": "Sildenafil",
      "drugbank_id": "DB00203",
      "strength": {
        "number": "25",
        "unit": "mg/1"
      }
    }
  }
}

This endpoint retrieves a specific drug product based on NDC ID.

HTTP Request

GET https://api.drugbankplus.com/v1/us/<NDC_ID>

URL Parameters

Parameter Description
ID The NDC ID of the product to retrieve

Get a specific Canadian product

curl -L 'https://api.drugbankplus.com/v1/ca/products/55154-2727' 
-H 'Authorization: mytoken'

The above command returns JSON structured like this:

{
  "ndc_product_code": "55154-2727",
  "dpd_id": null,
  "name": "Viagra",
  "started_marketing_on": "1998-03-27",
  "approved_on": null,
  "schedule": null,
  "dosage_form": "tablet, film coated",
  "route": "oral",
  "application_number": "NDA020895",
  "generic": false,
  "otc": false,
  "approved": true,
  "country": true,
  "mixture": false,
  "ingredients": {
    "ingredient": {
      "name": "Sildenafil",
      "drugbank_id": "DB00203",
      "strength": {
        "number": "25",
        "unit": "mg/1"
      }
    }
  }
}

This endpoint retrieves a specific drug product based on DPD ID (Drug Product ID).

HTTP Request

GET https://api.drugbankplus.com/v1/ca/<DPD_ID>

URL Parameters

Parameter Description
ID The DPD ID of the product to retrieve

Drugs

Get a specific drug

curl -L 'https://api.drugbankplus.com/v1/drugs/DB00316' 
-H 'Authorization: mytoken'

The above command returns JSON structured like this:

{
  "drugbank_id": "DB00316",
  "name": "Acetaminophen",
  "description": "Acetaminophen, also known as paracetamol, is ...",
  "synonyms": ["..."],
  "pharmacology": {
    "indication_descripton": "For temporary relief of fever, minor aches, and pains.",
    "pharmacodynamic_description": "Acetaminophen (USAN) or Paracetamol (INN) is a ...",
    "mechanism_of_action_description": "Acetaminophen is thought to act primarily in the ...",
    "absorption": "Rapid and almost complete",
    "protein_binding": "25%",
    "volume_of_distribution": [],
    "clearance": [],
    "half_life": "1 to 4 hours",
    "route_of_elimination": "Approximately 80% of acetaminophen is ...",
    "toxicity_description": "Oral, mouse: LD50 = 338 mg/kg; Oral, rat: LD50 = 1944 mg/kg. Acetaminophen is ..."
  },
  "identifiers": {
    "drugbank_id": "DB00316",
    "inchi": "InChI=1S/C8H9NO2/c1-6(10)9-7-2-4-8(11)5-3-7/h2-5,11H,1H3,(H,9,10)",
    "inchikey": "InChIKey=RZVAJINKPMORJF-UHFFFAOYSA-N"
  }
}

This endpoint retrieves a specific drug based on DrugBank ID.

HTTP Request

GET https://api.drugbankplus.com/v1/us/drugs/<ID>

URL Parameters

Parameter Description
ID The DrugBank ID of the drug to retrieve

Get products linked with a drug

curl -L 'https://api.drugbankplus.com/v1/drugs/DB00316/products' 
-H 'Authorization: mytoken'

The above command returns JSON structured like this (only first product shown):

[
  {
    "ndc_product_code": null,
    "dpd_id": "02236871",
    "name": "(extra Strength) Acetaminophen, Caffeine & 8mg Codeine Phosphate Caplets",
    "started_marketing_on": "1998-07-22",
    "approved_on": null,
    "schedule": "Narcotic (CDSA I)",
    "dosage_form": "tablet",
    "route": "oral",
    "application_number": null,
    "generic": false,
    "otc": false,
    "approved": true,
    "country": true,
    "mixture": true,
    "ingredients": {
      "ingredient": {
        "name": "Caffeine",
        "drugbank_id": "DB00201",
        "strength": {
          "number": "15",
          "unit": "mg"
        }
      }
    }
  }
]

This endpoint retrieves a list of products linked to a drug, based on DrugBank ID.

HTTP Request

GET https://api.drugbankplus.com/v1/us/drugs/<ID>/products

URL Parameters

Parameter Description
ID The DrugBank ID of the drug to retrieve the linked products

Drug-Drug Interactions

Provide a list of products to get a list of interactions between the ingredients in specified products. The products can be specified by name or by product code.

Find DDI With Product Codes

Return a list of drug interactions involving the products with the NDC codes 66715-9833 and 0002-7140:

curl -L 'https://api.drugbankplus.com/v1/ddi?ndc=66715-9833,0002-7140' 
-H 'Authorization: mytoken'

The interacting ingredients in each product are identified by name and DrugBank identifier. The result looks like:

{
  "total_results": 1,
  "interactions": [
    {
      "product": "66715-9833",
      "product_ingredient": {
        "drugbank_id": "DB01050",
        "name": "Ibuprofen"
      },
      "affected_product": "0002-7140",
      "affected_product_ingredient": {
        "drugbank_id": "DB00054",
        "name": "Abciximab"
      },
      "action": "increase_anticoagulant_effect",
      "description": "Ibuprofen may increase the anticoagulant activities of Abciximab.",
      "severity": "Moderate"
    }
  ]
}

HTTP Request

GET https://api.drugbankplus.com/v1/us/ddi.json

Query Parameters

Parameter Description
names A comma delimited list of NDC codes

To search by the NDC product code the ndc codes should be joined with a comma, and not include any quotations. Only the 2 segment NDC code is accepted at this time.

Find DDI With Name

Return a list of drug interactions involving the products with the products named: advil, Reopro, Eliquis and 7-select Advil PM.

curl -L -X POST "https://api.drugbankplus.com/v0/ddi.json" \
-H "Content-Type: application/json" \
-H 'Authorization: mytoken' \
-H "Cache-Control: no-cache" -d '{
  "names": [
    "advil",
    "Reopro",
    "Eliquis",
    "7-select Advil PM"
  ]
}'

The above command returns the interactions associated with the product specified by the product name.

{
    "total_results": 6,
    "interactions": [
        {
            "product_name": "Reopro",
            "product_ingredient": {
                "drugbank_id": "DB00054",
                "name": "Abciximab"
            },
            "affected_product_name": "Eliquis",
            "affected_product_ingredient": {
                "drugbank_id": "DB06605",
                "name": "Apixaban"
            },
            "action": "increase_adverse_effects",
            "description": "The risk or severity of adverse effects can be increased when Abciximab is combined with Apixaban.",
            "severity": "Minor"
        },
        {
            "product_name": "Advil",
            "product_ingredient": {
                "drugbank_id": "DB01050",
                "name": "Ibuprofen"
            },
            "affected_product_name": "Reopro",
            "affected_product_ingredient": {
                "drugbank_id": "DB00054",
                "name": "Abciximab"
            },
            "action": "increase_anticoagulant_effect",
            "description": "Ibuprofen may increase the anticoagulant activities of Abciximab.",
            "severity": "Moderate"
        },
        {
            "product_name": "7-select Advil PM",
            "product_ingredient": {
                "drugbank_id": "DB01050",
                "name": "Ibuprofen"
            },
            "affected_product_name": "Reopro",
            "affected_product_ingredient": {
                "drugbank_id": "DB00054",
                "name": "Abciximab"
            },
            "action": "increase_anticoagulant_effect",
            "description": "Ibuprofen may increase the anticoagulant activities of Abciximab.",
            "severity": "Moderate"
        },
        {
            "product_name": "Advil",
            "product_ingredient": {
                "drugbank_id": "DB01050",
                "name": "Ibuprofen"
            },
            "affected_product_name": "Eliquis",
            "affected_product_ingredient": {
                "drugbank_id": "DB06605",
                "name": "Apixaban"
            },
            "action": "increase_adverse_effects",
            "description": "The risk or severity of adverse effects can be increased when Ibuprofen is combined with Apixaban.",
            "severity": "Minor"
        },
        {
            "product_name": "7-select Advil PM",
            "product_ingredient": {
                "drugbank_id": "DB01050",
                "name": "Ibuprofen"
            },
            "affected_product_name": "Eliquis",
            "affected_product_ingredient": {
                "drugbank_id": "DB06605",
                "name": "Apixaban"
            },
            "action": "increase_adverse_effects",
            "description": "The risk or severity of adverse effects can be increased when Ibuprofen is combined with Apixaban.",
            "severity": "Minor"
        },
        {
            "product_name": "Eliquis",
            "product_ingredient": {
                "drugbank_id": "DB06605",
                "name": "Apixaban"
            },
            "affected_product_name": "Reopro",
            "affected_product_ingredient": {
                "drugbank_id": "DB00054",
                "name": "Abciximab"
            },
            "action": "increase_anticoagulant_effect",
            "description": "Apixaban may increase the anticoagulant activities of Abciximab.",
            "severity": "Major"
        }
    ]
}

HTTP Request

POST https://api.drugbankplus.com/v1/us/ddi.json

Request Body

To search for drug-drug interactions by drug product name JSON specifying the request should be included in the body of the request. The format of the request should follow the structure of the following example:

{"names": ["advil","Reopro","Eliquis","7-select Advil PM"]}

The API finds the product with the closest match to the input name, and returns any interactions between ingredients for all the products in the product list.

API Versions

Accessing API versions

All previous versions of our API documentation are available:

Version Link Released
v0 https://docs.drugbankplus.com/v0 July, 2016
v1 https://docs.drugbankplus.com/v1 September, 2016 (Current)

You can access the latest version of the API docs using the base docs url:

https://docs.drugbankplus.com

This will redirect you to the newest version of the API.