# Retrieve Email Metrics

> GET /emails/metrics — counts of sent, delivered, opened, clicked, bounced and more for a date range.

`GET /emails/metrics`

Counts what happened to your account's email over a range of UTC days. With no `dimensions` you get one row of totals. Add `period`, `domain` or `campaign` to split the counts by day, by sending domain or by campaign (any combination).

`sent` and `failed` count emails by the time they were sent. The engagement counters (`delivered`, `opened`, `clicked` and the rest) count the **first** event of that kind for each email that falls inside the range, so an email opened five times adds one to `opened`.

> **Note:** Needs an API key with read access.

**Query parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `start_date` | string | No | First day, `YYYY-MM-DD` (UTC). Defaults to six days before `end_date`, so the default range is the last 7 days. |
| `end_date` | string | No | Last day, `YYYY-MM-DD` (UTC), included. Defaults to today. A range can span at most **92 days**. |
| `dimensions` | string | No | Comma-separated: `period` (one row per day), `domain`, `campaign`. `broadcast` is read as `campaign`. Omit for a single totals row. |
| `domain_id` | string | No | Only count email sent from these domains. Comma-separated ids. |
| `campaign_id` | string | No | Only count email from these campaigns. Comma-separated ids. `broadcast_id` is accepted too and adds to the same list. |

**Node.js**

```js
const res = await fetch('https://www.senddart.com/api/emails/metrics?start_date=2026-11-01&end_date=2026-11-07&dimensions=period', {
  method: 'GET',
  headers: { 'Authorization': 'Bearer mb_xxxxxxxxx' },
});
const data = await res.json();
console.log(data);
```

**Ruby**

```ruby
require 'net/http'
require 'uri'

uri = URI('https://www.senddart.com/api/emails/metrics?start_date=2026-11-01&end_date=2026-11-07&dimensions=period')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer mb_xxxxxxxxx'
res = http.request(req)
puts res.body
```

**PHP**

```php
<?php
$ch = curl_init('https://www.senddart.com/api/emails/metrics?start_date=2026-11-01&end_date=2026-11-07&dimensions=period');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer mb_xxxxxxxxx',
        'User-Agent: my-app/1.0',
    ],
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
```

**Python**

```python
import requests

res = requests.get(
    "https://www.senddart.com/api/emails/metrics?start_date=2026-11-01&end_date=2026-11-07&dimensions=period",
    headers={"Authorization": "Bearer mb_xxxxxxxxx"},
)
print(res.json())
```

**Go**

```go
package main

import (
    "fmt"
    "io"
    "net/http"
)

func main() {
    req, _ := http.NewRequest("GET", "https://www.senddart.com/api/emails/metrics?start_date=2026-11-01&end_date=2026-11-07&dimensions=period", nil)
    req.Header.Set("Authorization", "Bearer mb_xxxxxxxxx")
    res, _ := http.DefaultClient.Do(req)
    defer res.Body.Close()
    out, _ := io.ReadAll(res.Body)
    fmt.Println(string(out))
}
```

**Rust**

```rust
use reqwest::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let res = Client::new()
        .get("https://www.senddart.com/api/emails/metrics?start_date=2026-11-01&end_date=2026-11-07&dimensions=period")
        .header("Authorization", "Bearer mb_xxxxxxxxx")
        .header("User-Agent", "my-app/1.0")
        .send()
        .await?;
    println!("{}", res.text().await?);
    Ok(())
}
```

**Java**

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

var client = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
    .uri(URI.create("https://www.senddart.com/api/emails/metrics?start_date=2026-11-01&end_date=2026-11-07&dimensions=period"))
    .header("Authorization", "Bearer mb_xxxxxxxxx")
    .header("User-Agent", "my-app/1.0")
    .method("GET", HttpRequest.BodyPublishers.noBody())
    .build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

**.NET**

```csharp
using System.Net.Http;
using System.Text;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://www.senddart.com/api/emails/metrics?start_date=2026-11-01&end_date=2026-11-07&dimensions=period");
request.Headers.Add("Authorization", "Bearer mb_xxxxxxxxx");
request.Headers.Add("User-Agent", "my-app/1.0");
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
```

**cURL**

```bash
curl -X GET 'https://www.senddart.com/api/emails/metrics?start_date=2026-11-01&end_date=2026-11-07&dimensions=period' \
  -H 'Authorization: Bearer mb_xxxxxxxxx'
```

### Response

```json
{
  "object": "list",
  "start_date": "2026-11-01",
  "end_date": "2026-11-07",
  "dimensions": ["period"],
  "data": [
    {
      "period": "2026-11-01",
      "sent": 1840,
      "delivered": 1822,
      "delivery_delayed": 4,
      "opened": 911,
      "clicked": 203,
      "bounced": 11,
      "complained": 1,
      "failed": 2
    }
  ]
}
```

Each row carries only the keys for the dimensions you asked for (`period`, `domain_id`, `campaign_id`). Rows are sorted by `period`. A day with no mail has no row when you split by `period`. A malformed date, a `start_date` after `end_date`, a range longer than 92 days or an unknown dimension returns `422 validation_error`.
