> ## Documentation Index
> Fetch the complete documentation index at: https://altostrat.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Get WAN tunnel ping statistics

> Fetches aggregated time-series data for latency, jitter (mdev), and packet loss for one or more WAN tunnels over a specified time period. If no tunnels are specified, it returns an aggregated average across all tunnels. This endpoint is optimized for creating performance charts with a specified number of data points.



## OpenAPI

````yaml /api/en/monitoring-metrics.yaml post /metrics/wan-tunnels/{tunnelId}/ping-stats
openapi: 3.0.3
info:
  title: Altostrat Monitoring & Metrics API
  version: 1.0.0
  description: >-
    Retrieve portal-facing metrics through the public `/metrics` gateway path,
    including dashboards, WAN tunnels, interfaces, ARP entries, syslogs, BGP,
    and DNS reports.
servers:
  - url: https://v1.api.altostrat.io
security:
  - bearerAuth: []
tags:
  - name: Dashboard
    description: High-level, aggregated metrics for network performance and data usage.
  - name: WAN Tunnels & Performance
    description: >-
      Endpoints for managing and retrieving performance data from SD-WAN
      tunnels.
  - name: Site Interfaces & Metrics
    description: >-
      Endpoints for listing network interfaces at a site and fetching their
      traffic metrics.
  - name: Device Health & Status
    description: Endpoints for monitoring the health and status of network devices.
  - name: ARP Inventory
    description: >-
      Endpoints for querying and managing the Address Resolution Protocol (ARP)
      table to discover devices on the network.
  - name: Network Logs
    description: Access to system, DNS, and BGP logs for diagnostics and security analysis.
  - name: Grafana Dashboards
    description: List Grafana dashboards, query dashboard panels, and export panel data.
  - name: Prometheus Querying
    description: >-
      Discover available metrics and labels, then execute Prometheus queries
      scoped to your workspace.
paths:
  /metrics/wan-tunnels/{tunnelId}/ping-stats:
    post:
      tags:
        - WAN Tunnels & Performance
      summary: Get WAN tunnel ping statistics
      description: >-
        Fetches aggregated time-series data for latency, jitter (mdev), and
        packet loss for one or more WAN tunnels over a specified time period. If
        no tunnels are specified, it returns an aggregated average across all
        tunnels. This endpoint is optimized for creating performance charts with
        a specified number of data points.
      operationId: getWanTunnelPingStatsByTunnel
      parameters:
        - name: tunnelId
          in: path
          required: true
          description: The WAN tunnel identifier.
          schema:
            type: string
            example: wan_2m3h5n7k9j8g7f6e5d4c3b2a1
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - from
                - to
              properties:
                tunnels:
                  type: array
                  description: >-
                    An array of WAN Tunnel UUIDs to query. If omitted, an
                    aggregate of all tunnels is returned.
                  items:
                    type: string
                    format: uuid
                  example:
                    - 9f9510bd-a425-4d9d-a7cf-f845a39e26db
                    - a1b2c3d4-e5f6-7890-1234-567890abcdef
                from:
                  type: string
                  format: date-time
                  description: The start of the time window.
                  example: '2025-10-29T10:00:00Z'
                to:
                  type: string
                  format: date-time
                  description: The end of the time window.
                  example: '2025-10-29T11:00:00Z'
                datapoints:
                  type: integer
                  description: >-
                    The desired number of data points in the response. The data
                    will be aggregated to match this count, up to a maximum of
                    100.
                  default: 100
                  example: 50
      responses:
        '200':
          description: Time-series ping statistics for the requested tunnels.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PingStatsResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/ServerError'
components:
  schemas:
    PingStatsResponse:
      type: object
      properties:
        timestamps:
          type: array
          description: >-
            An array of Unix timestamps (in milliseconds) corresponding to each
            data point.
          items:
            type: integer
            format: int64
          example:
            - 1761619200000
            - 1761619500000
            - 1761619800000
        data:
          type: array
          description: An array of tunnel data series.
          items:
            $ref: '#/components/schemas/PingStatsTunnelData'
    PingStatsTunnelData:
      type: object
      properties:
        tunnel_id:
          type: string
          format: uuid
          description: >-
            The unique identifier of the WAN tunnel. `null` if the data is an
            aggregate of multiple tunnels.
          nullable: true
          example: a1b2c3d4-e5f6-7890-1234-567890abcdef
        latency:
          type: array
          description: >-
            An array of average latency values (in ms) corresponding to the
            timestamps.
          items:
            type: number
            format: float
            nullable: true
          example:
            - 12.5
            - 13.1
            - null
            - 12.8
        packet_loss:
          type: array
          description: >-
            An array of average packet loss percentages corresponding to the
            timestamps. A value of 100 indicates complete loss.
          items:
            type: number
            format: float
            nullable: true
          example:
            - 0
            - 0
            - 100
            - 0.1
        mdev:
          type: array
          description: >-
            An array of mean deviation (jitter) values (in ms) corresponding to
            the timestamps.
          items:
            type: number
            format: float
            nullable: true
          example:
            - 1.2
            - 1.5
            - null
            - 1.3
    ErrorResponse:
      type: object
      properties:
        type:
          type: string
          description: A broad category for the error (e.g., 'invalid_request_error').
          example: invalid_request_error
        code:
          type: string
          description: A short, unique string identifying the specific error.
          example: parameter_invalid
        message:
          type: string
          description: A human-readable description of what went wrong.
          example: The provided 'siteId' is not a valid UUID.
        doc_url:
          type: string
          description: >-
            A direct link to the documentation page for this specific error
            code.
          example: https://docs.altostrat.io/errors/parameter_invalid
  responses:
    BadRequest:
      description: Bad Request - The request was malformed or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Unauthorized - The request lacks valid authentication credentials.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    ServerError:
      description: Internal Server Error - An unexpected error occurred on the server.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````