# `bird amb stats by-error-code`

## Usage

```bash
bird amb stats by-error-code [flags]
```

## Description

Returns outbound counts and latency percentiles grouped by failure reason, for the requested period. Rows are ranked by `send_failed + rejected` descending and capped at the requested `limit` (default 50, max 200). Only messages carrying a failure reason appear: a `bird:` code is usually a rejection (never charged, never attempted), an `apple:` code a send failure; use the summary for the period's full accepted total.

## Examples

```bash
bird amb stats by-error-code
```

## Options

| Name                | Description                                                                                                                                                                                                                                                                                                                               |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--from`            | Inclusive start of the window, a calendar day (YYYY-MM-DD). Interpreted in timezone, or UTC when omitted. Must not be after to. Max window 365 days. Defaults to 30 days before to when omitted.                                                                                                                                          |
| `--limit <n>`       | Maximum number of error-code rows to return, ranked by send\_failed + rejected descending.                                                                                                                                                                                                                                                |
| `--response-schema` | Print the fields this command returns, then exit                                                                                                                                                                                                                                                                                          |
| `--timezone`        | IANA timezone identifier used to group statistics, for example Asia/Kathmandu. The default is UTC. Day and hour boundaries, including the default window when from and to are omitted, follow this timezone. When this parameter is set, pass from and to as calendar days or Z instants instead of timestamps with explicit UTC offsets. |
| `--to`              | Inclusive end of the window, a calendar day (YYYY-MM-DD). Interpreted in timezone, or UTC when omitted. Max window 365 days. Defaults to today in that timezone when omitted.                                                                                                                                                             |

## Related

| Name                                                                              | Description                                                         |
| --------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
| [`bird amb stats by-business`](/docs/cli/reference/amb-stats-by-business)         | Get outbound Apple Messages for Business statistics by business     |
| [`bird amb stats by-category`](/docs/cli/reference/amb-stats-by-category)         | Get outbound Apple Messages for Business statistics by category     |
| [`bird amb stats by-group`](/docs/cli/reference/amb-stats-by-group)               | Get outbound Apple Messages for Business statistics by group        |
| [`bird amb stats by-intent`](/docs/cli/reference/amb-stats-by-intent)             | Get outbound Apple Messages for Business statistics by intent       |
| [`bird amb stats by-message-kind`](/docs/cli/reference/amb-stats-by-message-kind) | Get outbound Apple Messages for Business statistics by message kind |
| [`bird amb stats by-tag`](/docs/cli/reference/amb-stats-by-tag)                   | Get outbound Apple Messages for Business statistics by tag          |
| [`bird amb stats daily`](/docs/cli/reference/amb-stats-daily)                     | Get daily outbound Apple Messages for Business statistics           |
| [`bird amb stats hourly`](/docs/cli/reference/amb-stats-hourly)                   | Get hourly outbound Apple Messages for Business statistics          |
| [`bird amb stats summary`](/docs/cli/reference/amb-stats-summary)                 | Get aggregate outbound Apple Messages for Business statistics       |

## Related resources

- [Should I use a Bird SDK or call the API directly?](/explained/platform/should-i-use-an-sdk-or-call-the-api-directly) (answer)
- [Build your first integration](/learn/paths/integration) (course)
- [Send your first email](/docs/get-started/send-your-first-email) (docs)

[Get an implementation brief](/learn/workspace?topic=api-basics)
