APIs

RxClass API

getAllClasses

Information returned
All classes (may limit by class type)
Service domain
https://rxnav.nlm.nih.gov
HTTP request
GET  /REST/rxclass/allClasses.xml?classTypes=values

Description

Get all classes, or classes of certain types (the classTypes parameter).

Parameters

ParameterLocationUseDescriptionDefault
formatPathOptional

Notation for results

One of:
.xml
Get results in XML
.json
Get results in JSON
.xml
classTypesQueryOptionalClass type(s)

(Space-separated list. See getClassTypes 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
rxclassMinConceptList
Drug classes
rxclassMinConcept (array)
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

Example: Therapeutic Categories (TC) and Drug Schedule (SCHEDULE) classes

XML: https://rxnav.nlm.nih.gov/REST/rxclass/allClasses?classTypes=TC+SCHEDULE

JSON: https://rxnav.nlm.nih.gov/REST/rxclass/allClasses.json?classTypes=TC+SCHEDULE

An XML result is shown below.

<rxclassdata>
    <rxclassMinConceptList>
        <rxclassMinConcept>
            <classId>SCHEDULE0</classId>
            <className>CSA SCHEDULE</className>
            <classType>SCHEDULE</classType>
        </rxclassMinConcept>
        <rxclassMinConcept>
            <classId>SCHEDULE1</classId>
            <className>SCHEDULE I</className>
            <classType>SCHEDULE</classType>
        </rxclassMinConcept>
        ...
        <rxclassMinConcept>
            <classId>N0000178293</classId>
            <className>Therapeutic Categories</className>
            <classType>TC</classType>
        </rxclassMinConcept>
        <rxclassMinConcept>
            <classId>N0000178294</classId>
            <className>Antidotes, Deterrents, and Toxicologic Agents</className>
            <classType>TC</classType>
        </rxclassMinConcept>
        ...
    </rxclassMinConceptList>
</rxclassdata>