Retrieve subscription lifetime usage
curl --request GET \
--url https://api.getlago.com/api/v1/subscriptions/{external_id}/lifetime_usage \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.getlago.com/api/v1/subscriptions/{external_id}/lifetime_usage"
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}/lifetime_usage', 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}/lifetime_usage",
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}/lifetime_usage"
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}/lifetime_usage")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v1/subscriptions/{external_id}/lifetime_usage")
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{
"lifetime_usage": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_subscription_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_subscription_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"external_historical_usage_amount_cents": 100,
"invoiced_usage_amount_cents": 100,
"current_usage_amount_cents": 100,
"from_datetime": "2024-01-01T00:00:00Z",
"to_datetime": "2024-12-31T23:59:59Z",
"usage_thresholds": [
{
"amount_cents": 100,
"completion_ratio": 0.5,
"reached_at": "2024-01-01T00:00:00Z"
}
]
}
}{
"status": 401,
"error": "Unauthorized"
}{
"status": 404,
"error": "Not Found",
"code": "object_not_found"
}Lifetime Usage
Retrieve subscription lifetime usage
This endpoint allows you to retrieve the total lifetime usage of a subscription.
GET
/
subscriptions
/
{external_id}
/
lifetime_usage
Retrieve subscription lifetime usage
curl --request GET \
--url https://api.getlago.com/api/v1/subscriptions/{external_id}/lifetime_usage \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.getlago.com/api/v1/subscriptions/{external_id}/lifetime_usage"
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}/lifetime_usage', 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}/lifetime_usage",
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}/lifetime_usage"
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}/lifetime_usage")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v1/subscriptions/{external_id}/lifetime_usage")
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{
"lifetime_usage": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_subscription_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_subscription_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"external_historical_usage_amount_cents": 100,
"invoiced_usage_amount_cents": 100,
"current_usage_amount_cents": 100,
"from_datetime": "2024-01-01T00:00:00Z",
"to_datetime": "2024-12-31T23:59:59Z",
"usage_thresholds": [
{
"amount_cents": 100,
"completion_ratio": 0.5,
"reached_at": "2024-01-01T00:00:00Z"
}
]
}
}{
"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
Example:
"5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
Response
Subscription lifetime usage
Show child attributes
Show child attributes
⌘I