APIs

RxClass API

getClassByRxNormDrugName

Information returned
Classes containing a drug of the specified name
Service domain
https://rxnav.nlm.nih.gov
HTTP request
GET  /REST/rxclass/class/byDrugName.xml?drugName=value&relaSource=value&relas=values

Description

Get the classes that directly contain drugName or any product or ingredient related to it (see default paths). The result can be filtered by drug-class sources (relaSource parameter) and relations (relas parameter).

See the RxClass Overview for more details on the sources of drug-class relations and the relationship values.

Parameters

ParameterLocationUseDescriptionDefault
formatPathOptional

Notation for results

One of:
.xml
Get results in XML
.json
Get results in JSON
.xml
drugNameQueryRequiredName of a generic or branded drug
relaSourceQueryOptionalSource of drug-class relationships

(See getSourcesOfDrugClassRelations for the menu.)

ALL
relasQueryOptionalRelationship(s) the drug may have to the class (when relaSource is also specified)

(Space-separated list. See getRelas for the menu.)

ALL

All query parameters are case-insensitive.

Note that HTTP requires that query parameters be "URL encoded". For instance, a "space-separated list" will, in practice, usually appear to use either a plus sign (+) or %20 as the separator. For full information on URL encoding, please refer to IETF RFC 3986, "Uniform Resource Identifier".

Output structure

Results are available as either XML or JSON.

  • The XML result has the root element rxclassdata. It is described in the XML Schema for the RxClass API; the relevant element structure is summarized below. Elements that would be empty might be left out.

  • The JSON result is an object {...}, analogous to the content of the XML rxclassdata. Fields that might occur multiple times in the XML are expressed as an array. Fields that would be empty might be null or left out. Numbers are expressed as strings.

Both XML and JSON results follow the same outline:

rxclassdata
Root element in XML, or anonymous object in JSON
rxclassDrugInfoList
rxclassDrugInfo (array)
minConcept
Drug that is a class member
rxcui
RxNorm identifier
name
Drug name
tty
Drug term type
rxclassMinConceptItem
Drug class
classId
Class identifier (an ID in the namespace of the class source)
className
Class name
classType
Class type (ATC1-4, CHEM, DISPOS, EPC, VA, etc.)
classUrl
Link to the class source
rela
Member relationship that defines the class
relaSource
Drug-member relationship source

Example: Classes that MED-RT associates by "may_treat" with morphine

XML: https://rxnav.nlm.nih.gov/REST/rxclass/class/byDrugName?drugName=morphine&relaSource=MEDRT&relas=may_treat

JSON: https://rxnav.nlm.nih.gov/REST/rxclass/class/byDrugName.json?drugName=morphine&relaSource=MEDRT&relas=may_treat

An XML result is shown below.

<rxclassdata>
    <rxclassDrugInfoList>
        <rxclassDrugInfo>
            <minConcept>
                <rxcui>235751</rxcui>
                <name>morphine hydrochloride</name>
                <tty>PIN</tty>
            </minConcept>
            <rxclassMinConceptItem>
                <classId>D004417</classId>
                <className>Dyspnea</className>
                <classType>DISEASE</classType>
            </rxclassMinConceptItem>
            <rela>may_treat</rela>
            <relaSource>MEDRT</relaSource>
        </rxclassDrugInfo>
        <rxclassDrugInfo>
            <minConcept>
                <rxcui>235751</rxcui>
                <name>morphine hydrochloride</name>
                <tty>PIN</tty>
            </minConcept>
            <rxclassMinConceptItem>
                <classId>D010148</classId>
                <className>Pain, Intractable</className>
                <classType>DISEASE</classType>
            </rxclassMinConceptItem>
            <rela>may_treat</rela>
            <relaSource>MEDRT</relaSource>
        </rxclassDrugInfo>
        <rxclassDrugInfo>
            <minConcept>
                <rxcui>235774</rxcui>
                <name>morphine tartrate</name>
                <tty>PIN</tty>
            </minConcept>
            <rxclassMinConceptItem>
                <classId>D004417</classId>
                <className>Dyspnea</className>
                <classType>DISEASE</classType>
            </rxclassMinConceptItem>
            <rela>may_treat</rela>
            <relaSource>MEDRT</relaSource>
        </rxclassDrugInfo>
        <rxclassDrugInfo>
            <minConcept>
                <rxcui>235774</rxcui>
                <name>morphine tartrate</name>
                <tty>PIN</tty>
            </minConcept>
            <rxclassMinConceptItem>
                <classId>D010148</classId>
                <className>Pain, Intractable</className>
                <classType>DISEASE</classType>
            </rxclassMinConceptItem>
            <rela>may_treat</rela>
            <relaSource>MEDRT</relaSource>
        </rxclassDrugInfo>
        <rxclassDrugInfo>
            <minConcept>
                <rxcui>30236</rxcui>
                <name>morphine sulfate</name>
                <tty>PIN</tty>
            </minConcept>
            <rxclassMinConceptItem>
                <classId>D004417</classId>
                <className>Dyspnea</className>
                <classType>DISEASE</classType>
            </rxclassMinConceptItem>
            <rela>may_treat</rela>
            <relaSource>MEDRT</relaSource>
        </rxclassDrugInfo>
        <rxclassDrugInfo>
            <minConcept>
                <rxcui>30236</rxcui>
                <name>morphine sulfate</name>
                <tty>PIN</tty>
            </minConcept>
            <rxclassMinConceptItem>
                <classId>D010148</classId>
                <className>Pain, Intractable</className>
                <classType>DISEASE</classType>
            </rxclassMinConceptItem>
            <rela>may_treat</rela>
            <relaSource>MEDRT</relaSource>
        </rxclassDrugInfo>
        <rxclassDrugInfo>
            <minConcept>
                <rxcui>7052</rxcui>
                <name>morphine</name>
                <tty>IN</tty>
            </minConcept>
            <rxclassMinConceptItem>
                <classId>D004417</classId>
                <className>Dyspnea</className>
                <classType>DISEASE</classType>
            </rxclassMinConceptItem>
            <rela>may_treat</rela>
            <relaSource>MEDRT</relaSource>
        </rxclassDrugInfo>
        <rxclassDrugInfo>
            <minConcept>
                <rxcui>7052</rxcui>
                <name>morphine</name>
                <tty>IN</tty>
            </minConcept>
            <rxclassMinConceptItem>
                <classId>D010148</classId>
                <className>Pain, Intractable</className>
                <classType>DISEASE</classType>
            </rxclassMinConceptItem>
            <rela>may_treat</rela>
            <relaSource>MEDRT</relaSource>
        </rxclassDrugInfo>
    </rxclassDrugInfoList>
</rxclassdata>

Example: ATC classes containing atorvastatin

XML: https://rxnav.nlm.nih.gov/REST/rxclass/class/byDrugName?drugName=atorvastatin&relaSource=ATC

JSON: https://rxnav.nlm.nih.gov/REST/rxclass/class/byDrugName.json?drugName=atorvastatin&relaSource=ATC

An XML result is shown below.

<rxclassdata>
    <rxclassDrugInfoList>
        <rxclassDrugInfo>
            <minConcept>
                <rxcui>1422085</rxcui>
                <name>atorvastatin / ezetimibe</name>
                <tty>MIN</tty>
            </minConcept>
            <rxclassMinConceptItem>
                <classId>C10BA</classId>
                <className>Combinations of various lipid modifying agents</className>
                <classType>ATC1-4</classType>
            </rxclassMinConceptItem>
            <rela/>
            <relaSource>ATC</relaSource>
        </rxclassDrugInfo>
        <rxclassDrugInfo>
            <minConcept>
                <rxcui>404773</rxcui>
                <name>amlodipine / atorvastatin</name>
                <tty>MIN</tty>
            </minConcept>
            <rxclassMinConceptItem>
                <classId>C10BX</classId>
                <className>Lipid modifying agents in combination with other drugs</className>
                <classType>ATC1-4</classType>
            </rxclassMinConceptItem>
            <rela/>
            <relaSource>ATC</relaSource>
        </rxclassDrugInfo>
        <rxclassDrugInfo>
            <minConcept>
                <rxcui>83367</rxcui>
                <name>atorvastatin</name>
                <tty>IN</tty>
            </minConcept>
            <rxclassMinConceptItem>
                <classId>C10AA</classId>
                <className>HMG CoA reductase inhibitors</className>
                <classType>ATC1-4</classType>
            </rxclassMinConceptItem>
            <rela/>
            <relaSource>ATC</relaSource>
        </rxclassDrugInfo>
    </rxclassDrugInfoList>
</rxclassdata>