Billing Events & Usage Metering
List Billable Metrics
Retrieve a paginated list of billable metrics with optional filtering and sorting
GET
/
metrics
curl "https://api.alguna.io/metrics?page=1&limit=25" \
-H "Authorization: Bearer YOUR_API_KEY"
curl -G "https://api.alguna.io/metrics" \
-H "Authorization: Bearer YOUR_API_KEY" \
--data-urlencode 'page=1' \
--data-urlencode 'limit=10' \
--data-urlencode 'filters=[{"field":"aggregationMethod","operator":"in","value":"sum,count"}]' \
--data-urlencode 'sort=name:asc'
const metrics = await alguna.metrics.list({
page: 1,
limit: 25,
filters: [
{ field: "aggregationMethod", operator: "in", value: "sum,count" }
],
sort: "name:asc"
});
{
"id": "mtr_02zBU3PJ3hJurtFSxDD3Ol",
"description": "No. of Amex Consumer Cards",
"name": "Amex Consumer",
"eventName": "transactions",
"filters": [
{
"operator": "and",
"filters": [
{
"field": "card_scheme",
"operator": "equal",
"value": "amex"
},
{
"field": "card_offering",
"operator": "equal",
"value": "consumer"
}
]
}
],
"aggregation": {
"method": "sum",
"field": "txn_value"
},
"createdAt": "2025-02-24T12:09:05.350876Z",
"updatedAt": "2025-02-24T12:09:05.350877Z",
"organizationID": "8641473c-2d34-46c6-b712-c893934fc8fb"
}
Retrieves a paginated list of all billable metrics. You can filter and sort the results using query parameters.
Query Parameters
integer
default:"1"
The page number to retrieve (1-indexed).
integer
default:"10"
The number of metrics to return per page. Must be one of:
5, 10, 25, 50, or 100. Values exceeding 100 are capped automatically.string
A JSON-encoded array of filter objects. Each filter object has the following properties:
Show Filter Object
Show Filter Object
string
required
The field to filter on. Supported fields:
| Field | Operators | Description |
|---|---|---|
eventName | in | The event name that triggers the metric |
aggregationMethod | in | The aggregation method (e.g. sum, count, max) |
aggregationField | in | The event property being aggregated |
tagIds | in | Tag IDs associated with the metric |
string
required
The comparison operator. All metric filter fields support the
in operator for matching any value in a comma-separated list.string
required
The value to match against. Use comma-separated values with the
in operator.string
Sort specification in
field:order format. Order is either asc (ascending) or desc (descending).Sortable fields: name.curl "https://api.alguna.io/metrics?page=1&limit=25" \
-H "Authorization: Bearer YOUR_API_KEY"
curl -G "https://api.alguna.io/metrics" \
-H "Authorization: Bearer YOUR_API_KEY" \
--data-urlencode 'page=1' \
--data-urlencode 'limit=10' \
--data-urlencode 'filters=[{"field":"aggregationMethod","operator":"in","value":"sum,count"}]' \
--data-urlencode 'sort=name:asc'
const metrics = await alguna.metrics.list({
page: 1,
limit: 25,
filters: [
{ field: "aggregationMethod", operator: "in", value: "sum,count" }
],
sort: "name:asc"
});
Response
{
"id": "mtr_02zBU3PJ3hJurtFSxDD3Ol",
"description": "No. of Amex Consumer Cards",
"name": "Amex Consumer",
"eventName": "transactions",
"filters": [
{
"operator": "and",
"filters": [
{
"field": "card_scheme",
"operator": "equal",
"value": "amex"
},
{
"field": "card_offering",
"operator": "equal",
"value": "consumer"
}
]
}
],
"aggregation": {
"method": "sum",
"field": "txn_value"
},
"createdAt": "2025-02-24T12:09:05.350876Z",
"updatedAt": "2025-02-24T12:09:05.350877Z",
"organizationID": "8641473c-2d34-46c6-b712-c893934fc8fb"
}
array
List of billable metric objects.
Show Metric Object
Show Metric Object
string
The unique identifier for the metric.
string
The name of the metric.
string
A brief description of what the metric measures.
string
The event that triggers the metric.
[]object
An array of filter groups applied to the metric to narrow down the events counted.
Show Filter Group Properties
Show Filter Group Properties
string
The logical operator (e.g., “and”) used to combine the filters within the group.
object
datetime
The timestamp when the metric was created.
datetime
The timestamp when the metric was last updated.
string
The unique identifier for the organization associated with the metric.
integer
Total number of pages available based on the current limit.
integer
The number of items per page used for this request.
⌘I
curl "https://api.alguna.io/metrics?page=1&limit=25" \
-H "Authorization: Bearer YOUR_API_KEY"
curl -G "https://api.alguna.io/metrics" \
-H "Authorization: Bearer YOUR_API_KEY" \
--data-urlencode 'page=1' \
--data-urlencode 'limit=10' \
--data-urlencode 'filters=[{"field":"aggregationMethod","operator":"in","value":"sum,count"}]' \
--data-urlencode 'sort=name:asc'
const metrics = await alguna.metrics.list({
page: 1,
limit: 25,
filters: [
{ field: "aggregationMethod", operator: "in", value: "sum,count" }
],
sort: "name:asc"
});
{
"id": "mtr_02zBU3PJ3hJurtFSxDD3Ol",
"description": "No. of Amex Consumer Cards",
"name": "Amex Consumer",
"eventName": "transactions",
"filters": [
{
"operator": "and",
"filters": [
{
"field": "card_scheme",
"operator": "equal",
"value": "amex"
},
{
"field": "card_offering",
"operator": "equal",
"value": "consumer"
}
]
}
],
"aggregation": {
"method": "sum",
"field": "txn_value"
},
"createdAt": "2025-02-24T12:09:05.350876Z",
"updatedAt": "2025-02-24T12:09:05.350877Z",
"organizationID": "8641473c-2d34-46c6-b712-c893934fc8fb"
}