API for Prescribable Drug Ingredients from RxTerms
This ingredient list is taken from RxTerms, which is a drug interface terminology derived from RxNorm (the U.S. terminology standard for clinical drugs) which can be easily used for prescription writing or medication history recording (e.g., in e-prescribing systems or PHRs).
The RxTerms drug ingredient list has been modified for this API in the following ways:
- Terms with "pollen" or "extract" in the name have been removed, since they have limited use in data entry or prescribing systems.
- Ingredients in RxNorm that are identified as precise ingredients (PIN) are mapped back to ingredients (IN). For example, terms that include a salt (such as Penicillin G Potassium) will have the salt removed from the name (e.g., Penicillin G).
API Demo
The following demo shows how this API might be used with an autocompleter we've developed.
API Documentation
API Base URL: https://clinicaltables.nlm.nih.gov/api/drug_ingredients/v3/search (+ query string parameters)
This data set may also be accessed through the FHIR ValueSet $expand operation.
In addition to the base URL, you will need to specify other parameters. See the query string parameters section below for details.
Query String Parameters and Default Values
At a minimum, when using the above base URL, you will need to specify the "terms" parameter containing a word or partial word to match.
Parameter Name | Default Value | Description |
---|---|---|
terms | (Required.) The search string (e.g., just a part of a word) for which to find matches in the list. More than one partial word can be present in "terms", in which case there is an implicit AND between them. | |
maxList | Optional, with a default of 7. Specifies the number of results requested, up to the upper limit of 500. If present but the value is empty, 500 will be used. | |
q | An optional, additional query string used to further constrain the results returned by the "terms" field. Unlike the terms field, "q" is not automatically wildcarded, but can include wildcards and can specify field names. See the Elasticsearch query string page for documentation of supported syntax. | |
df | name | A comma-separated list of display fields (from the fields section below) which are intended for the user to see when looking at the results. |
sf | name | A comma-separated list of fields to be searched. |
cf | code | A field to regard as the "code" for the returned item data. |
ef | A comma-separated list of additional fields to be returned for each retrieved list item. (See the Output format section for how the data for fields is returned.) If you wish the keys in the returned data hash to be something other than the field names, you can specify an alias for the field name by separating it from its field name with a colon, e.g., "ef=field_name1:alias1,field2,field_name3:alias3,etc. Note that not every field specified in the ef parameter needs to have an alias. |
RxTerms Field Descriptions
Field | Field Description |
---|---|
code | The RxNorm unique identifier for the ingredient, also known as the RXCUI. |
name | A drug ingredient. |
Output format
Output for an API query is an array of the following elements:
- The total number of results on the server, which can be more than the number of results returned. This reported total number of results may also be significantly less than the actual number of results and is limited to 10,000, which may significantly improve the service response time.
- An array of codes for the returned items. (This is the field specified with the cf query parameter above.)
- A hash of the "extra" data requested via the "ef" query parameter above. The keys on the hash are the fields (or their requested aliases) named in the "ef" parameter, and the value for a field is an array of that field's values in the same order as the returned codes.
- An array, with one element for each returned code, where each element is an array of the display strings specified with the "df" query parameter.
- An array, with one element for each returned code, where each element is the "code system" for the returned code. Note that only code-system aware APIs will return this array.
Sample API Queries
Query | Result | Description |
---|---|---|
https://clinicaltables.nlm.nih.gov/api/drug_ingredients/v3/search?terms=na&df=code,name | [20,["7244","7268","7243","31447","141366","274332","7226"],null,[["7244","Nandrolone"], ["7268","Natamycin"],["7243","Naltrexone"],["31447","nabilone"],["141366","naratriptan"],["274332","nateglinide"],["7226","Nadolol"]]] | Returns a complete count of the 20 drugs that match the string "na", displaying both the RXCUI code and it's associated term for the first 7 terms. |
https://clinicaltables.nlm.nih.gov/api/drug_ingredients/v3/search?terms=17609&sf=code | [1,["17609"],null,[["aluminum acetate"]]] | Returns the RXCUI with the code "17609" along with the drug ingredient name |