Usage
List Usage Dimensions
The tenant’s catalog of reported usage dimensions
GET
/
v1
/
usage
/
dimensions
Usage dimension catalog
curl --request GET \
--url https://billing.example.com/v1/usage/dimensions \
--header 'Authorization: Bearer <token>'import requests
url = "https://billing.example.com/v1/usage/dimensions"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://billing.example.com/v1/usage/dimensions', 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://billing.example.com/v1/usage/dimensions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://billing.example.com/v1/usage/dimensions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://billing.example.com/v1/usage/dimensions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/usage/dimensions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{
"dimension": "<string>",
"event_count": 123,
"first_seen": "2023-11-07T05:31:56Z",
"last_seen": "2023-11-07T05:31:56Z"
}
]
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}Returns every distinct usage dimension the authenticated tenant has ever
reported via
Errors use the standard envelope — see Errors.
POST /v1/usage/events,
with first/last seen timestamps and event counts.
Dimensions are created implicitly — the first event that mentions
api_calls adds api_calls to the catalog. Use this endpoint to discover
what your services are actually reporting, or to populate dimension pickers
in internal dashboards.
Example Request
curl https://api.recurso.dev/v1/usage/dimensions \
-H "Authorization: Bearer $API_KEY"
Response
{
"data": [
{
"dimension": "api_calls",
"event_count": 48210,
"first_seen": "2026-01-04T09:12:44Z",
"last_seen": "2026-07-06T23:58:01Z"
},
{
"dimension": "storage_gb",
"event_count": 1310,
"first_seen": "2026-02-11T00:00:12Z",
"last_seen": "2026-07-06T00:00:09Z"
}
]
}
| Field | Type | Description |
|---|---|---|
dimension | string | The dimension name as reported on events |
event_count | integer | Total events recorded against the dimension |
first_seen | string | Timestamp of the earliest event |
last_seen | string | Timestamp of the most recent event |
Naming a dimension identically to an entitlement
feature_key (e.g.
api_calls) lets GET /v1/subscriptions/{id}/usage
join the entitlement’s limit in and report remaining headroom automatically.Errors
| Status | Code | When | Fix |
|---|---|---|---|
401 | unauthorized | Missing or invalid API key | Send Authorization: Bearer $API_KEY |
500 | internal_error | Unexpected server failure | Retry; contact support if it persists |
⌘I
Usage dimension catalog
curl --request GET \
--url https://billing.example.com/v1/usage/dimensions \
--header 'Authorization: Bearer <token>'import requests
url = "https://billing.example.com/v1/usage/dimensions"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://billing.example.com/v1/usage/dimensions', 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://billing.example.com/v1/usage/dimensions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://billing.example.com/v1/usage/dimensions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://billing.example.com/v1/usage/dimensions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/usage/dimensions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{
"dimension": "<string>",
"event_count": 123,
"first_seen": "2023-11-07T05:31:56Z",
"last_seen": "2023-11-07T05:31:56Z"
}
]
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}