# Return send metrics by domain or sender

> **GET** `https://api.us.nylas.com/v3/metrics/send`

Source: https://developer.nylas.com/docs/reference/api/send-events/get-send-breakdown/

Returns send counts and rates grouped by sending domain, sender address, or recipient domain.
Use it to find which of your domains or Agent Accounts has the highest bounce rate, or which
mailbox provider is rejecting your mail. Rows are sorted by sent volume by default.

**Authentication:** NYLAS_API_KEY

## Parameters

### Query parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `group_by` | string, one of: `sending_domain`, `agent_account`, `recipient_domain`, default: `"sending_domain"` | No | What to group by. `agent_account` groups by the sender email address. `recipient_domain` covers the last 90 days at most. |
| `sort` | string, default: `"sent:desc"` | No | The sort order, as `<key>:<asc|desc>`. The key is one of `key`, `sent`, `delivery_rate`, `bounce_rate`, or `complaint_rate`. |
| `limit` | integer, min: 1, max: 100, default: `25` | No | The maximum number of rows to return. When there are more groups, the rest are combined into one final row with the key `(others)`. |
| `start` | string, format: date | No | The first day of the window, as a UTC date in `YYYY-MM-DD` format. Defaults to six days before `end`, so the default window covers 7 days. A window can cover up to 365 days. |
| `end` | string, format: date | No | The last day of the window, as a UTC date in `YYYY-MM-DD` format. Defaults to today. Today is included as a partial day. |
| `sending_domain` | string, maxLength: 255 | No | Return only data for messages sent from this domain. |

## Responses

### 200 - Success. Returns one row per group.

- `request_id` (string) - The request ID.
- `data` (object)
  - `group_by` (string, one of: `sending_domain`, `agent_account`, `recipient_domain`) - What the rows are grouped by.
  - `window` (any) - The window the rows cover. For `recipient_domain`, the window is limited to the last 90 days,
and is `null` when none of the requested window is that recent.
    - **object**
      - `start` (string, format: date) - The first day of the window.
      - `end` (string, format: date) - The last day of the window.
    - **null**
  - `rows` (array) - One row per group, sorted by `sort`.
    - `key` (string) - The sending domain, sender email address, or recipient domain. `(others)` for the combined row.
    - `sent` (integer) - The number of messages Nylas accepted for delivery.
    - `delivered` (integer) - The number of messages the recipient's mail server accepted.
    - `bounced_hard` (integer) - The number of permanent bounces.
    - `complaints` (integer) - The number of recipients who marked the message as spam.
    - `delivery_rate` (number, nullable) - Delivered messages as a percentage of sent messages.
    - `bounce_rate` (number, nullable) - Hard bounces as a percentage of sent messages.
    - `complaint_rate` (number, nullable) - Complaints as a percentage of delivered messages.
    - `is_others` (boolean) - `true` for the final row that combines every group past `limit`.

### 400 - Bad request. A query parameter or the request body isn't valid.

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.

### 401 - Unauthorized

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.
  - `provider_error` (object) - The error from the provider.

### 403 - Forbidden. These endpoints need your application's API key, not a grant access token.

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.

## Code samples

### cURL

```bash
curl --request GET \
  --url "https://api.us.nylas.com/v3/metrics/send?group_by=recipient_domain&sort=bounce_rate:desc&limit=10" \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer <NYLAS_API_KEY>'
```
