Fastly Historical Stats API

Historical statistics endpoints providing aggregated analytics data for Fastly services over configurable time ranges.

Operations 3

GET /stats Get historical stats #
GET /stats/service/{service_id} Get historical stats for a service #
GET /stats/field/{field} Get historical stats for a specific field #

Documentation

📖
Documentation
https://www.fastly.com/documentation/reference/api/services/
📖
Documentation
https://www.fastly.com/documentation/reference/api/purging/
📖
Documentation
https://www.fastly.com/documentation/reference/api/logging/
📖
Documentation
https://www.fastly.com/documentation/reference/api/metrics-stats/
📖
Documentation
https://www.fastly.com/documentation/reference/api/tls/
📖
Documentation
https://www.fastly.com/documentation/reference/api/vcl-services/
📖
Documentation
https://www.fastly.com/documentation/reference/api/account/
📖
Documentation
https://www.fastly.com/documentation/reference/api/auth-tokens/
📖
Documentation
https://www.fastly.com/documentation/reference/api/acls/
📖
Documentation
https://www.fastly.com/documentation/reference/api/dictionaries/
📖
Documentation
https://www.fastly.com/documentation/guides/compute/
📖
Documentation
https://www.fastly.com/documentation/reference/api/ngwaf/
📖
Documentation
https://www.fastly.com/documentation/reference/api/domain-management/
📖
Documentation
https://www.fastly.com/documentation/reference/api/products/
📖
Documentation
https://www.fastly.com/documentation/reference/api/observability/
📖
Documentation
https://www.fastly.com/documentation/reference/api/api-security/
📖
Documentation
https://www.fastly.com/documentation/reference/api/ddos-protection/
📖
Documentation
https://www.fastly.com/documentation/reference/api/client-side-protection/
📖
Documentation
https://www.fastly.com/documentation/reference/api/publishing/
📖
Documentation
https://www.fastly.com/documentation/reference/api/load-balancing/
📖
Documentation
https://www.fastly.com/documentation/reference/api/utils/
📖
Documentation
https://www.fastly.com/products/ai
📖
Documentation
https://www.fastly.com/products/object-storage

Specifications

Other Resources

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/fastly-historical-stats-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

fastly-historical-stats-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Fastly Metrics and Stats Historical Stats API
  description: The Fastly Metrics and Stats API provides access to both real-time and historical analytics data for Fastly services. The real-time analytics endpoint, served on rt.fastly.com, delivers second-by-second stats including request counts, bandwidth, cache hit ratios, and error rates. Historical stats provide aggregated data over longer time periods. The API also includes the Domain Inspector for per-domain metrics and the Origin Inspector for origin-level performance data.
  version: '1.0'
  contact:
    name: Fastly Support
    url: https://support.fastly.com
  termsOfService: https://www.fastly.com/terms
servers:
- url: https://rt.fastly.com
  description: Fastly Real-Time Analytics Server
- url: https://api.fastly.com
  description: Fastly API Production Server
security:
- apiKeyAuth: []
tags:
- name: Historical Stats
  description: Historical statistics endpoints providing aggregated analytics data for Fastly services over configurable time ranges.
paths:
  /stats:
    get:
      operationId: getHistoricalStats
      summary: Get historical stats
      description: Retrieves historical statistics for all Fastly services associated with the account. Data with day resolution is bucketed based on UTC days and becomes available around 2 AM the following day. Hour resolution becomes available approximately 15 minutes after the end of each hour. Minute data usually becomes available two minutes after the end of the minute. Minutely data older than 35 days and hourly data older than 375 days are not available.
      tags:
      - Historical Stats
      servers:
      - url: https://api.fastly.com
        description: Fastly API Production Server
      parameters:
      - name: from
        in: query
        description: The start date/time for the query in ISO 8601 or Unix timestamp format.
        schema:
          type: string
      - name: to
        in: query
        description: The end date/time for the query in ISO 8601 or Unix timestamp format.
        schema:
          type: string
      - name: by
        in: query
        description: The duration of each time bucket in the response.
        schema:
          type: string
          enum:
          - minute
          - hour
          - day
      - name: region
        in: query
        description: Filter results by Fastly POP region.
        schema:
          type: string
      responses:
        '200':
          description: Successfully retrieved historical statistics.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HistoricalStatsResponse'
        '401':
          description: Unauthorized. The API token is missing or invalid.
  /stats/service/{service_id}:
    get:
      operationId: getHistoricalStatsByService
      summary: Get historical stats for a service
      description: Retrieves historical statistics for a specific Fastly service over the specified time range and resolution.
      tags:
      - Historical Stats
      servers:
      - url: https://api.fastly.com
        description: Fastly API Production Server
      parameters:
      - $ref: '#/components/parameters/serviceId'
      - name: from
        in: query
        description: The start date/time for the query.
        schema:
          type: string
      - name: to
        in: query
        description: The end date/time for the query.
        schema:
          type: string
      - name: by
        in: query
        description: The duration of each time bucket in the response.
        schema:
          type: string
          enum:
          - minute
          - hour
          - day
      - name: region
        in: query
        description: Filter results by Fastly POP region.
        schema:
          type: string
      responses:
        '200':
          description: Successfully retrieved historical statistics for the service.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HistoricalStatsResponse'
        '401':
          description: Unauthorized. The API token is missing or invalid.
        '404':
          description: Service not found.
  /stats/field/{field}:
    get:
      operationId: getHistoricalStatsByField
      summary: Get historical stats for a specific field
      description: Retrieves a single historical statistics field for all services associated with the account.
      tags:
      - Historical Stats
      servers:
      - url: https://api.fastly.com
        description: Fastly API Production Server
      parameters:
      - name: field
        in: path
        required: true
        description: The stats field to retrieve.
        schema:
          type: string
      - name: from
        in: query
        description: The start date/time for the query.
        schema:
          type: string
      - name: to
        in: query
        description: The end date/time for the query.
        schema:
          type: string
      - name: by
        in: query
        description: The duration of each time bucket in the response.
        schema:
          type: string
          enum:
          - minute
          - hour
          - day
      - name: region
        in: query
        description: Filter results by Fastly POP region.
        schema:
          type: string
      responses:
        '200':
          description: Successfully retrieved historical statistics for the field.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HistoricalStatsResponse'
        '401':
          description: Unauthorized. The API token is missing or invalid.
components:
  parameters:
    serviceId:
      name: service_id
      in: path
      required: true
      description: The alphanumeric string identifying the Fastly service.
      schema:
        type: string
  schemas:
    HistoricalStatsResponse:
      type: object
      description: A response containing historical statistics data for the requested time range and resolution.
      properties:
        status:
          type: string
          description: The status of the request.
        meta:
          type: object
          description: Metadata about the query including the time range and filters.
          properties:
            to:
              type: string
              description: The end time of the query.
            from:
              type: string
              description: The start time of the query.
            by:
              type: string
              description: The time bucket duration used.
            region:
              type: string
              description: The region filter applied, if any.
        data:
          type: array
          description: A list of data points with measurements for each time bucket.
          items:
            type: object
            additionalProperties: true
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Fastly-Key
      description: API token used to authenticate requests to the Fastly API.
externalDocs:
  description: Fastly Metrics and Stats API Documentation
  url: https://www.fastly.com/documentation/reference/api/metrics-stats/