Skip to main content
GET
/
usage
Get usage data
curl --request GET \
  --url https://lb.routeme.sh/usage \
  --header 'X-Mgmt-Key: <api-key>'
{
  "customer_id": 123,
  "period": {
    "from": "2023-11-07T05:31:56Z",
    "to": "2023-11-07T05:31:56Z"
  },
  "summary": {
    "credits_consumed": 123,
    "request_count": 123,
    "credits_per_request": 123
  },
  "balance": {
    "credits": 123,
    "as_of": "2023-11-07T05:31:56Z"
  },
  "by_chain": [
    {
      "chain_id": "<string>",
      "credits_consumed": 123,
      "request_count": 123
    }
  ],
  "by_api_key": [
    {
      "api_key_id": 123,
      "key_hint": "<string>",
      "credits_consumed": 123,
      "request_count": 123,
      "name": "<string>"
    }
  ],
  "by_api_key_chain": [
    {
      "api_key_id": 123,
      "key_hint": "<string>",
      "chain_id": "<string>",
      "credits_consumed": 123,
      "request_count": 123,
      "name": "<string>"
    }
  ],
  "top_methods": [
    {
      "method": "<string>",
      "credits_consumed": 123,
      "request_count": 123
    }
  ],
  "time_series": [
    {
      "bucket": "2023-11-07T05:31:56Z",
      "credits_consumed": 123,
      "request_count": 123
    }
  ],
  "by_scenario": [
    {
      "scenario": "<string>",
      "credits_consumed": 123,
      "request_count": 123
    }
  ],
  "groups": [
    {
      "credits_consumed": 123,
      "request_count": 123,
      "api_key_id": 123,
      "name": "<string>",
      "key_hint": "<string>",
      "chain_id": "<string>",
      "method": "<string>",
      "scenario": "<string>",
      "day": "<string>"
    }
  ]
}

Authorizations

X-Mgmt-Key
string
header
required

Management API key from the RouteMesh dashboard. Required for customer API endpoints (/api-keys, /usage). Each request also carries the customer's RPC API key in the URL path for the RPC endpoint.

Query Parameters

from
string<date-time>

Start time (RFC3339). Defaults to 30 days ago.

to
string<date-time>

End time (RFC3339). Defaults to now.

include
string

Comma-separated list of sections to include. Options: summary, balance, by_chain, by_api_key, by_api_key_chain, top_methods, time_series, by_scenario. Default: summary,balance.

Example:

"summary,balance,by_chain,by_api_key"

group_by
string

Group usage by a dimension. Options: chain, api_key, api_key,chain, method, day.

Example:

"chain"

granularity
enum<string>

Time bucket size. Options: day, hour. Default: day.

Available options:
day,
hour
chain_id
string

Filter by chain ID (e.g. 1, 137, 8453).

api_key_id
integer

Filter by API key numeric ID (found in list response).

limit
integer

Maximum number of rows returned (default and max depend on config).

Required range: x >= 1

Response

Usage data

customer_id
integer
required
period
object
required
summary
object

Aggregate credits and request count.

balance
object

Current credit balance.

by_chain
object[]

Per-chain breakdown.

by_api_key
object[]

Per-API-key breakdown.

by_api_key_chain
object[]

Per-API-key, per-chain breakdown.

top_methods
object[]

Top RPC methods by spend.

time_series
object[]

Time-bucketed usage data.

by_scenario
object[]

Usage by routing outcome scenario.

groups
object[]

Grouped results when group_by is specified.