curl --request GET \
--url https://api.getlago.com/api/v1/subscriptions/{external_id}/alerts \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.getlago.com/api/v1/subscriptions/{external_id}/alerts"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.getlago.com/api/v1/subscriptions/{external_id}/alerts', 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.getlago.com/api/v1/subscriptions/{external_id}/alerts",
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://api.getlago.com/api/v1/subscriptions/{external_id}/alerts"
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://api.getlago.com/api/v1/subscriptions/{external_id}/alerts")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v1/subscriptions/{external_id}/alerts")
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{
"alerts": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_organization_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_subscription_id": "sub_1234567890",
"lago_wallet_id": null,
"wallet_code": null,
"billable_metric": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "Storage",
"code": "storage",
"recurring": false,
"created_at": "2022-09-14T16:35:31Z",
"aggregation_type": "sum_agg",
"filters": [
{
"key": "region",
"values": [
"us-east-1"
]
}
],
"description": "GB of storage used in my application",
"rounding_function": "round",
"rounding_precision": 2,
"expression": "round((event.properties.ended_at - event.properties.started_at) * event.properties.units)",
"field_name": "gb",
"weighted_interval": "seconds"
},
"alert_type": "billable_metric_current_usage_amount",
"code": "storage_threshold_alert",
"name": "Storage Usage Alert",
"direction": "increasing",
"previous_value": "1000.0",
"last_processed_at": "2025-05-19T10:04:21Z",
"thresholds": [
{
"code": "warn",
"notify_on": [
"triggered",
"resolved"
],
"recurring": false,
"value": "99.0"
}
],
"created_at": "2025-03-20T10:00:00Z"
}
],
"meta": {
"current_page": 2,
"total_pages": 4,
"total_count": 70,
"next_page": 3,
"prev_page": 1
}
}{
"status": 401,
"error": "Unauthorized"
}{
"status": 404,
"error": "Not Found",
"code": "object_not_found"
}List all alerts
This endpoint allows you to retrieve all alerts for a subscription.
curl --request GET \
--url https://api.getlago.com/api/v1/subscriptions/{external_id}/alerts \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.getlago.com/api/v1/subscriptions/{external_id}/alerts"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.getlago.com/api/v1/subscriptions/{external_id}/alerts', 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.getlago.com/api/v1/subscriptions/{external_id}/alerts",
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://api.getlago.com/api/v1/subscriptions/{external_id}/alerts"
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://api.getlago.com/api/v1/subscriptions/{external_id}/alerts")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v1/subscriptions/{external_id}/alerts")
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{
"alerts": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_organization_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_subscription_id": "sub_1234567890",
"lago_wallet_id": null,
"wallet_code": null,
"billable_metric": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "Storage",
"code": "storage",
"recurring": false,
"created_at": "2022-09-14T16:35:31Z",
"aggregation_type": "sum_agg",
"filters": [
{
"key": "region",
"values": [
"us-east-1"
]
}
],
"description": "GB of storage used in my application",
"rounding_function": "round",
"rounding_precision": 2,
"expression": "round((event.properties.ended_at - event.properties.started_at) * event.properties.units)",
"field_name": "gb",
"weighted_interval": "seconds"
},
"alert_type": "billable_metric_current_usage_amount",
"code": "storage_threshold_alert",
"name": "Storage Usage Alert",
"direction": "increasing",
"previous_value": "1000.0",
"last_processed_at": "2025-05-19T10:04:21Z",
"thresholds": [
{
"code": "warn",
"notify_on": [
"triggered",
"resolved"
],
"recurring": false,
"value": "99.0"
}
],
"created_at": "2025-03-20T10:00:00Z"
}
],
"meta": {
"current_page": 2,
"total_pages": 4,
"total_count": 70,
"next_page": 3,
"prev_page": 1
}
}{
"status": 401,
"error": "Unauthorized"
}{
"status": 404,
"error": "Not Found",
"code": "object_not_found"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
External ID of the existing subscription
"5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
Query Parameters
Filter by subscription status. When provided, the subscription is looked up with this status instead of the default active status. Possible values are pending, active, terminated, canceled, or incomplete.
pending, active, terminated, canceled, incomplete "active"
Page number. Defaults to 1. A value that is not a positive integer, such as 0, returns the first page.
1
Number of records per page. Defaults to 100. The maximum is 200, unless another maximum is configured for your organization. A value above the maximum returns a 422 error with value_is_out_of_range on per_page. A value that is not a positive integer, such as 0, returns the default number of records.
20