# getDrugAdverseEventCounts

**Identifier:** `openfda_getDrugAdverseEventCounts`

**Provider:** [OpenFDA](https://kirha.com/providers/openfda.md)

Frequency-ranked counts of FAERS (U.S. FDA) adverse-event reports for a drug. Use this, not searchDrugAdverseEvents, for quantitative 'how many / breakdown' questions.

## Run it with the CLI

```bash
kirha tools run openfda_getDrugAdverseEventCounts \
  --input '{
    "countBy": "reaction"
  }'
```

`--input` takes a JSON object that matches the input schema. Pass `--input -` to read it from stdin.

## Call it over HTTP

```bash
curl https://api.kirha.com/tools/v1/execute \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: **********' \
  --data '{
  "tool_name": "openfda_getDrugAdverseEventCounts",
  "input": {
    "countBy": "reaction"
  }
}'
```

Replace the stars with an API key from https://app.kirha.com/api-keys.

## Input schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "countBy": {
      "enum": [
        "reaction",
        "sex",
        "seriousness",
        "reporter",
        "country",
        "outcome"
      ],
      "type": "string"
    },
    "drugName": {
      "description": "Brand or generic name, e.g. \"ibuprofen\"",
      "type": "string"
    },
    "endDate": {
      "description": "YYYY-MM-DD",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "type": "string"
    },
    "limit": {
      "default": 25,
      "maximum": 50,
      "minimum": 1,
      "type": "integer"
    },
    "reaction": {
      "description": "e.g., nausea, headache",
      "type": "string"
    },
    "serious": {
      "type": "boolean"
    },
    "startDate": {
      "description": "YYYY-MM-DD",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "type": "string"
    }
  },
  "required": [
    "countBy"
  ],
  "type": "object"
}
```

## Output schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "context": {
      "type": "string"
    },
    "countBy": {
      "type": "string"
    },
    "queryUrl": {
      "description": "openFDA query behind these counts",
      "type": "string"
    },
    "results": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "count": {
            "type": "number"
          },
          "label": {
            "type": "string"
          },
          "nonAdr": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "label",
          "count",
          "nonAdr"
        ],
        "type": "object"
      },
      "type": "array"
    }
  },
  "required": [
    "context",
    "countBy",
    "queryUrl",
    "results"
  ],
  "type": "object"
}
```

## Related tools

Other OpenFDA tools that this tool refers to, or that refer to it.

- [`searchDrugAdverseEvents`](https://kirha.com/providers/openfda/searchDrugAdverseEvents.md)
- [`getDrugReactionDisproportionality`](https://kirha.com/providers/openfda/getDrugReactionDisproportionality.md)

-----

[All OpenFDA tools](https://kirha.com/providers/openfda.md) · [< Back to tools list](https://kirha.com/tools.md)