# Authy Reporting API

> \[!WARNING]
>
> As of November 2022, Twilio no longer provides support for Authy SMS/Voice-only customers. Customers who were also using Authy TOTP or Push prior to March 1, 2023 are still supported. The Authy API is now closed to new customers and will be fully deprecated in the future.
>
> For new development, we encourage you to use the [Verify v2 API](/docs/verify/api).
>
> Existing customers will not be impacted at this time until Authy API has reached End of Life. For more information about migration, see [Migrating from Authy to Verify for SMS](https://www.twilio.com/blog/migrate-authy-to-verify).

The Authy Reporting API offers powerful query capability to get detailed information about your application usage. The API has three report type endpoints:

1. [Events](#events)
2. [Date Histogram](#date-histogram)
3. [Terms](#terms)

## **Events**

```bash
GET https://api.authy.com/protected/{FORMAT}/reporting/events
```

### URL

| Name            | Description                                                        |
| :-------------- | :----------------------------------------------------------------- |
| `FORMAT` String | The format to expect back from the REST API call. `json` or `xml`. |

### Parameters \[#events-parameters]

| Name                          | Description                                                                                                                                                                                |
| :---------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `query` String (optional)     | Query to filter list of events in response. Default is everything. See [query format](#query-format) ([📇 PII](/docs/glossary/what-is-personally-identifiable-information-pii#pii-fields)) |
| `page`  Integer (optional)    | Page within paginated results to display. Default is 1. ([🏢 not PII](/docs/glossary/what-is-personally-identifiable-information-pii#fields-marked-not-pii) )                              |
| `per_page` Integer (optional) | Number of events to display per request. Default is 50. Maximum is 100. ([🏢 not PII](/docs/glossary/what-is-personally-identifiable-information-pii#fields-marked-not-pii) )              |

### Response \[#events-response]

Response will either be in `json` or `xml` format depending on the format provided in the URL

| Name              | Description                                                                                                                                                                                                                                                                                                                                         |
| :---------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `success` Boolean | Returns `true` if the request was successful. ([🏢 not PII](/docs/glossary/what-is-personally-identifiable-information-pii#fields-marked-not-pii) )                                                                                                                                                                                                 |
| `events` Array    | List of event objects. Each event contains the following fields:-`event`: name of the event.-`time`: time of the event in ISO8601 format.-`request_id`: UUID of the request.-`objects`: additional information about the event.See examples for more details. ([📇 PII](/docs/glossary/what-is-personally-identifiable-information-pii#pii-fields)) |

> \[!WARNING]
>
> Use the `-g` (same as `--globoff`) option to switch off the "URL globbing parser" and allow cURL to process the square brackets in the query parameters.

Events Reporting API Example

```bash
curl -g \
  "https://api.authy.com/protected/json/reporting/events?query[event][eq]=one_touch_request_responded&query[objects.device.s_device_type][eq]=iphone&page=1&per_page=50" \
  -H "X-Authy-API-Key: d57d919d11e6b221c9bf6f7c882028f9"
```

```json
{
  "events":[
    {
      "event":"one_touch_request_responded",
      "time":"2019-09-13T21:51:42.262Z",
      "request_id":"EB03D0F0-1234-5678-9101-F5014BD54354",
      "objects":{
        "app":{
          "b_custom_code_allowed":false,
          "b_custom_message_allowed":false,
          "s_account_sid":"ACxxxxxxxxxxxxxxxxx",
          "s_device_app":null,
          "s_errors":"",
          "s_id":"12345",
          "s_name":"Demo Authy App",
          "s_type":"full"
        },
        "device":{
          "s_device_app":"authy",
          "s_device_type":"iphone",
          "s_errors":"",
          "s_id":"107469574",
          "s_ip":"IPv4_e123456789a28f09e7a02",
          "s_user_agent":"Authy 22.0 rv:99 (iPhone; iOS 12.0; en_US)",
          "s_version":"22.7",
          "t_creation_date":"2018-10-26T17:52:14.029Z",
          "t_last_used_date":"2019-09-06T05:31:24.030Z",
          "t_sync_date":"2019-09-13T21:49:06.463Z"
        },
        "onetouch_request":{
          "i_device_signing_time":0,
          "i_expiration_timestamp":1568497741,
          "i_seconds_to_expire":86400,
          "s_device_geolocation":null,
          "s_errors":"",
          "s_status":"denied",
          "s_uuid":"389b68e0-b89e-0137-546f-0a5fffce63e2"
        },
        "user":{
          "as_authy_ids":[
            "11123"
          ],
          "b_banned":false,
          "s_authy_id":"11123",
          "s_country_code":"1",
          "s_errors":"",
          "s_locale":"en",
          "s_phone_number":"ce65dc3e20xxxxxxxxxxxxxxxxc56ddee10071"
        }
      }
    },
    {
      "event":"one_touch_request_responded",
      "time":"2019-09-11T21:59:24.105Z",
      "request_id":"70D5FCF4-1234-5678-9101-9793BF7964D2",
      "objects":{
        "app":{
          "b_custom_code_allowed":false,
          "b_custom_message_allowed":false,
          "s_account_sid":"ACxxxxxxxxxxxxxxxxx",
          "s_device_app":null,
          "s_errors":"",
          "s_id":"12345",
          "s_name":"Demo Authy App",
          "s_type":"full"
        },
        "device":{
          "s_device_app":"authy",
          "s_device_type":"iphone",
          "s_errors":"",
          "s_id":"107469574",
          "s_ip":"IPv4_e123456789a28f09e7a02",
          "s_user_agent":"Authy 22.0 rv:99 (iPhone; iOS 12.0; en_US)",
          "s_version":"22.7",
          "t_creation_date":"2018-10-26T17:52:14.029Z",
          "t_last_used_date":"2019-09-06T05:31:24.030Z",
          "t_sync_date":"2019-09-13T21:49:06.463Z"
        },
        "onetouch_request":{
          "i_device_signing_time":0,
          "i_expiration_timestamp":1568325203,
          "i_seconds_to_expire":86400,
          "s_device_geolocation":null,
          "s_errors":"",
          "s_status":"approved",
          "s_uuid":"800a6240-b70c-0137-5285-02ad8be0ad1a"
        },
        "user":{
          "as_authy_ids":[
            "11123"
          ],
          "b_banned":false,
          "s_authy_id":"11123",
          "s_country_code":"1",
          "s_errors":"",
          "s_locale":"en",
          "s_phone_number":"ce65dc3e20xxxxxxxxxxxxxxxxc56ddee10071"
        }
      }
    }
  ],
  "success":true
}
```

### Query Format

Queries to the Events Reporting API follow the following pattern:

```bash
:query[:attribute][:operator]=:value
```

#### Supported Attributes and Available Events

Report queries can be filtered by the following events:

* [account\_recovery\_approved](/docs/authy/api/reporting/account_recovery_approved)
* [account\_recovery\_canceled](/docs/authy/api/reporting/account_recovery_canceled)
* [account\_recovery\_started](/docs/authy/api/reporting/account_recovery_started)
* [custom\_message\_not\_allowed](/docs/authy/api/reporting/custom_message_not_allowed)
* [device\_registration\_completed](/docs/authy/api/reporting/device_registration_completed)
* [multidevice\_setting\_changed](/docs/authy/api/reporting/multidevice_setting_changed)
* [one\_touch\_request\_responded](/docs/authy/api/reporting/one_touch_request_responded) (note: one\_touch refers to the [Authy Push Authentication API](/docs/authy/api/push-authentications)
* [phone\_change\_canceled](/docs/authy/api/reporting/phone_change_canceled)
* [phone\_change\_pin\_sent](/docs/authy/api/reporting/phone_change_requested)
* [phone\_change\_requested](/docs/authy/api/reporting/phone_change_requested)
* [suspended\_account](/docs/authy/api/reporting/suspended_account)
* [token\_invalid](/docs/authy/api/reporting/token_invalid)
* [token\_verified](/docs/authy/api/reporting/token_verified)
* [too\_many\_code\_verifications](/docs/authy/api/reporting/too_many_code_verifications)
* [totp\_token\_sent\_via\_call](/docs/authy/api/reporting/totp_token_sent_via_call)
* [totp\_token\_sent](/docs/authy/api/reporting/totp_token_sent)
* [unlock\_method\_changed](/docs/authy/api/reporting/unlock_method_changed)
* [user\_account\_deleted](/docs/authy/api/reporting/user_account_deleted)
* [user\_added](/docs/authy/api/reporting/user_added)
* [user\_phone\_changed](/docs/authy/api/reporting/user_phone_changed)

The following events are specific to our legacy phone verification API. Please consider [upgrading to Verify V2:](/docs/verify/migrating-1x-2x)

* [phone\_verification\_code\_is\_invalid](/docs/authy/api/reporting/phone_verification_code_is_invalid)
* [phone\_verification\_code\_is\_valid](/docs/authy/api/reporting/phone_verification_code_is_valid)
* [phone\_verification\_failed](/docs/authy/api/reporting/phone_verification_failed)
* [phone\_verification\_not\_found](/docs/authy/api/reporting/phone_verification_not_found)
* [phone\_verification\_started](/docs/authy/api/reporting/phone_verification_started)
* [too\_many\_phone\_verifications](/docs/authy/api/reporting/too_many_phone_verifications)

Queries can filter based on top level event details like name:

```bash
query[event][eq]=one_touch_request_responded
```

Queries can also filter based on nested parameters like device type:

```bash
query[objects.device.s_device_type][eq]=iphone
```

Multiple queries in one request are supported:

```bash
query[event][eq]=totp_token_sent&query[objects.user.s_locale][eq]=en
```

#### Supported Operators

The following operators can be used to compare and filter event attributes.

| **Operator** | **Description**          |
| ------------ | ------------------------ |
| `eq`         | Equal to                 |
| `lt`         | Less than                |
| `lte`        | Less than or Equal to    |
| `gt`         | Greater than             |
| `gte`        | Greater than or Equal to |
| `lk`         | Like or similar to       |

Date Histogram Reporting API Example

```bash
curl -g \
  "https://api.authy.com/protected/json/reporting/date_histogram?report[users_added][event][eq]=user_added&interval=month&page=1&per_page=10" \
  -H "X-Authy-API-Key: d57d919d11e6b221c9bf6f7c882028f9"
```

```json
{
  "interval":"month",
  "reports":{
    "users_added":[
      {
        "timestamp":1517443200000,
        "time":"2018-02-01T00:00:00.000Z",
        "count":45
      },
      {
        "timestamp":1519862400000,
        "time":"2018-03-01T00:00:00.000Z",
        "count":74
      },
      {
        "timestamp":1525132800000,
        "time":"2018-05-01T00:00:00.000Z",
        "count":23
      },
      {
        "timestamp":1527811200000,
        "time":"2018-06-01T00:00:00.000Z",
        "count":100
      },
      {
        "timestamp":1530403200000,
        "time":"2018-07-01T00:00:00.000Z",
        "count":30004
      },
      {
        "timestamp":1533081600000,
        "time":"2018-08-01T00:00:00.000Z",
        "count":634
      },
      {
        "timestamp":1538352000000,
        "time":"2018-10-01T00:00:00.000Z",
        "count":43
      },
      {
        "timestamp":1543622400000,
        "time":"2018-12-01T00:00:00.000Z",
        "count":1
      },
      {
        "timestamp":1546300800000,
        "time":"2019-01-01T00:00:00.000Z",
        "count":45
      },
      {
        "timestamp":1548979200000,
        "time":"2019-02-01T00:00:00.000Z",
        "count":65
      }
    ]
  },
  "success":true
}
```

## **Date Histogram**

The following endpoint uses the querier service to return **summaries over time** of the queried events.

```bash
GET https://api.authy.com/protected/{FORMAT}/reporting/date_histogram
```

### URL

| Name            | Description                                                        |
| :-------------- | :----------------------------------------------------------------- |
| `FORMAT` String | The format to expect back from the REST API call. `json` or `xml`. |

### Parameters \[#date-histogram-parameters]

| Name                                                            | Description                                                                                                                                                                                                                                                                                                                |
| :-------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `report[:report_name][:attribute][:operator]` String (required) | Defines the queries to run, no reports returned if omitted. -`:report_name`: your name for the report summary-`:attribute`: See [query format](#query-format)-`:operator`: See [supported operators](#supported-operators)([📇 PII](/docs/glossary/what-is-personally-identifiable-information-pii#pii-fields))            |
| `interval` String (optional)                                    | Default is `month`. Allowed values are: `year`, `quarter`, `month`, `week`, `day`, `hour`, `minute`. `interval` also supports time settings like `1.5h` (up to `w` for weeks).                                                                                                                                             |
| `scope[:attribute][:operator]` String (optional)                | Defines a filter for the query. Multiple scopes are supported. For example `scope[user.authy_id][eq]=123` will only return results for that user. See [query format](#query-format) and [supported operators](#supported-operators). ([📇 PII](/docs/glossary/what-is-personally-identifiable-information-pii#pii-fields)) |
| `page`  Integer (optional)                                      | Page within paginated results to display. Default is 1. ([🏢 not PII](/docs/glossary/what-is-personally-identifiable-information-pii#fields-marked-not-pii) )                                                                                                                                                              |
| `per_page` Integer (optional)                                   | Number of events to display per request. Default is 50. Maximum is 100. ([🏢 not PII](/docs/glossary/what-is-personally-identifiable-information-pii#fields-marked-not-pii) )                                                                                                                                              |

### Response \[#date-histogram-response]

Response will either be in `json` or `xml` format depending on the format provided in the URL

| Name              | Description                                                                                                                                                                                                                                                                                                                    |
| :---------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `success` Boolean | Returns `true` if the request was successful. ([🏢 not PII](/docs/glossary/what-is-personally-identifiable-information-pii#fields-marked-not-pii) )                                                                                                                                                                            |
| `reports` Array   | List of report objects. Each report contains the following fields-`timestamp`: interval timestamp in Epoch format.-`time`: interval time in ISO8601 format.-`count`: number of times the event occurred in the interval. ([🏢 not PII](/docs/glossary/what-is-personally-identifiable-information-pii#fields-marked-not-pii) ) |

Terms Reporting API Example

```bash
curl -g \
  "https://api.authy.com/protected/json/reporting/terms?field=event&scope[time][gte]=2019-01-01T00:00:00.000Z&scope[time][lt]=2020-01-01T00:00:00.000Z" \
  -H "X-Authy-API-Key: d57d919d11e6b221c9bf6f7c882028f9"
```

```json
{
  "terms":[
    {
      "key":"one_touch_request_responded",
      "count":667
    },
    {
      "key":"totp_token_sent",
      "count":362
    },
    {
      "key":"token_verified",
      "count":164
    },
    {
      "key":"token_invalid",
      "count":155
    },
    {
      "key":"user_added",
      "count":81
    },
    {
      "key":"user_removed",
      "count":53
    }
  ],
  "success":true
}
```

## **Terms**

The following endpoint groups by `field` to roll-up summaries of specific attributes.

```bash
GET https://api.authy.com/protected/{FORMAT}/reporting/terms
```

### URL

| Name            | Description                                                        |
| :-------------- | :----------------------------------------------------------------- |
| `FORMAT` String | The format to expect back from the REST API call. `json` or `xml`. |

### Parameters \[#terms-parameters]

| Name                                             | Description                                                                                                                                                                                                                                                                                                                                                                                                                       |
| :----------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `field` String (required)                        | Defines the attribute to group by. Only one field is supported per query. Queries can group by top level event details like name (`event`) or nested parameters like device type (`objects.device.s_device_type`). For a list of supported events and their fields, see [Supported Attributes](#supported-attributes-and-available-events). ([📇 PII](/docs/glossary/what-is-personally-identifiable-information-pii#pii-fields)) |
| `size` Integer (optional)                        | Number of terms to return. Default is 10. Maximum is 100. ([🏢 not PII](/docs/glossary/what-is-personally-identifiable-information-pii#fields-marked-not-pii) )                                                                                                                                                                                                                                                                   |
| `scope[:attribute][:operator]` String (optional) | Defines a filter for the query. Multiple scopes are supported. For example `scope[user.authy_id][eq]=123` will only return results for that user. See [query format](#query-format) and [supported operators](#supported-operators). ([📇 PII](/docs/glossary/what-is-personally-identifiable-information-pii#pii-fields))                                                                                                        |

### Response \[#terms-response]

Response will either be in `json` or `xml` format depending on the format provided in the URL

| Name              | Description                                                                                                                                                                                                                                                  |
| :---------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `success` Boolean | Returns `true` if the request was successful. ([🏢 not PII](/docs/glossary/what-is-personally-identifiable-information-pii#fields-marked-not-pii) )                                                                                                          |
| `terms` Array     | List of term objects. Each term contains the following fields-`key`: field grouping (String)-`count`: number of occurrences within the scope (Integer) ([🏢 not PII](/docs/glossary/what-is-personally-identifiable-information-pii#fields-marked-not-pii) ) |

### Examples \[#terms-examples]

> \[!WARNING]
>
> Seeing this error?
>
> `[globbing] bad range in column`
>
> Make sure to use the `-g` (same as `--globoff`) option to switch off the "URL globbing parser" and allow cURL to process the square brackets in the query parameters.

Events: Get logs from December 17, 2019

```bash
curl -g \
  "https://api.authy.com/protected/json/reporting/events?query[time][gte]=2019-12-17T00:00:00.000Z&query[time][lte]=2019-12-17T23:59:59.999Z" \
  -H "X-Authy-API-Key: d57d919d11e6b221c9bf6f7c882028f9"
```

```json
{
  "events":[
    {
      "event":"totp_token_sent",
      "time":"2019-12-17T20:32:23.601Z",
      "request_id":"foo06a5ed13a1234567890ec30458e104",
      "objects":{
        "app":{
          "b_custom_code_allowed":false,
          "b_custom_message_allowed":false,
          "s_account_sid":"ACxxxxxxxxxxxxxxxxx",
          "s_device_app":null,
          "s_errors":"",
          "s_id":"12345",
          "s_name":"Demo Authy App",
          "s_type":"full"
        },
        "user":{
          "as_authy_ids":[
            "11123"
          ],
          "b_banned":false,
          "s_authy_id":"11123",
          "s_country_code":"1",
          "s_errors":"",
          "s_locale":"en",
          "s_phone_number":"ce65dc3e20xxxxxxxxxxxxxxxxc56ddee10071"
        }
      }
    },
    {
      "event":"totp_token_sent",
      "time":"2019-12-17T20:27:32.189Z",
      "request_id":"bar06a5ed13a1234567890ec30458e501",
      "objects":{
        "app":{
          "b_custom_code_allowed":false,
          "b_custom_message_allowed":false,
          "s_account_sid":"ACxxxxxxxxxxxxxxxxx",
          "s_device_app":null,
          "s_errors":"",
          "s_id":"12345",
          "s_name":"Demo Authy App",
          "s_type":"full"
        },
        "user":{
          "as_authy_ids":[
            "11123"
          ],
          "b_banned":false,
          "s_authy_id":"11123",
          "s_country_code":"1",
          "s_errors":"",
          "s_locale":"en",
          "s_phone_number":"ce65dc3e20xxxxxxxxxxxxxxxxc56ddee10071"
        }
      }
    },
    {
      "event":"user_added",
      "time":"2019-12-17T20:22:24.556Z",
      "request_id":"baz06a5ed13a1234567890ec30458e501",
      "objects":{
        "app":{
          "b_custom_code_allowed":false,
          "b_custom_message_allowed":false,
          "s_account_sid":"ACxxxxxxxxxxxxxxxxx",
          "s_device_app":null,
          "s_errors":"",
          "s_id":"12345",
          "s_name":"Demo Authy App",
          "s_type":"full"
        },
        "user":{
          "as_authy_ids":[
            "11123"
          ],
          "b_banned":false,
          "s_authy_id":"11123",
          "s_country_code":"1",
          "s_errors":"",
          "s_locale":"en",
          "s_phone_number":"ce65dc3e20xxxxxxxxxxxxxxxxc56ddee10071"
        }
      }
    }
  ],
  "success":true
}
```

Events: Authentication Details Q2 2019

```bash
curl -g \
  "https://api.authy.com/protected/json/reporting/events?query[time][gte]=2019-04-01T00:00:00.000Z&query[time][lt]=2019-07-01T00:00:00.000Z&page=2&per_page=5" \
  -H "X-Authy-API-Key: d57d919d11e6b221c9bf6f7c882028f9"
```

```json
{
  "events":[
    {
      "event":"one_touch_request_responded",
      "time":"2019-04-03T21:15:11.193Z",
      "request_id":"6FCA925A-9D07-4DFE-B160-84A760A7620C",
      "objects":{
        "app":{
          "b_custom_code_allowed":false,
          "b_custom_message_allowed":false,
          "s_account_sid":"ACxxxxxxxxxxxxxxxxx",
          "s_device_app":null,
          "s_errors":"",
          "s_id":"12345",
          "s_name":"Demo Authy App",
          "s_type":"full"
        },
        "device":{
          "s_device_app":"authy",
          "s_device_type":"iphone",
          "s_errors":"",
          "s_id":"107469574",
          "s_ip":"IPv4_e123456789a28f09e7a02",
          "s_user_agent":"Authy 22.0 rv:99 (iPhone; iOS 12.0; en_US)",
          "s_version":"22.7",
          "t_creation_date":"2018-10-26T17:52:14.029Z",
          "t_last_used_date":"2019-09-06T05:31:24.030Z",
          "t_sync_date":"2019-09-13T21:49:06.463Z"
        },
        "onetouch_request":{
          "i_device_signing_time":0,
          "i_expiration_timestamp":1568497741,
          "i_seconds_to_expire":86400,
          "s_device_geolocation":null,
          "s_errors":"",
          "s_status":"denied",
          "s_uuid":"389b68e0-b89e-0137-546f-0a5fffce63e2"
        },
        "user":{
          "as_authy_ids":[
            "11123"
          ],
          "b_banned":false,
          "s_authy_id":"11123",
          "s_country_code":"1",
          "s_errors":"",
          "s_locale":"en",
          "s_phone_number":"ce65dc3e20xxxxxxxxxxxxxxxxc56ddee10071"
        }
      }
    },
    {
      "event":"one_touch_request_responded",
      "time":"2019-04-03T21:14:16.777Z",
      "request_id":"859CA085-6353-4925-AD69-911CB1256BCA",
      "objects":{
        "app":{
          "b_custom_code_allowed":false,
          "b_custom_message_allowed":false,
          "s_account_sid":"ACxxxxxxxxxxxxxxxxx",
          "s_device_app":null,
          "s_errors":"",
          "s_id":"12345",
          "s_name":"Demo Authy App",
          "s_type":"full"
        },
        "device":{
          "s_device_app":"authy",
          "s_device_type":"iphone",
          "s_errors":"",
          "s_id":"107469574",
          "s_ip":"IPv4_e123456789a28f09e7a02",
          "s_user_agent":"Authy 22.0 rv:99 (iPhone; iOS 12.0; en_US)",
          "s_version":"22.7",
          "t_creation_date":"2018-10-26T17:52:14.029Z",
          "t_last_used_date":"2019-09-06T05:31:24.030Z",
          "t_sync_date":"2019-09-13T21:49:06.463Z"
        },
        "onetouch_request":{
          "i_device_signing_time":0,
          "i_expiration_timestamp":1568497741,
          "i_seconds_to_expire":86400,
          "s_device_geolocation":null,
          "s_errors":"",
          "s_status":"denied",
          "s_uuid":"389b68e0-b89e-0137-546f-0a5fffce63e2"
        },
        "user":{
          "as_authy_ids":[
            "11123"
          ],
          "b_banned":false,
          "s_authy_id":"11123",
          "s_country_code":"1",
          "s_errors":"",
          "s_locale":"en",
          "s_phone_number":"ce65dc3e20xxxxxxxxxxxxxxxxc56ddee10071"
        }
      }
    },
    {
      "event":"token_verified",
      "time":"2019-04-03T19:58:41.978Z",
      "request_id":"b058ce28cfddcbadeabda9a10f93f6a6",
      "objects":{
        "app":{
          "b_custom_code_allowed":false,
          "b_custom_message_allowed":false,
          "s_account_sid":"ACxxxxxxxxxxxxxxxxx",
          "s_device_app":null,
          "s_errors":"",
          "s_id":"12345",
          "s_name":"Demo Authy App",
          "s_type":"full"
        },
        "token":{
          "s_id":"75512345",
          "s_type":"SmsToken"
        },
        "user":{
          "as_authy_ids":[
            "11123"
          ],
          "b_banned":false,
          "s_authy_id":"11123",
          "s_country_code":"1",
          "s_errors":"",
          "s_locale":"en",
          "s_phone_number":"ce65dc3e20xxxxxxxxxxxxxxxxc56ddee10071"
        }
      }
    },
    {
      "event":"totp_token_sent",
      "time":"2019-04-03T19:58:29.403Z",
      "request_id":"3dbcc130b48294c7abb1ef94dfbb2710",
      "objects":{
        "app":{
          "b_custom_code_allowed":false,
          "b_custom_message_allowed":false,
          "s_account_sid":"ACxxxxxxxxxxxxxxxxx",
          "s_device_app":null,
          "s_errors":"",
          "s_id":"12345",
          "s_name":"Demo Authy App",
          "s_type":"full"
        },
        "user":{
          "as_authy_ids":[
            "11123"
          ],
          "b_banned":false,
          "s_authy_id":"11123",
          "s_country_code":"1",
          "s_errors":"",
          "s_locale":"en",
          "s_phone_number":"ce65dc3e20xxxxxxxxxxxxxxxxc56ddee10071"
        }
      }
    },
    {
      "event":"too_many_code_verifications",
      "time":"2019-03-19T21:15:33.2Z",
      "request_id":"44f1a17d42bb458bd4c74928fc20b445",
      "objects":{
        "app":{
          "b_custom_code_allowed":false,
          "b_custom_message_allowed":false,
          "s_account_sid":"ACxxxxxxxxxxxxxxxxx",
          "s_device_app":null,
          "s_errors":"",
          "s_id":"12345",
          "s_name":"Demo Authy App",
          "s_type":"full"
        }
      }
    }
  ],
  "success":true
}
```

Date Histogram: Get Invalid Tokens and Valid Tokens over time

```bash
curl -g \
  "https://api.authy.com/protected/json/reporting/date_histogram?interval=month&report[verified_tokens][event][eq]=token_verified&report[invalid_tokens][event][eq]=token_invalid" \
  -H "X-Authy-API-Key: d57d919d11e6b221c9bf6f7c882028f9"
```

```json
{
  "interval":"month",
  "reports":{
    "invalid_tokens":[
      {
        "timestamp":1517443200000,
        "time":"2018-02-01T00:00:00.000Z",
        "count":0
      },
      {
        "timestamp":1519862400000,
        "time":"2018-03-01T00:00:00.000Z",
        "count":4
      },
      {
        "timestamp":1525132800000,
        "time":"2018-05-01T00:00:00.000Z",
        "count":0
      },
      {
        "timestamp":1527811200000,
        "time":"2018-06-01T00:00:00.000Z",
        "count":0
      },
      {
        "timestamp":1530403200000,
        "time":"2018-07-01T00:00:00.000Z",
        "count":0
      },
      {
        "timestamp":1533081600000,
        "time":"2018-08-01T00:00:00.000Z",
        "count":2
      },
      {
        "timestamp":1538352000000,
        "time":"2018-10-01T00:00:00.000Z",
        "count":1
      },
      {
        "timestamp":1543622400000,
        "time":"2018-12-01T00:00:00.000Z",
        "count":0
      },
      {
        "timestamp":1546300800000,
        "time":"2019-01-01T00:00:00.000Z",
        "count":0
      },
      {
        "timestamp":1548979200000,
        "time":"2019-02-01T00:00:00.000Z",
        "count":3
      },
      {
        "timestamp":1551398400000,
        "time":"2019-03-01T00:00:00.000Z",
        "count":0
      },
      {
        "timestamp":1554076800000,
        "time":"2019-04-01T00:00:00.000Z",
        "count":0
      },
      {
        "timestamp":1556668800000,
        "time":"2019-05-01T00:00:00.000Z",
        "count":0
      },
      {
        "timestamp":1559347200000,
        "time":"2019-06-01T00:00:00.000Z",
        "count":0
      },
      {
        "timestamp":1567296000000,
        "time":"2019-09-01T00:00:00.000Z",
        "count":1
      },
      {
        "timestamp":1569888000000,
        "time":"2019-10-01T00:00:00.000Z",
        "count":0
      }
    ],
    "verified_tokens":[
      {
        "timestamp":1517443200000,
        "time":"2018-02-01T00:00:00.000Z",
        "count":0
      },
      {
        "timestamp":1519862400000,
        "time":"2018-03-01T00:00:00.000Z",
        "count":7
      },
      {
        "timestamp":1525132800000,
        "time":"2018-05-01T00:00:00.000Z",
        "count":0
      },
      {
        "timestamp":1527811200000,
        "time":"2018-06-01T00:00:00.000Z",
        "count":4
      },
      {
        "timestamp":1530403200000,
        "time":"2018-07-01T00:00:00.000Z",
        "count":0
      },
      {
        "timestamp":1533081600000,
        "time":"2018-08-01T00:00:00.000Z",
        "count":0
      },
      {
        "timestamp":1538352000000,
        "time":"2018-10-01T00:00:00.000Z",
        "count":0
      },
      {
        "timestamp":1543622400000,
        "time":"2018-12-01T00:00:00.000Z",
        "count":5
      },
      {
        "timestamp":1546300800000,
        "time":"2019-01-01T00:00:00.000Z",
        "count":3
      },
      {
        "timestamp":1548979200000,
        "time":"2019-02-01T00:00:00.000Z",
        "count":3
      },
      {
        "timestamp":1551398400000,
        "time":"2019-03-01T00:00:00.000Z",
        "count":1
      },
      {
        "timestamp":1554076800000,
        "time":"2019-04-01T00:00:00.000Z",
        "count":1
      },
      {
        "timestamp":1556668800000,
        "time":"2019-05-01T00:00:00.000Z",
        "count":0
      },
      {
        "timestamp":1559347200000,
        "time":"2019-06-01T00:00:00.000Z",
        "count":0
      },
      {
        "timestamp":1567296000000,
        "time":"2019-09-01T00:00:00.000Z",
        "count":12
      },
      {
        "timestamp":1569888000000,
        "time":"2019-10-01T00:00:00.000Z",
        "count":0
      }
    ]
  },
  "success":true
}
```

Date Histogram: Verified Tokens with Scope

```bash
curl -g \
  "https://api.authy.com/protected/json/reporting/date_histogram?scope[time][gte]=2019-04-01T00:00:00.000Z&scope[time][lt]=2019-07-01T00:00:00.000Z&report[verified_tokens][event][eq]=token_verified" \
  -H "X-Authy-API-Key: d57d919d11e6b221c9bf6f7c882028f9"
```

```json
{
  "interval":"month",
  "reports":{
    "verified_tokens":[
      {
        "timestamp":1554076800000,
        "time":"2019-04-01T00:00:00.000Z",
        "count":56
      },
      {
        "timestamp":1556668800000,
        "time":"2019-05-01T00:00:00.000Z",
        "count":129
      },
      {
        "timestamp":1559347200000,
        "time":"2019-06-01T00:00:00.000Z",
        "count":543
      }
    ]
  },
  "success":true
}
```

Terms: Monthly Active Users

```bash
curl -g \
  "https://api.authy.com/protected/json/reporting/terms?field=objects.user.s_authy_id&scope[time][gte]=2019-11-01T00:00:00.000Z&scope[time][lt]=2019-12-01T00:00:00.000Z" \
  -H "X-Authy-API-Key: d57d919d11e6b221c9bf6f7c882028f9"
```

```json
{
  "terms":[
    {
      "key":"123",
      "count":99
    },
    {
      "key":"321",
      "count":197
    },
    {
      "key":"452",
      "count":1
    },
    {
      "key":"942",
      "count":140005
    },
    {
      "key":"23",
      "count":14
    {
      "key":"6792",
      "count":5
    }
  ],
  "success":true
}
```

Terms: Authentications by Device Type

```bash
curl -g \
  "https://api.authy.com/protected/json/reporting/terms?field=objects.device.s_device_type&scope[time][gte]=2019-01-01T00:00:00.000Z&scope[time][lt]=2020-01-01T00:00:00.000Z" \
  -H "X-Authy-API-Key: d57d919d11e6b221c9bf6f7c882028f9"
```

```json
{
  "terms":[
    {
      "key":"iphone",
      "count":43823
    },
    {
      "key":"android",
      "count":2390235
    },
    {
      "key":"chrome",
      "count":145
    }
  ],
  "success":true
}
```

### Rate Limits

Rate limits are enforced by the Authy API. If your application hits the rate limit, an error will be returned and the app will be temporarily suspended.

| **Limit** | **Time**   | **Context**     |
| --------- | ---------- | --------------- |
| 30        | per minute | per application |
| 300       | per hour   | per application |
