Skip to main content
GET
/
usage
Get usage data
curl --request GET \
  --url https://api.routeme.sh/usage \
  --header 'X-Api-Key: <api-key>'
import requests

url = "https://api.routeme.sh/usage"

headers = {"X-Api-Key": "<api-key>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {'X-Api-Key': '<api-key>'}};

fetch('https://api.routeme.sh/usage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.routeme.sh/usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-Api-Key: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.routeme.sh/usage"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("X-Api-Key", "<api-key>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.routeme.sh/usage")
.header("X-Api-Key", "<api-key>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.routeme.sh/usage")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-Api-Key"] = '<api-key>'

response = http.request(request)
puts response.read_body
{
  "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-Api-Key
string
header
required

Management token from the RouteMesh dashboard (Settings → Management Tokens). Required for customer API endpoints (/api-keys, /usage). Tokens are prefixed rmtm_ and scoped to your account. Authenticate by passing the token in the X-Api-Key header. Separate from RPC service keys (rm_), which authenticate dApp traffic to the routing layer.

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.