LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"
curl --location --request GET "$LAGO_URL/api/v1/billable_metrics?per_page=2&page=1" \
--header "Authorization: Bearer $API_KEY"
from lago_python_client.client import Client
from lago_python_client.exceptions import LagoApiError
client = Client(api_key='__YOUR_API_KEY__')
try:
client.billable_metrics.find_all({'per_page': 2, 'page': 1})
except LagoApiError as e:
repair_broken_state(e) # do something on error or raise your own exception
require 'lago-ruby-client'
client = Lago::Api::Client.new(api_key: '__YOUR_API_KEY__')
client.billable_metrics.get_all({ per_page: 2, page: 3 })
await client.billableMetrics.findAllBillableMetrics({ per_page: 2, page: 3 });
import "fmt"
import "github.com/getlago/lago-go-client"
func main() {
lagoClient := lago.New().
SetApiKey("__YOUR_API_KEY__")
bmListInput := &lago.BillableMetricListInput{
PerPage: 10,
Page: 1,
}
billableMetricResult, err := lagoClient.BillableMetric().GetList(bmListInput)
if err != nil {
// Error is *lago.Error
panic(err)
}
// billableMetric is *lago.BillableMetricResult
fmt.Println(billableMetricResult)
}
{
"billable_metrics": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "Storage",
"code": "storage",
"recurring": false,
"created_at": "2022-09-14T16:35:31Z",
"aggregation_type": "sum_agg",
"description": "GB of storage used in my application",
"rounding_function": "round",
"rounding_precision": 2,
"expression": "round((ended_at - started_at) * units)",
"field_name": "gb",
"weighted_interval": "seconds",
"filters": [
{
"key": "region",
"values": [
"us-east-1"
]
}
]
}
],
"meta": {
"current_page": 2,
"total_pages": 4,
"total_count": 70,
"next_page": 3,
"prev_page": 1
}
}{
"status": 401,
"error": "Unauthorized"
}Billable metrics
List all billable metrics
This endpoint retrieves all existing billable metrics that represent pricing components of your application.
GET
/
billable_metrics
LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"
curl --location --request GET "$LAGO_URL/api/v1/billable_metrics?per_page=2&page=1" \
--header "Authorization: Bearer $API_KEY"
from lago_python_client.client import Client
from lago_python_client.exceptions import LagoApiError
client = Client(api_key='__YOUR_API_KEY__')
try:
client.billable_metrics.find_all({'per_page': 2, 'page': 1})
except LagoApiError as e:
repair_broken_state(e) # do something on error or raise your own exception
require 'lago-ruby-client'
client = Lago::Api::Client.new(api_key: '__YOUR_API_KEY__')
client.billable_metrics.get_all({ per_page: 2, page: 3 })
await client.billableMetrics.findAllBillableMetrics({ per_page: 2, page: 3 });
import "fmt"
import "github.com/getlago/lago-go-client"
func main() {
lagoClient := lago.New().
SetApiKey("__YOUR_API_KEY__")
bmListInput := &lago.BillableMetricListInput{
PerPage: 10,
Page: 1,
}
billableMetricResult, err := lagoClient.BillableMetric().GetList(bmListInput)
if err != nil {
// Error is *lago.Error
panic(err)
}
// billableMetric is *lago.BillableMetricResult
fmt.Println(billableMetricResult)
}
{
"billable_metrics": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "Storage",
"code": "storage",
"recurring": false,
"created_at": "2022-09-14T16:35:31Z",
"aggregation_type": "sum_agg",
"description": "GB of storage used in my application",
"rounding_function": "round",
"rounding_precision": 2,
"expression": "round((ended_at - started_at) * units)",
"field_name": "gb",
"weighted_interval": "seconds",
"filters": [
{
"key": "region",
"values": [
"us-east-1"
]
}
]
}
],
"meta": {
"current_page": 2,
"total_pages": 4,
"total_count": 70,
"next_page": 3,
"prev_page": 1
}
}{
"status": 401,
"error": "Unauthorized"
}LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"
curl --location --request GET "$LAGO_URL/api/v1/billable_metrics?per_page=2&page=1" \
--header "Authorization: Bearer $API_KEY"
from lago_python_client.client import Client
from lago_python_client.exceptions import LagoApiError
client = Client(api_key='__YOUR_API_KEY__')
try:
client.billable_metrics.find_all({'per_page': 2, 'page': 1})
except LagoApiError as e:
repair_broken_state(e) # do something on error or raise your own exception
require 'lago-ruby-client'
client = Lago::Api::Client.new(api_key: '__YOUR_API_KEY__')
client.billable_metrics.get_all({ per_page: 2, page: 3 })
await client.billableMetrics.findAllBillableMetrics({ per_page: 2, page: 3 });
import "fmt"
import "github.com/getlago/lago-go-client"
func main() {
lagoClient := lago.New().
SetApiKey("__YOUR_API_KEY__")
bmListInput := &lago.BillableMetricListInput{
PerPage: 10,
Page: 1,
}
billableMetricResult, err := lagoClient.BillableMetric().GetList(bmListInput)
if err != nil {
// Error is *lago.Error
panic(err)
}
// billableMetric is *lago.BillableMetricResult
fmt.Println(billableMetricResult)
}
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Page number.
Example:
1
Number of records per page.
Example:
20
⌘I