Example drug labeling API queries

To help get you started, we have provided some API query examples below. Use the Run query button to call the API and get back results. You can experiment by editing the example queries in the black text box.

Example query

One drug product labeling record

This query searches for all records in a certain date range, and asks for a single one.

See searchable fields for more about effective_time. Brackets [ ] are used to specify a range for date, number, or string fields.

  1. search for all records with effective_time between Jun 01, 2011 and Dec 31, 2012.

  2. limit to 1 record.

Example query

Product labeling record with a Boxed Warning

This query searches for labels with a Boxed Warning, and returns one result.

The _exists_ search modifier lets you search for records that contain a specific field, no matter what its contents are. See the API basics page for more details.

  1. search for all records with a boxed_warning field.

  2. limit to 1 record.

Example query

Count of drug labeling, by product type

There are more labeling records for over-the-counter (OTC) drugs than prescription drugs.

The suffix .exact is required by openFDA to count the unique full phrases in the field openfda.product_type. Without it, the API will count each word in that field individually—HUMAN OTC DRUG would be counted as separate values, HUMAN and OTC and DRUG.

  1. count the field openfda.product_type (product type).