Example Device Enforcement 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 enforcement report

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

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

  1. Search for all records with report_date between Jan 01, 2004 and Dec 31, 2013.

  2. Limit to 1 record.

Example query

One enforcement report of a certain health hazard class

This query searches records of a certain health hazard, and returns a single record.

Double quotation marks " " surround phrases that must match exactly. The plus sign + is used in place of a space character .

  1. Search for all records where classification (health hazard level) was Class III.

  2. Limit to 1 record.

Example query

Count of voluntary vs. mandated enforcement reports

The vast majority of recalls are firm-initiated. This query searches the endpoint for all records, and tells the API to count how many enforcement reports were for voluntary vs. FDA-mandated recalls.

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

  1. Count the field voluntary_mandated (type of recall).