<commit_before>---
layout: page
weight: 0
title: General Statistics
navigation:
  show: true
---

{% anchor h2 %}
Retrieve Statistics
{% endanchor %}

{% info %}
You can specify either the days parameter or the start_date and end_date parameters. If provided with no parameters, the current day's statistics are returned.
{% endinfo %}

{% anchor h2 %}
Parameters
{% endanchor %}

<table class="table table-bordered table-striped">
  <tbody>
    <tr>
      <th>Parameter</th>

      <th>Required</th>

      <th>Requirements</th>

      <th>Description</th>
    </tr>

    <tr>
      <td>days</td>

      <td>No</td>

      <td>Must be an integer greater than 0</td>

      <td>Number of days in the past to include statistics (Includes today)</td>
    </tr>

    <tr>
      <td>start_date</td>

      <td>No</td>

      <td>Date must be in YYYY-MM-DD format and be before the end_date parameter</td>

      <td>The start date to look up statistics</td>
    </tr>

    <tr>
      <td>end_date</td>

      <td>No</td>

      <td>Date must be in YYYY-MM-DD format and be after the start_date parameter</td>

      <td>The end date to look up statistics</td>
    </tr>

    <tr>
      <td>aggregate</td>

      <td>No</td>

      <td>0 or 1</td>

      <td>This is used to indicate you are interested in all-time totals</td>
     <tr>
      <td>category</td>

      <td>No</td>

      <td>Must be an existing category, or an array of existing categories.</td>

      <td>The category for which to retrieve detailed stats</td>
    </tr>
   </tr>
  </tbody>
</table>


{% apiexample activate POST https://api.sendgrid.com/api/stats.get api_user=your_sendgrid_username&api_key=your_sendgrid_password&days=2 %}
  {% response json %}
[
  {
    "date": "2009-06-20",
    "requests": 12342,
    "bounces": 12,
    "clicks": 10223,
    "opens": 9992,
    "spamreports": 5,
    "unique_clicks": 3,
    "unique_opens": 6,
    "blocked": 7
  },
  {
    "date": "2009-06-21",
    "requests": 32342,
    "bounces": 10,
    "clicks": 14323,<commit_msg>duplicate closing tag<commit_after>---
layout: page
weight: 0
title: General Statistics
navigation:
  show: true
---

{% anchor h2 %}
Retrieve Statistics
{% endanchor %}

{% info %}
You can specify either the days parameter or the start_date and end_date parameters. If provided with no parameters, the current day's statistics are returned.
{% endinfo %}

{% anchor h2 %}
Parameters
{% endanchor %}

<table class="table table-bordered table-striped">
  <tbody>
    <tr>
      <th>Parameter</th>

      <th>Required</th>

      <th>Requirements</th>

      <th>Description</th>
    </tr>

    <tr>
      <td>days</td>

      <td>No</td>

      <td>Must be an integer greater than 0</td>

      <td>Number of days in the past to include statistics (Includes today)</td>
    </tr>

    <tr>
      <td>start_date</td>

      <td>No</td>

      <td>Date must be in YYYY-MM-DD format and be before the end_date parameter</td>

      <td>The start date to look up statistics</td>
    </tr>

    <tr>
      <td>end_date</td>

      <td>No</td>

      <td>Date must be in YYYY-MM-DD format and be after the start_date parameter</td>

      <td>The end date to look up statistics</td>
    </tr>

    <tr>
      <td>aggregate</td>

      <td>No</td>

      <td>0 or 1</td>

      <td>This is used to indicate you are interested in all-time totals</td>
     <tr>
      <td>category</td>

      <td>No</td>

      <td>Must be an existing category, or an array of existing categories.</td>

      <td>The category for which to retrieve detailed stats</td>
    </tr>
  </tbody>
</table>


{% apiexample activate POST https://api.sendgrid.com/api/stats.get api_user=your_sendgrid_username&api_key=your_sendgrid_password&days=2 %}
  {% response json %}
[
  {
    "date": "2009-06-20",
    "requests": 12342,
    "bounces": 12,
    "clicks": 10223,
    "opens": 9992,
    "spamreports": 5,
    "unique_clicks": 3,
    "unique_opens": 6,
    "blocked": 7
  },
  {
    "date": "2009-06-21",
    "requests": 32342,
    "bounces": 10,
    "clicks": 14323,
{'fraction_non_alphanumeric': 0.14721061685917916, 'fraction_numerical': 0.027033669206193166, 'mean_word_length': 2.601769911504425, 'pattern_counts': {'":': 26, '<': 130, '<?xml version=': 0, '>': 130, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6714100', 'n_tokens_mistral': 1573, 'n_tokens_neox': 1400, 'n_words': 402}