---
title: Mobile crash count and crash rate example (v2)
source: https://docs.newrelic.com/docs/apis/rest-api-v2/mobile-examples-v2/mobile-crash-count-crash-rate-example-v2
---

This describes how to use the New Relic REST API (v2) to get your mobile application's overall and version-specific **crash count** and **crash rate**, which appear on the [**Summary** page](https://docs.newrelic.com/docs/mobile-monitoring/mobile-monitoring-ui/mobile-app-pages/mobile-apps-overview-page) in the upper right corner.

> #### ⚠️ IMPORTANT
>
> While the examples utilize New Relic's REST API v2, we recommend using [NRQL functions](https://docs.newrelic.com/docs/nrql/get-started/introduction-nrql-new-relics-query-language/) for executing metric timeslice queries. Each API value can be mapped to an equivalent NRQL function. To learn how to create NRQL queries based on these API examples, refer to our [documentation](https://docs.newrelic.com/docs/apis/rest-api-v2/migrate-to-nrql/).

These examples use the default time period of the last 30 minutes. To obtain crash data for a different [time range](https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/specifying-time-range-v2), add the time period to the commands.

> #### 💡 TIP
>
> You can also use the New Relic API Explorer to retrieve [mobile metric data](https://api.newrelic.com/docs/#/Mobile%20Applications/get_mobile_applications__mobile_application_id__metrics_data_json).

## Prerequisites [#prereqs]

To use the API in these examples, you need:

-   Your New Relic [REST API key](https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key)
-   Your New Relic mobile monitoring app ID or your mobile monitoring app version ID.

To find the mobile monitoring app ID, see [Finding the product ID: mobile monitoring](https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/finding-product-id#mobile).

To find the mobile monitoring app version ID, see [Find the mobile app version ID](#mobile-app-version-id) below.

## Mobile app: Get crash data [#app-crash-data]

To obtain crash count and crash rate data for the overall mobile application, use the [mobile application ID](https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/finding-product-id#mobile) in the following REST API command:

```sh
curl -X GET "https://api.newrelic.com/v2/mobile_applications/$MOBILE_ID.json" \
     -H "X-Api-Key:$API_KEY" -i
```

The `crash_summary` output data contains both the `crash_count` and `crash_rate`.

```json
{
  "crash_summary": {
    "supports_crash_data": true,
    "unresolved_crash_count": 14,
    "crash_rate": 28.155339805825243
  }
}
```

To obtain crash summary data for all the mobile applications in the account, use this REST API command:

```sh
curl -X GET "https://api.newrelic.com/v2/mobile_applications.json" \
     -H "X-Api-Key:$API_KEY" -i
```

## Mobile app version: Get crash count data [#crash-count-version]

To obtain the crash count metric data for a specific version of the mobile application, include the [mobile application version ID](#mobile-app-version-id) in the following REST API command:

```sh
curl -X GET "https://api.newrelic.com/v2/mobile_applications/$MOBILE_APP_VERSION/metrics/data.json" \
     -H "X-Api-Key:$API_KEY" -i \
     -d 'name=Mobile/Crash/All&values[]=call_count&summarize=true'
```

## Mobile app version: Get crash rate data [#crash-rate-version]

To calculate a specific version's crash rate, use the following equation:

```
Crash Rate = (Mobile/Crash/All:call_count) / (Session/Start:call_count)
```

To get the two metric values needed in the equation, use the following REST API command with the [mobile application version ID](#mobile-app-version-id) .

```sh
curl -X GET "https://api.newrelic.com/v2/mobile_applications/$MOBILE_APP_VERSION/metrics/data.json" \
     -H "X-Api-Key:$API_KEY" -i \
     -d 'names[]=Mobile/Crash/All&names[]=Session/Start&values[]=call_count&summarize=true'
```

## Find the mobile app version ID [#mobile-app-version-id]

> #### ⚠️ IMPORTANT
>
> You must provide the version ID only when you want to obtain crash data for a specific version.

To find the version ID of your mobile application, run the following NRQL query:

```sql
SELECT count(*) FROM Mobile
WHERE appName = 'YOUR_APP_NAME' FACET appVersionId 
SINCE 1 day ago
```
