Skip to main content
GET
/
v1
/
tunnels
/
:tunnelId
/
metrics
Get Metrics History
curl --request GET \
  --url https://api.example.com/v1/tunnels/:tunnelId/metrics
{
  "capturedAt": "<string>",
  "ttl": 123,
  "opn": 123,
  "rt1Ms": {},
  "p90Ms": {},
  "requests": 123,
  "errors": 123,
  "bytes": 123,
  "code": "<string>",
  "message": "<string>",
  "details": {}
}

Authentication

Requires a valid access token in the Authorization header.

Path Parameters

tunnelId
string
required
The UUID of the tunnel to retrieve metrics for. Must belong to the authenticated user.

Query Parameters

from
string
required
ISO 8601 timestamp representing the start of the time range (inclusive).
to
string
required
ISO 8601 timestamp representing the end of the time range (inclusive). Must be greater than or equal to from.

Response

Returns an array of metrics points ordered by capture time. Each point represents a downsampled snapshot taken approximately every 10 seconds.
capturedAt
string
ISO 8601 timestamp when the metrics point was captured.
ttl
integer
Total number of connections since tunnel start at this point in time.
opn
integer
Current number of open/active connections at this point in time.
rt1Ms
number | null
Response time for the 1st percentile in milliseconds, or null if unavailable.
p90Ms
number | null
Response time for the 90th percentile in milliseconds, or null if unavailable.
requests
integer
Total number of requests processed at this point in time.
errors
integer
Total number of errors encountered at this point in time.
bytes
integer
Total number of bytes transferred at this point in time.
Metrics history is retained for 7 days. Queries beyond this retention period will return an empty array for those time ranges.
The response is limited to a maximum of 5000 points per request. If your time range contains more points, consider narrowing the from and to window or paginating through smaller time ranges.
The from timestamp must be less than or equal to the to timestamp. Invalid date formats or reversed ranges will result in a 400 error.

Example Request

curl -X GET "https://api.rs-tunnel.example.com/v1/tunnels/550e8400-e29b-41d4-a716-446655440000/metrics?from=2024-03-15T10:00:00Z&to=2024-03-15T11:00:00Z" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Example Response

[
  {
    "capturedAt": "2024-03-15T10:00:00.000Z",
    "ttl": 1420,
    "opn": 10,
    "rt1Ms": 4.8,
    "p90Ms": 115.2,
    "requests": 1398,
    "errors": 20,
    "bytes": 4893184
  },
  {
    "capturedAt": "2024-03-15T10:00:10.000Z",
    "ttl": 1435,
    "opn": 11,
    "rt1Ms": 5.1,
    "p90Ms": 118.7,
    "requests": 1412,
    "errors": 21,
    "bytes": 4952320
  },
  {
    "capturedAt": "2024-03-15T10:00:20.000Z",
    "ttl": 1450,
    "opn": 12,
    "rt1Ms": 5.3,
    "p90Ms": 121.4,
    "requests": 1426,
    "errors": 22,
    "bytes": 5011456
  }
]

Error Responses

code
string
Error code identifier.
message
string
Human-readable error message.
details
unknown
Additional error details, if available.

Common Errors

  • 400 INVALID_TUNNEL_ID: Tunnel identifier is missing or malformed
  • 400 INVALID_INPUT: Missing or invalid from/to query parameters, or from > to
  • 404 TUNNEL_NOT_FOUND: The tunnel does not exist or does not belong to the authenticated user
  • 401 UNAUTHORIZED: Missing or invalid access token

Build docs developers (and LLMs) love