---
title: Domain Inspector Historical API
summary: >-
  Domain Inspector provides a JSON-formatted historical API for visibility into
  responses delivered from your domains by Fastly. The API offers a standardized
  set of data to report in minutely, hourly, or daily granularity on every
  domain response, byte, and status code received by a specified service.
url: >-
  https://www.fastly.com/documentation/reference/api/metrics-stats/domain-inspector/historical
---

> **IMPORTANT:** Domain inspector is an optional upgrade to Fastly service plans and must be enabled for each service using the [enablement API](https://www.fastly.com/documentation/reference/api/products/enablement/).

## Query options

When the `start` or `and` parameters specify a date without a time, the time component will be set to 00:00. To specify a different time, use a Unix timestamp or an expression such as `start=2021-01-01%2008:00&end=2021-01-02%2008:00`

If `start` is omitted, the time range will start at a point determined by the value of `downsample`:

- `?downsample=day`: one month ago
- `?downsample=hour`: one day ago
- `?downsample=minute`: 30 minutes ago

If you define values for all of the `start`, `end`, and `downsamples` parameters you can accidentally ask for a very large data set.

> **IMPORTANT:** All absolute time references in the historical API are expressed in UTC.

### Examples

Returns domain response counts for service `abc123`, summed by day, for the first week of September 2021:

```
/metrics/domains/services/abc123?start=2021-09-01&end=2021-09-08&downsample=day&metric=requests
```

Returns the count of 200 and 204 status codes emitted by domains for service `abc123`, summed by minute, for the first 8 hours of September 2021:

```
/metrics/domains/services/abc123?start=2021-09-01T00:00:00&end=2021-09-02T08:00:00&downsample=minute&metric=status_200,status_201
```

Returns the count of 5xx status codes emitted by domains for service `abc123` on the first day of September 2021, with one timeseries per unique domain:

```
/metrics/domains/services/abc123?start=2021-09-01&end=2021-09-02&metric=status_5xx&group_by=domain
```

## Data latency

As a general rule, data with minute, hour, and day resolution will each be delayed by approximately 10 to 15 minutes due to the time it takes to collect and process historical data. Therefore, time periods that are yet to complete or which have only recently ended may return data that doesn't yet fully count all traffic for that period.

## Error format

Error responses have the `Content-Type` header set to `application/problem+json`. The error response body will include:

- `type` (string): A URL that includes additional, human-readable information about this error type.
- `title` (string): A short name for the error type.
- `status` (integer): The HTTP status code.
- `detail` (string): A human-readable description of the specific error.
- `errors` (array): A list of individual errors, where multiple errors have occurred.

An example error can be seen below:

```json
{
  "type": "https://fastly.help/metrics/validation-error",
  "title": "Request parameters were invalid.",
  "status": 400,
  "errors": [
    {
      "property": "metric",
      "reason": "Unrecognized metric names: 'my_metric', 'my_metric2'"
    }
  ],
  "detail": "Parameters with invalid values: 'metric'"
}
```

## Data model

| Field | Type | Description |
|-------|------|-------------|
| `datacenter` | string | The POP from which the edge responses in this data entry were delivered. If unspecified, results are aggregated across POPs. |
| `domain` | string | The domain from which the edge responses in this data entry were delivered. If unspecified, results are aggregated across domains. |
| `region` | string | The geographic region from which the edge responses in this data entry were delivered. If unspecified, results are aggregated across regions. |
| `dimensions` | object | The unique combination of dimensions associated with this timeseries. |
| `meta` | object | Meta information about the scope of the query in a human readable format. |
| `msg` | string | If the query was not successful, this will provide a string that explains why. |
| `status` | string | Whether or not we were able to successfully execute the query. |
| `values` | array | An array of values representing the metric values at each point in time. Note that this dataset is sparse: only the keys with non-zero values will be included in the record. |

## Data model

| Field | Type | Description |
|-------|------|-------------|
| `dimensions` | object | The unique combination of dimensions associated with this timeseries. |
| `values` | array | An array of values representing the metric values at each point in time. Note that this dataset is sparse: only the keys with non-zero values will be included in the record. |

## Data model

| Field | Type | Description |
|-------|------|-------------|
| `bandwidth` | integer | Total bytes delivered (<code>resp_header_bytes</code> + <code>resp_body_bytes</code> + <code>bereq_header_bytes</code> + <code>bereq_body_bytes</code>). |
| `bereq_body_bytes` | integer | Total body bytes sent to origin. |
| `bereq_header_bytes` | integer | Total header bytes sent to origin. |
| `compute_bereq_body_bytes` | integer | Total body bytes sent to backends (origins) by the Compute platform. |
| `compute_bereq_errors` | integer | Number of backend request errors, including timeouts, by the Compute platform. |
| `compute_bereq_header_bytes` | integer | Total header bytes sent to backends (origins) by the Compute platform. |
| `compute_bereqs` | integer | Number of backend requests started by the Compute platform. |
| `compute_beresp_body_bytes` | integer | Total body bytes received from backends (origins) by the Compute platform. |
| `compute_beresp_header_bytes` | integer | Total header bytes received from backends (origins) by the Compute platform. |
| `compute_execution_time_ms` | integer | The amount of active CPU time used to process your requests (in milliseconds). |
| `compute_origin_status_1xx` | integer | Number of "Informational" category status codes received from origin by the Compute platform. |
| `compute_origin_status_200` | integer | Number of responses received from origin with status code 200 (Success) by the Compute platform. |
| `compute_origin_status_204` | integer | Number of responses received from origin with status code 204 (No Content) by the Compute platform. |
| `compute_origin_status_206` | integer | Number of responses received from origin with status code 206 (Partial Content) by the Compute platform. |
| `compute_origin_status_2xx` | integer | Number of "Success" status codes received from origin by the Compute platform. |
| `compute_origin_status_301` | integer | Number of responses received from origin with status code 301 (Moved Permanently) by the Compute platform. |
| `compute_origin_status_302` | integer | Number of responses received from origin with status code 302 (Found) by the Compute platform. |
| `compute_origin_status_304` | integer | Number of responses received from origin with status code 304 (Not Modified) by the Compute platform. |
| `compute_origin_status_3xx` | integer | Number of "Redirection" codes received from origin by the Compute platform. |
| `compute_origin_status_400` | integer | Number of responses received from origin with status code 400 (Bad Request) by the Compute platform. |
| `compute_origin_status_401` | integer | Number of responses received from origin with status code 401 (Unauthorized) by the Compute platform. |
| `compute_origin_status_403` | integer | Number of responses received from origin with status code 403 (Forbidden) by the Compute platform. |
| `compute_origin_status_404` | integer | Number of responses received from origin with status code 404 (Not Found) by the Compute platform. |
| `compute_origin_status_416` | integer | Number of responses received from origin with status code 416 (Range Not Satisfiable) by the Compute platform. |
| `compute_origin_status_429` | integer | Number of responses received from origin with status code 429 (Too Many Requests) by the Compute platform. |
| `compute_origin_status_4xx` | integer | Number of "Client Error" codes received from origin by the Compute platform. |
| `compute_origin_status_500` | integer | Number of responses received from origin with status code 500 (Internal Server Error) by the Compute platform. |
| `compute_origin_status_501` | integer | Number of responses received from origin with status code 501 (Not Implemented) by the Compute platform. |
| `compute_origin_status_502` | integer | Number of responses received from origin with status code 502 (Bad Gateway) by the Compute platform. |
| `compute_origin_status_503` | integer | Number of responses received from origin with status code 503 (Service Unavailable) by the Compute platform. |
| `compute_origin_status_504` | integer | Number of responses received from origin with status code 504 (Gateway Timeout) by the Compute platform. |
| `compute_origin_status_505` | integer | Number of responses received from origin with status code 505 (HTTP Version Not Supported) by the Compute platform. |
| `compute_origin_status_530` | integer | Number of responses received from origin with status code 530 by the Compute platform. |
| `compute_origin_status_5xx` | integer | Number of "Server Error" codes received from origin by the Compute platform. |
| `compute_req_body_bytes` | integer | Total body bytes received by the Compute platform. |
| `compute_req_header_bytes` | integer | Total header bytes received by the Compute platform. |
| `compute_request` | integer | The total number of requests that were received by the Compute platform. |
| `compute_request_time_billed_ms` | integer | The total amount of request processing time you will be billed for, measured in 50 millisecond increments. |
| `compute_request_time_ms` | integer | The total amount of time used to process your requests, including active CPU time (in milliseconds). |
| `compute_resp_body_bytes` | integer | Total body bytes sent from Compute to the end user. |
| `compute_resp_header_bytes` | integer | Total header bytes sent from Compute to the end user. |
| `compute_resp_status_103` | integer | Number of responses delivered with status code 103 (Early Hints) by the Compute platform. |
| `compute_resp_status_1xx` | integer | Number of 1xx "Informational" category status codes delivered by the Compute platform. |
| `compute_resp_status_200` | integer | Number of responses delivered with status code 200 (Success) by the Compute platform. |
| `compute_resp_status_204` | integer | Number of responses delivered with status code 204 (No Content) by the Compute platform. |
| `compute_resp_status_206` | integer | Number of responses delivered with status code 206 (Partial Content) by the Compute platform. |
| `compute_resp_status_2xx` | integer | Number of 2xx "Success" status codes delivered by the Compute platform. |
| `compute_resp_status_301` | integer | Number of responses delivered with status code 301 (Moved Permanently) by the Compute platform. |
| `compute_resp_status_302` | integer | Number of responses delivered with status code 302 (Found) by the Compute platform. |
| `compute_resp_status_304` | integer | Number of responses delivered with status code 304 (Not Modified) by the Compute platform. |
| `compute_resp_status_3xx` | integer | Number of 3xx "Redirection" codes delivered by the Compute platform. |
| `compute_resp_status_400` | integer | Number of responses delivered with status code 400 (Bad Request) by the Compute platform. |
| `compute_resp_status_401` | integer | Number of responses delivered with status code 401 (Unauthorized) by the Compute platform. |
| `compute_resp_status_403` | integer | Number of responses delivered with status code 403 (Forbidden) by the Compute platform. |
| `compute_resp_status_404` | integer | Number of responses delivered with status code 404 (Not Found) by the Compute platform. |
| `compute_resp_status_416` | integer | Number of responses delivered with status code 416 (Range Not Satisfiable) by the Compute platform. |
| `compute_resp_status_429` | integer | Number of responses delivered with status code 429 (Too Many Requests) by the Compute platform. |
| `compute_resp_status_4xx` | integer | Number of 4xx "Client Error" codes delivered by the Compute platform. |
| `compute_resp_status_500` | integer | Number of responses delivered with status code 500 (Internal Server Error) by the Compute platform. |
| `compute_resp_status_501` | integer | Number of responses delivered with status code 501 (Not Implemented) by the Compute platform. |
| `compute_resp_status_502` | integer | Number of responses delivered with status code 502 (Bad Gateway) by the Compute platform. |
| `compute_resp_status_503` | integer | Number of responses delivered with status code 503 (Service Unavailable) by the Compute platform. |
| `compute_resp_status_504` | integer | Number of responses delivered with status code 504 (Gateway Timeout) by the Compute platform. |
| `compute_resp_status_505` | integer | Number of responses delivered with status code 505 (HTTP Version Not Supported) by the Compute platform. |
| `compute_resp_status_530` | integer | Number of responses delivered with status code 530 by the Compute platform. |
| `compute_resp_status_5xx` | integer | Number of "Server Error" category status codes delivered by the Compute platform. |
| `edge_hit_ratio` | number | Ratio of cache hits to cache misses at the edge, between 0 and 1 (<code>edge_hit_requests</code> / (<code>edge_hit_requests</code> + <code>edge_miss_requests</code>)). |
| `edge_hit_requests` | integer | Number of requests sent by end users to Fastly that resulted in a hit at the edge. |
| `edge_miss_requests` | integer | Number of requests sent by end users to Fastly that resulted in a miss at the edge. |
| `edge_requests` | integer | Number of requests sent by end users to Fastly. |
| `edge_resp_body_bytes` | integer | Total body bytes delivered from Fastly to the end user. |
| `edge_resp_header_bytes` | integer | Total header bytes delivered from Fastly to the end user. |
| `http2` | integer | Number of requests received over HTTP/2. |
| `http3` | integer | Number of requests received over HTTP/3. |
| `origin_fetch_resp_body_bytes` | integer | Total body bytes received from origin. |
| `origin_fetch_resp_header_bytes` | integer | Total header bytes received from origin. |
| `origin_fetches` | integer | Number of requests sent to origin. |
| `origin_offload` | number | Origin Offload measures the ratio of bytes served to end users that were cached by Fastly, over the bytes served to end users, between 0 and 1. ((<code>edge_resp_body_bytes</code> + <code>edge_resp_header_bytes</code>) - (<code>origin_fetch_resp_body_bytes</code> + <code>origin_fetch_resp_header_bytes</code>)) / (<code>edge_resp_body_bytes</code> + <code>edge_resp_header_bytes</code>). Previously, Origin Offload used a different formula. <a href="https://www.fastly.com/documentation/reference/changes/2024/06/add-origin_offload-metric">Learn more</a>. |
| `origin_status_1xx` | integer | Number of "Informational" category status codes received from origin. |
| `origin_status_200` | integer | Number of responses received from origin with status code 200 (Success). |
| `origin_status_204` | integer | Number of responses received from origin with status code 204 (No Content). |
| `origin_status_206` | integer | Number of responses received from origin with status code 206 (Partial Content). |
| `origin_status_2xx` | integer | Number of "Success" status codes received from origin. |
| `origin_status_301` | integer | Number of responses received from origin with status code 301 (Moved Permanently). |
| `origin_status_302` | integer | Number of responses received from origin with status code 302 (Found). |
| `origin_status_304` | integer | Number of responses received from origin with status code 304 (Not Modified). |
| `origin_status_3xx` | integer | Number of "Redirection" codes received from origin. |
| `origin_status_400` | integer | Number of responses received from origin with status code 400 (Bad Request). |
| `origin_status_401` | integer | Number of responses received from origin with status code 401 (Unauthorized). |
| `origin_status_403` | integer | Number of responses received from origin with status code 403 (Forbidden). |
| `origin_status_404` | integer | Number of responses received from origin with status code 404 (Not Found). |
| `origin_status_416` | integer | Number of responses received from origin with status code 416 (Range Not Satisfiable). |
| `origin_status_429` | integer | Number of responses received from origin with status code 429 (Too Many Requests). |
| `origin_status_4xx` | integer | Number of "Client Error" codes received from origin. |
| `origin_status_500` | integer | Number of responses received from origin with status code 500 (Internal Server Error). |
| `origin_status_501` | integer | Number of responses received from origin with status code 501 (Not Implemented). |
| `origin_status_502` | integer | Number of responses received from origin with status code 502 (Bad Gateway). |
| `origin_status_503` | integer | Number of responses received from origin with status code 503 (Service Unavailable). |
| `origin_status_504` | integer | Number of responses received from origin with status code 504 (Gateway Timeout). |
| `origin_status_505` | integer | Number of responses received from origin with status code 505 (HTTP Version Not Supported). |
| `origin_status_530` | integer | Number of responses received from origin with status code 530. |
| `origin_status_5xx` | integer | Number of "Server Error" codes received from origin. |
| `requests` | integer | Number of requests processed. |
| `resp_body_bytes` | integer | Total body bytes delivered. |
| `resp_header_bytes` | integer | Total header bytes delivered. |
| `status_1xx` | integer | Number of 1xx "Informational" category status codes delivered. |
| `status_200` | integer | Number of responses delivered with status code 200 (Success). |
| `status_204` | integer | Number of responses delivered with status code 204 (No Content). |
| `status_206` | integer | Number of responses delivered with status code 206 (Partial Content). |
| `status_2xx` | integer | Number of 2xx "Success" status codes delivered. |
| `status_301` | integer | Number of responses delivered with status code 301 (Moved Permanently). |
| `status_302` | integer | Number of responses delivered with status code 302 (Found). |
| `status_304` | integer | Number of responses delivered with status code 304 (Not Modified). |
| `status_3xx` | integer | Number of 3xx "Redirection" codes delivered. |
| `status_400` | integer | Number of responses delivered with status code 400 (Bad Request). |
| `status_401` | integer | Number of responses delivered with status code 401 (Unauthorized). |
| `status_403` | integer | Number of responses delivered with status code 403 (Forbidden). |
| `status_404` | integer | Number of responses delivered with status code 404 (Not Found). |
| `status_416` | integer | Number of responses delivered with status code 416 (Range Not Satisfiable). |
| `status_429` | integer | Number of responses delivered with status code 429 (Too Many Requests). |
| `status_499` | integer | Number of responses sent with status code 499 (Client Disconnected). |
| `status_4xx` | integer | Number of 4xx "Client Error" codes delivered. |
| `status_500` | integer | Number of responses delivered with status code 500 (Internal Server Error). |
| `status_501` | integer | Number of responses delivered with status code 501 (Not Implemented). |
| `status_502` | integer | Number of responses delivered with status code 502 (Bad Gateway). |
| `status_503` | integer | Number of responses delivered with status code 503 (Service Unavailable). |
| `status_504` | integer | Number of responses delivered with status code 504 (Gateway Timeout). |
| `status_505` | integer | Number of responses delivered with status code 505 (HTTP Version Not Supported). |
| `status_530` | integer | Number of responses delivered with status code 530. |
| `status_5xx` | integer | Number of 5xx "Server Error" codes delivered. |
| `tls_v10` | integer | Number of requests received over TLS 1.0. |
| `tls_v11` | integer | Number of requests received over TLS 1.1. |
| `tls_v12` | integer | Number of requests received over TLS 1.2. |
| `tls_v13` | integer | Number of requests received over TLS 1.3. |

## API endpoints

### Get historical domain data for a service

**GET** `/metrics/domains/services/{service_id}`

Fetches historical domain metrics for a given Fastly service, optionally filtering and grouping the results by domain, region, or POP.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `cursor` | string | query | No | Cursor value from the <code>next_cursor</code> field of a previous response, used to retrieve the next page. To request the first page, this should be empty. |
| `datacenter` | string | query | No | Limit query to one or more specific POPs. Values should be comma-separated. |
| `domain` | string | query | No | Limit query to one or more specific domains. Values should be comma-separated. |
| `downsample` | null | query | No | Duration of sample windows. |
| `end` | string | query | No | A valid ISO-8601-formatted date and time, or UNIX timestamp, indicating the exclusive end of the query time range. If not provided, a default is chosen based on the provided <code>downsample</code> value. |
| `group_by` | null | query | No | Dimensions to return in the query. Multiple dimensions may be separated by commas. For example, <code>group_by=domain</code> will return one timeseries for every domain, as a total across all datacenters (POPs). |
| `limit` | string | query | No | Number of results per page. The maximum is 200. |
| `metric` | string | query | No | The metrics to retrieve. Multiple values should be comma-separated. |
| `region` | null | query | No | Limit query to one or more specific geographic regions. Values should be comma-separated. |
| `service_id` | string | path | Yes | Alphanumeric string identifying the service. |
| `start` | string | query | No | A valid ISO-8601-formatted date and time, or UNIX timestamp, indicating the inclusive start of the query time range. If not provided, a default is chosen based on the provided <code>downsample</code> value. |
