## GET /api/v2/me/mail-relay/summary

**Count outbound mail relay messages by status**

Counts the messages one sender passed through the outbound mail relay, per status. The count starts at `since`, by default 7 days ago. The statuses mean the same as `status` on `GET /api/v2/me/mail-relay/messages`. Use that endpoint to see the messages themselves. Choose the sender with `scope` as on the message log. A VPS with no public IP address returns zero counts.

### Related Endpoints

- `GET /api/v2/me/mail-relay/blocks`: List paused mail relay senders
- `GET /api/v2/me/mail-relay/messages`: List outbound mail relay messages
- `POST /api/v2/me/mail-relay/blocks/unblock`: Lift a paused mail relay sender

### Headers

- `Authorization`: Bearer $HOSTUP_API_KEY
- Scope (one of): `read:hosting` (Only when `scope` is `hosting`.), `read:vm` (Only when `scope` is `vps`.)

### Parameters

- `scope` (query, string, required): Which sender to count. `hosting` takes `domain` and needs the scope `read:hosting`. `vps` takes `vpsId` and needs `read:vm`. Example: `hosting`
  Allowed values: hosting, vps
- `domain` (query, string): A domain on one of your web hosting accounts (main, addon, parked or subdomain). Required when `scope` is `hosting`. Example: `example.com`
- `vpsId` (query, string): The VPS ID (`vps_…`). Required when `scope` is `vps`. Example: `vps_01hxa3b4c5d6e7f8g9h0j1k2m3`
- `since` (query, string): Count messages the relay received at or after this time (ISO 8601). Default 7 days ago. A time more than 30 days back counts from 30 days ago. Example: `2026-10-02T00:00:00Z`

### Request Example

```bash
curl "https://cloud.hostup.se/api/v2/me/mail-relay/summary?scope=hosting" \
  -H "Authorization: Bearer $HOSTUP_API_KEY"
```

### Response Schema

- `windowStartAt` (string, required): Start of the counted period. Example: `2026-10-02T10:00:00.000Z`
- `counts` (object, required): Messages per status since `windowStartAt`.
- `counts.delivered` (integer, required): The receiving server accepted the message.
- `counts.sending` (integer, required): On its way out, no answer from the receiving server yet.
- `counts.queued` (integer, required): Waiting at the relay, also while the sender is paused.
- `counts.deferred` (integer, required): The receiving server asked to try again later.
- `counts.bounced` (integer, required): The receiving server refused the message or delivery was given up.
- `counts.rejected` (integer, required): The relay refused the message.
- `counts.total` (integer, required): All messages counted.

### Responses

#### 200 - The counts per status.
```json
{
  "windowStartAt": "2026-10-02T10:00:00.000Z",
  "counts": {
    "delivered": 412,
    "sending": 2,
    "queued": 0,
    "deferred": 3,
    "bounced": 5,
    "rejected": 1,
    "total": 423
  }
}
```

#### 400 - Invalid request. The response body is an RFC 7807 Problem Details document.
```json
{
  "type": "https://developer.hostup.se/errors/invalid_request",
  "title": "Invalid request",
  "status": 400,
  "detail": "The request is invalid.",
  "code": "invalid_request",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 401 - Unauthorized. Authentication is required.
```json
{
  "type": "https://developer.hostup.se/errors/unauthorized",
  "title": "Unauthorized",
  "status": 401,
  "detail": "Authentication is required.",
  "code": "unauthorized",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 403 - Forbidden. The caller lacks a required scope or does not own the resource.
```json
{
  "type": "https://developer.hostup.se/errors/forbidden",
  "title": "Forbidden",
  "status": 403,
  "detail": "The caller lacks a required scope or does not own the resource.",
  "code": "forbidden",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 404 - `domain_not_found`: the domain is not on any of your web hosting accounts. `vps_not_found`: the VPS is not on your account.

#### 429 - Rate limited. Retry after the limit resets. 429 responses include `Retry-After` seconds plus `X-RateLimit-*` headers.
```json
{
  "type": "https://developer.hostup.se/errors/rate_limit_exceeded",
  "title": "Too many requests",
  "status": 429,
  "detail": "Rate limit exceeded. Please try again later.",
  "code": "rate_limit_exceeded",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 500 - Internal error. Retry later or contact support if the issue persists.
```json
{
  "type": "https://developer.hostup.se/errors/internal_error",
  "title": "Internal server error",
  "status": 500,
  "detail": "An unexpected error occurred. Retry later or contact support if the issue persists.",
  "code": "internal_error",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 503 - `upstream_unavailable`: the counts did not load within 5 seconds. Try again after the `Retry-After` seconds (30).
```json
{
  "type": "https://developer.hostup.se/errors/upstream_unavailable",
  "title": "Upstream unavailable",
  "status": 503,
  "detail": "The delivery summary could not be loaded right now. Try again shortly.",
  "code": "upstream_unavailable",
  "instance": "/api/v2/me/mail-relay/summary",
  "requestId": "7f3e9c0a-2b1d-4e5f-8a6b-9c0d1e2f3a4b",
  "timestamp": "2026-10-09T10:00:00.000Z"
}
```
