---
title: Troubleshoot Metric API with NRIntegrationError events
source: https://docs.newrelic.com/docs/data-apis/ingest-apis/metric-api/troubleshoot-nrintegrationerror-events
---

## Problem

You sent metric data points to the [Metric API](https://docs.newrelic.com/docs/introduction-new-relic-metric-api), and are not seeing what you expect when querying the data. Use the following checklist to determine the root cause:

-   Make sure you are [querying the data correctly](https://docs.newrelic.com/docs/introduction-new-relic-metric-api#view-and-query).
-   Check the [HTTP status codes returned by the API](https://docs.newrelic.com/docs/report-metrics-metric-api#response-validation). Issues like authorization failures can be diagnosed with HTTP status codes.
-   If you are sending data from a Prometheus server via [New Relic's remote_write endpoint](https://docs.newrelic.com/docs/integrations/prometheus-integrations/get-started/monitor-prometheus-new-relic#remote-write), check your Prometheus server logs for errors or non-2xx HTTP responses from the New Relic endpoint.
-   Query your account for [`NrIntegrationError` events](https://docs.newrelic.com/docs/telemetry-data-platform/manage-data/nrintegrationerror). New Relic's ingestion endpoints are asynchronous, meaning the endpoint verifies the payload _after_ it returns the HTTP response. If any issues occur while verifying your payload, then an `NrIntegrationError` event will be created in your account. New Relic also uses `NrIntegrationError` events to notify customers when various rate limits have been reached.

## Solution

### View error details [#error-details]

For an introduction to using the `NrIntegrationError` event, see [`NrIntegrationError`](https://docs.newrelic.com/docs/telemetry-data-platform/manage-data/nrintegrationerror).

Here's an example NRQL for examining issues with Metric API ingest:

```sql
SELECT count(*) FROM NrIntegrationError WHERE newRelicFeature = 'Metrics' 
FACET category, message LIMIT 100 SINCE 24 hours ago
```

The `category` indicates the type of error and the `message` provides more detailed information about the error. If the `category` is `rateLimit`, then you should also examine the `rateLimitType` field for more information on the type of rate limiting.

| Category     | rateLimitType                | Description and solution                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ------------ | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `BadRequest` | (not set)                    | There is an issue with the JSON payload. These include JSON syntax errors, attribute names, or values that are too long. Check the `message` field to determine the exact issue. Then review the JSON payload, and update it to ensure it meets the proper semantic guidelines.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `RateLimit`  | `UniqueTimeseriesPerDay`     | You have an attribute with a high number of unique values, like `containerId` or `URI`. To resolve this error, review any attributes that may be causing the issue and remove them. If desired, you can use a [data dropping rule](https://docs.newrelic.com/docs/accounts/accounts/data-management/drop-data-using-nerdgraph) to remove attributes at ingest time.                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `RateLimit`  | `UniquePrometheusTimeseries` | You have Prometheus servers reporting too many unique time series via [New Relic's remote_write endpoint](https://docs.newrelic.com/docs/integrations/prometheus-integrations/get-started/monitor-prometheus-new-relic#remote-write). Reduce the number of unique time series reported by modifying your [Prometheus server configuration](https://prometheus.io/docs/prometheus/latest/configuration/configuration/) to reduce the number of targets being scraped, or by using [relabel rules](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config) in the [remote_write section](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write) of your server configuration to drop time series or highly unique labels. |
| `RateLimit`  | `RequestsPerMinute`          | Too many requests per minute are being sent. To resolve this, put more datapoints in each request, and send them less frequently.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `RateLimit`  | `ErrorGroupsPerDay`          | You have exceeded your daily error group limit. Incoming error groups will be dropped for the remainder of the day and will continue as normal after UTC midnight. To resolve this, reduce the amount of unique error messages collected by New Relic.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |

### Match errors to ingested payloads [#errors-payloads]

When an [`NrIntegrationError` event](https://docs.newrelic.com/docs/telemetry-data-platform/manage-data/nrintegrationerror) is created as a result of a syntax issue with the HTTP request payload, then the event contains the attributes `apiKeyPrefix` and `requestId`.

-   The `apiKeyPrefix` matches the first 6 characters of the API key used to send the data.
-   The `requestId` matches the `requestId` sent in the HTTP response.

To view these fields, run this NRQL query:

```sql
SELECT message, apiKeyPrefix, requestId FROM NrIntegrationError LIMIT 100
```

To verify a specific `requestId`, run this NRQL query:

```sql
SELECT * FROM NrIntegrationError WHERE requestId = 'REQUEST_ID'
```

### Programmatically retrieve NrIntegrationError events

To programmatically retrieve these errors:

1.  Ensure you have an [Insights query API key](https://docs.newrelic.com/docs/insights/insights-api/get-data/query-insights-event-data-api) (go to **[one.newrelic.com/api-keys](https://one.newrelic.com/api-keys)**).
2.  Create an HTTP request as shown below:

    > #### 💡 TIP
    >
    > If your organization hosts data in the EU data center, ensure you're using the [EU region endpoints](https://docs.newrelic.com/docs/using-new-relic/welcome-new-relic/getting-started/introduction-eu-region-data-center#endpoints).

    ```bash
    curl -H "Accept: application/json" -H "X-Query-Key:YOUR_API_KEY_HERE" "https://insights-api.newrelic.com/v1/accounts/YOUR_ACCOUNT_HERE/query?nrql=SELECT%20*%20FROM%20NrIntegrationError%20where%20newRelicFeature='Metrics'"
    ```
