Skip to main content
The metrics endpoint gives you a real-time summary of traffic and payment health across your gateway routes. You can query a rolling 24-hour or 7-day window to understand how many requests your routes are receiving, how many are converting from unpaid 402 challenges to settled payments, and whether the on-chain facilitator is operating normally. The same data is surfaced visually in the Meterlane dashboard under Gateway → Metrics.

GET /api/gateway/metrics

Returns aggregated usage statistics and facilitator status for your organisation.
GET https://gateway.meterlane.app/api/gateway/metrics?window=24h
Authorization: Bearer bp_live_…

Query parameters

window
string
required
The time window to aggregate over. Accepted values:
  • 24h — rolling last 24 hours
  • 7d — rolling last 7 days

Response shape

The response is a JSON object with two top-level keys: metrics and facilitator.

metrics object

metrics.totalRequests
number
Total number of requests received across all routes in the window, including both unpaid probes and paid requests.
metrics.unpaid402
number
Number of requests that returned a 402 Payment Required response. High values relative to metrics.paid may indicate agents are probing but not completing payment.
metrics.paid
number
Number of requests where payment was verified and the upstream was proxied successfully.
metrics.errors
number
Number of requests that resulted in a server-side error (5xx status).
metrics.avgChallengeMs
number | null
Average latency in milliseconds for the gateway to issue the 402 challenge response. null if no challenge requests were recorded in the window.
metrics.avgSettleMs
number | null
Average latency in milliseconds for the full payment verification and settlement cycle before the upstream response is returned. null if no paid requests were recorded in the window.
metrics.errorRate
number
Fraction of total requests that resulted in a server-side error, expressed as a decimal between 0 and 1.
metrics.window
string
The time window that was aggregated: "24h" or "7d".

facilitator object

facilitator.status
string
Current reachability of the x402 facilitator. Possible values: "up", "degraded", "down".
facilitator.latencyMs
number
Round-trip latency in milliseconds for the most recent facilitator health probe.
facilitator.checkedAt
string
ISO 8601 timestamp of when the facilitator health probe was last run.
facilitator.facilitatorUrl
string
The facilitator URL that was probed.

Example request

curl "https://gateway.meterlane.app/api/gateway/metrics?window=24h" \
  -H "Authorization: Bearer bp_live_…"

Example response

{
  "metrics": {
    "window": "24h",
    "orgId": "org_01hx9abcdefg",
    "totalRequests": 4821,
    "unpaid402": 1304,
    "paid": 3517,
    "errors": 12,
    "avgChallengeMs": 38,
    "avgSettleMs": 214,
    "errorRate": 0.0025
  },
  "facilitator": {
    "status": "up",
    "latencyMs": 112,
    "checkedAt": "2025-01-15T14:32:00Z",
    "facilitatorUrl": "https://x402.org"
  }
}

Interpreting the metrics

A healthy gateway typically shows metrics.paid close to metrics.totalRequests - metrics.unpaid402. If metrics.unpaid402 is unexpectedly high and metrics.paid is low, check that your agent clients are correctly handling the 402 challenge and signing payments.
MetricWhat to watch for
facilitator.status: "degraded"Settlement is slower than normal. Requests still succeed but metrics.avgSettleMs will be elevated.
facilitator.status: "down"The on-chain facilitator is unreachable. Paid requests will fail until the facilitator recovers.
metrics.avgSettleMs above 1000 msMay indicate network congestion on the settlement chain.
metrics.unpaid402 / metrics.totalRequests above 50%Agents are probing but not completing payment — check client integration.

Dashboard access

You can view these metrics without using the API directly. In the Meterlane dashboard, navigate to Gateway → Metrics and use the window selector to switch between the 24-hour and 7-day views. The dashboard also plots historical trends and breaks down traffic per route.
Metrics are updated approximately every 60 seconds. There may be a short lag between a request being processed and its data appearing in the API response or dashboard.