# Edge traffic for one domain

> Edge traffic for one domain: CustomDomain™ API reference in the analytics group. Covers request parameters, the request body, responses and error codes.

Source: https://docs.customdomain.ai/docs/api-reference/analytics/getConnectionTraffic

## `GET https://api.customdomain.ai/v1/connections/{id}/traffic`

What the edge served for one connected domain: requests by status class, bytes relayed to visitors, the origin's time to first byte (p50, p95, p99 and mean over the requests that reached it) and approximate unique visitors, as a series with totals, plus when the edge last served a request for it. `serving` says whether the domain's visitors reach the edge at all: `live` and `verifying` are served by the edge; `not_live` will be once the domain is live; `dns_only` means its records point somewhere other than the edge (it was connected for DNS only), so its traffic never passes through CustomDomain™ and there is nothing to count. Visitors are estimated from a sketch of keyed hashes of client addresses; no address is stored, and a visitor seen on two UTC days counts once on each. A tenant API key reads a domain of any application in its tenant; a widget token minted with scope `app` (or a delegated agent token) reads its own application's domains; an end user's connect-scoped widget token is refused.

A delegated agent token needs `domains:read`.

### Authentication

`apiKey`, `widgetJWT`, `agentToken`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |
| `range` | query | `24h`, `7d`, `30d`, `90d` | no |  |

### Responses

| Status | Description |
| --- | --- |
| `200` | Domain traffic |
| `400` | Error envelope: {code, title, details}. |
| `401` | Error envelope: {code, title, details}. |
| `403` | Error envelope: {code, title, details}. |
| `404` | Error envelope: {code, title, details}. |
| `503` | Error envelope: {code, title, details}. |

### `200` response body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `connection_id` | string | yes |  |
| `domain` | string | yes |  |
| `range` | `24h`, `7d`, `30d`, `90d` | yes |  |
| `granularity` | `hour`, `day` | yes |  |
| `from` | string | yes | Start of the first bucket. |
| `to` | string | yes | End of the last bucket (exclusive); the last bucket is the current one. |
| `serving` | object | yes |  |
| `last_request_at` | string or null | yes | End of the last minute in which the edge served this domain; null when never (within retention). |
| `totals` | object | yes |  |
| `series` | array of object | yes |  |
| `retention` | object | yes |  |

The full specification is served at `GET https://api.customdomain.ai/v1/openapi.json`.
