
## Regions

The base URL depends on your project's data residency. In all examples on this page, use the default base URL unless your project uses Amplitude's EU data center—in that case use the EU base URL in this table.

Requests go to `https://amplitude.com` (default) or `https://analytics.eu.amplitude.com` (EU). The `https://analytics.amplitude.com` hostname is the Analytics web app (browser UI), not the API base URL for these requests.

| Data residency | Base URL                             |
| -------------- | ------------------------------------ |
| Default        | `https://amplitude.com`              |
| EU             | `https://analytics.eu.amplitude.com` |

## Considerations

- The latest 4 hours of data is accurate to the minute. Beyond that, the data is aggregated for every hour. Note this when requesting metric data older than 4 hours.
- Amplitude retains event streaming metrics for the last 90 days. Sending `start` or `end` time beyond this threshold returns a `500` status.

## Limits

The API has a limit of 4 concurrent requests per project, and 12 requests per minute per project. Amplitude rejects requests above this threshold with a `429` status code.

## Request

Send a `GET` request with required and optional parameters to `https://amplitude.com/api/2/event-streaming/delivery-metrics-summary`.

The following example shows a basic request with only the required parameters.

{% code-group %}
```bash cURL
curl --location --request GET 'https://amplitude.com/api/2/event-streaming/delivery-metrics-summary?sync_id=SYNC_ID&time_period=TIME_PERIOD' \
-u '{api_key}:{secret_key}'
```

```bash HTTP
GET /api/2/event-streaming/delivery-metrics-summary?sync_id=SYNC_ID&time_period=TIME_PERIOD HTTP/1.1
Host: amplitude.com
Authorization: Basic {api-key}:{secret-key} #credentials must be base64-encoded
```
{% /code-group %}

{% accordion title="Example: Get the last four hours" %}
Gets the last four hours of data for the decoded sync ID `30001625`.

{% code-group %}
```curl cURL
curl --location --request GET 'https://amplitude.com/api/2/event-streaming/delivery-metrics-summary?sync_id=30001625&time_period=FOUR_HOURS' \
--header 'Authorization: Basic MTIzNDU2NzgwMDoxMjM0NTY3MDA='
```

```bash HTTP
GET /api/2/event-streaming/delivery-metrics-summary?sync_id=30001625&time_period=FOUR_HOURS HTTP/1.1
Host: amplitude.com
Authorization: Basic MTIzNDU2NzgwMDoxMjM0NTY3MDA=
```
{% /code-group %}
{% /accordion %}

{% accordion title="Example: Get the last hour" %}
Gets the last hour of data for the decoded sync ID `30001625`.

{% code-group %}
```curl cURL
curl --location --request GET 'https://amplitude.com/api/2/event-streaming/delivery-metrics-summary?sync_id=30001625&time_period=ONE_HOUR' \
--header 'Authorization: Basic MTIzNDU2NzgwMDoxMjM0NTY3MDA='
```

```bash HTTP
GET /api/2/event-streaming/delivery-metrics-summary?sync_id=30001625&time_period=ONE_HOUR HTTP/1.1
Host: amplitude.com
Authorization: Basic MTIzNDU2NzgwMDoxMjM0NTY3MDA=
```
{% /code-group %}
{% /accordion %}

{% accordion title="Example: Get data for a custom period" %}
Gets the data between October 1, 2022 at 7:00 AM UTC +1 and October 31, 2022 at 7:00 AM UTC +1 for the decoded sync ID `30001625`.

{% code-group %}
```curl cURL
curl --location --request GET 'https://amplitude.com/api/2/event-streaming/delivery-metrics-summary?sync_id=30001625&time_period=CUSTOM&start=2022-10-01T07:00:00+01:00&end=end=2022-10-31T07:00:00+01:00' \
--header 'Authorization: Basic MTIzNDU2NzgwMDoxMjM0NTY3MDA='
```

```bash HTTP
GET /api/2/event-streaming/delivery-metrics-summary?sync_id=30001625&time_period=CUSTOM&start=2022-10-01T07:00:00+01:00&end=2022-10-31T07:00:00+01:00 HTTP/1.1
Host: amplitude.com
Authorization: Basic MTIzNDU2NzgwMDoxMjM0NTY3MDA=
```
{% /code-group %}
{% /accordion %}

## Query parameters

| Parameter     | Required                              | Description                                                                                                                                  |
| ------------- | ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `sync_id`     | Yes                                   | The ID for a specific streaming destination. Find this ID under the title of the sync on the destination's setting page.                     |
| `time_period` | Yes                                   | Retrieves the data for a specified period. One of: `TEN_MINUTES`, `ONE_HOUR`, `FOUR_HOURS`, `ONE_DAY`, `ONE_WEEK`, `TWO_WEEKS`, or `CUSTOM`. |
| `start`       | Required if `time_period` is `CUSTOM` | The inclusive starting time of the custom interval in the format `YYYY-MM-DDThh:mmTZD` (ISO-8601). For example, `2022-10-01T07:00:00+01:00`. |
| `end`         | Required if `time_period` is `CUSTOM` | The exclusive end time of the custom interval in the format `YYYY-MM-DDThh:mmTZD` (ISO-8601). For example, `2022-10-31T07:00:00+01:00`.      |

## Response

The response is a JSON object with the delivery metrics for the specified sync.

| Attribute               | Description                                                      |
| ----------------------- | ---------------------------------------------------------------- |
| `timePeriod`            | string. The `time_period` sent in the request.                   |
| `eventsDelivered`       | int. The total number of delivered events.                       |
| `eventsNotDelivered`    | int. The total number of events that weren't delivered.          |
| `deliveryRate`          | double. The delivery success rate.                               |
| `latencyInSeconds`      | double. The p95 latency in seconds.                              |
| `timePeriodStart`       | string. The UTC (ISO-8601) timestamp for the request start time. |
| `timePeriodEnd`         | string. The UTC (ISO-8601) timestamp for the request end time.   |
| `successOnFirstAttempt` | int. Events delivered successfully in the first attempt.         |
| `successAfterRetry`     | int. Events delivered successfully after one or more retries.    |
| `eventsExpired`         | int. Events that weren't sent after all retry attempts.          |
| `eventsDiscarded`       | int. Events that weren't sent due to data incomplete/invalid.    |

```json
{
  "timePeriod": "CUSTOM",
  "eventsDelivered": 19,
  "eventsNotDelivered": 0,
  "deliveryRate": 1.0,
  "latencyInSeconds": 5.098051910578275,
  "timePeriodStart": "2022-10-01 06:00:00.000000",
  "timePeriodEnd": "2022-10-31 06:00:00.000000",
  "successOnFirstAttempt": 19,
  "successAfterRetry": 0,
  "eventsExpired": 0,
  "eventsDiscarded": 0
}
```

## Status codes

| Code | Message                                                            |
| ---- | ------------------------------------------------------------------ |
| 200  | Success                                                            |
| 400  | Bad request                                                        |
| 401  | Unauthorized                                                       |
| 403  | Forbidden: attempt to access sync outside of organization and app. |
| 429  | Rate limit exceeded                                                |
| 500  | Internal server error                                              |
