Metrics

Get Metric Value

Compute a metric value for a customer and optional timeframe. Defaults to ALL timeframe when not provided.

GET
/metrics/{id}/value

Authorization

bearerAuth
AuthorizationBearer <token>

Use your secret API key as the bearer token

In: header

Path Parameters

id*string

Metric ID

Match^met_[A-Za-z0-9]{22}$

Query Parameters

customerId*string

Customer ID to compute the metric for

Match^cus_[A-Za-z0-9]{22}$
timeframe?|string

Optional timeframe: ALL (default), RELATIVE (days), or ABSOLUTE (start/end).

Response Body

application/json

application/json

application/json

application/json

curl -X GET "https://api.getlumen.dev/v1/metrics/string/value?customerId=string"
{
  "id": "met_DQ6f7a8b9c0d1e2f3g4h5i",
  "name": "API Calls",
  "customerId": "cus_Lo4xGg1Yk9pB2eWv3sNt",
  "value": 1245,
  "queryType": "simple",
  "timeframe": {
    "type": "RELATIVE",
    "days": 30
  }
}
{
  "error": "Invalid timeframe parameters for the specified timeframe type"
}
{
  "error": "Metric not found"
}
{
  "error": "Failed to get metric value"
}