curl --request GET \
--url https://core.nozle.app/api/v1/customers/{external_customer_id}/current_usage \
--header 'Authorization: Bearer <token>'import requests
url = "https://core.nozle.app/api/v1/customers/{external_customer_id}/current_usage"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://core.nozle.app/api/v1/customers/{external_customer_id}/current_usage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://core.nozle.app/api/v1/customers/{external_customer_id}/current_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))
}require 'uri'
require 'net/http'
url = URI("https://core.nozle.app/api/v1/customers/{external_customer_id}/current_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<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://core.nozle.app/api/v1/customers/{external_customer_id}/current_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;
}HttpResponse<String> response = Unirest.get("https://core.nozle.app/api/v1/customers/{external_customer_id}/current_usage")
.header("Authorization", "Bearer <token>")
.asString();{
"customer_usage": {
"from_datetime": "2022-07-01T00:00:00Z",
"to_datetime": "2022-07-31T23:59:59Z",
"issuing_date": "2022-08-01",
"amount_cents": 123,
"taxes_amount_cents": 200,
"total_amount_cents": 123,
"charges_usage": [
{
"units": "1.0",
"total_aggregated_units": "1.0",
"events_count": 10,
"amount_cents": 123,
"amount_currency": "EUR",
"charge": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"charge_model": "graduated",
"invoice_display_name": "Setup"
},
"feature": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "Storage",
"code": "storage",
"aggregation_type": "sum_agg"
},
"pricing_unit_details": {
"amount_cents": 200,
"short_name": "CR",
"conversion_rate": "0.5"
},
"filters": [
{
"units": "0.9",
"total_aggregated_units": "1.0",
"amount_cents": 1000,
"events_count": 10,
"invoice_display_name": "AWS eu-east-1",
"pricing_unit_details": {
"amount_cents": 200,
"short_name": "CR",
"conversion_rate": "0.5"
},
"values": {
"region": [
"us-east-1"
]
},
"presentation_breakdowns": [
{
"presentation_by": {},
"units": "9.0"
}
]
}
],
"grouped_usage": [
{
"amount_cents": 1000,
"events_count": 10,
"units": "0.9",
"total_aggregated_units": "1.0",
"pricing_unit_details": {
"amount_cents": 200,
"short_name": "CR",
"conversion_rate": "0.5"
},
"grouped_by": {},
"filters": [
{
"units": "0.9",
"total_aggregated_units": "1.0",
"amount_cents": 1000,
"events_count": 10,
"invoice_display_name": "AWS eu-east-1",
"pricing_unit_details": {
"amount_cents": 200,
"short_name": "CR",
"conversion_rate": "0.5"
},
"values": {
"region": [
"us-east-1"
]
},
"presentation_breakdowns": [
{
"presentation_by": {},
"units": "9.0"
}
]
}
],
"presentation_breakdowns": [
{
"presentation_by": {},
"units": "9.0"
}
]
}
],
"presentation_breakdowns": [
{
"presentation_by": {},
"units": "9.0"
}
]
}
],
"lago_invoice_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"currency": "EUR"
}
}{
"status": 401,
"error": "Unauthorized"
}{
"status": 404,
"error": "Not Found",
"code": "object_not_found"
}Retrieve customer current usage
This endpoint enables the retrieval of the usage-based billing data for a customer within the current period.
curl --request GET \
--url https://core.nozle.app/api/v1/customers/{external_customer_id}/current_usage \
--header 'Authorization: Bearer <token>'import requests
url = "https://core.nozle.app/api/v1/customers/{external_customer_id}/current_usage"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://core.nozle.app/api/v1/customers/{external_customer_id}/current_usage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://core.nozle.app/api/v1/customers/{external_customer_id}/current_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))
}require 'uri'
require 'net/http'
url = URI("https://core.nozle.app/api/v1/customers/{external_customer_id}/current_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<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://core.nozle.app/api/v1/customers/{external_customer_id}/current_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;
}HttpResponse<String> response = Unirest.get("https://core.nozle.app/api/v1/customers/{external_customer_id}/current_usage")
.header("Authorization", "Bearer <token>")
.asString();{
"customer_usage": {
"from_datetime": "2022-07-01T00:00:00Z",
"to_datetime": "2022-07-31T23:59:59Z",
"issuing_date": "2022-08-01",
"amount_cents": 123,
"taxes_amount_cents": 200,
"total_amount_cents": 123,
"charges_usage": [
{
"units": "1.0",
"total_aggregated_units": "1.0",
"events_count": 10,
"amount_cents": 123,
"amount_currency": "EUR",
"charge": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"charge_model": "graduated",
"invoice_display_name": "Setup"
},
"feature": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "Storage",
"code": "storage",
"aggregation_type": "sum_agg"
},
"pricing_unit_details": {
"amount_cents": 200,
"short_name": "CR",
"conversion_rate": "0.5"
},
"filters": [
{
"units": "0.9",
"total_aggregated_units": "1.0",
"amount_cents": 1000,
"events_count": 10,
"invoice_display_name": "AWS eu-east-1",
"pricing_unit_details": {
"amount_cents": 200,
"short_name": "CR",
"conversion_rate": "0.5"
},
"values": {
"region": [
"us-east-1"
]
},
"presentation_breakdowns": [
{
"presentation_by": {},
"units": "9.0"
}
]
}
],
"grouped_usage": [
{
"amount_cents": 1000,
"events_count": 10,
"units": "0.9",
"total_aggregated_units": "1.0",
"pricing_unit_details": {
"amount_cents": 200,
"short_name": "CR",
"conversion_rate": "0.5"
},
"grouped_by": {},
"filters": [
{
"units": "0.9",
"total_aggregated_units": "1.0",
"amount_cents": 1000,
"events_count": 10,
"invoice_display_name": "AWS eu-east-1",
"pricing_unit_details": {
"amount_cents": 200,
"short_name": "CR",
"conversion_rate": "0.5"
},
"values": {
"region": [
"us-east-1"
]
},
"presentation_breakdowns": [
{
"presentation_by": {},
"units": "9.0"
}
]
}
],
"presentation_breakdowns": [
{
"presentation_by": {},
"units": "9.0"
}
]
}
],
"presentation_breakdowns": [
{
"presentation_by": {},
"units": "9.0"
}
]
}
],
"lago_invoice_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"currency": "EUR"
}
}{
"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
The customer external unique identifier (provided by your own application).
"5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
Query Parameters
The unique identifier of the subscription within your application.
"sub_1234567890"
Optional flag to determine if taxes should be applied. Defaults to true if not provided or if null.
true
Filter usage to a specific charge by its Nozle ID (UUID). Replaces deprecated filter_by_charge_id.
"1a901a90-1a90-1a90-1a90-1a901a901a90"
Filter usage to a specific charge by its code. Replaces deprecated filter_by_charge_code.
"storage"
Filter usage to a specific feature by its code.
"storage"
Filter usage by pricing group. Pass key/value pairs as query parameters, e.g. group[cloud]=aws. Replaces deprecated filter_by_group.
Show child attributes
Show child attributes
{ "cloud": "aws" }
Filter usage to a specific charge by its Nozle ID (UUID).
"1a901a90-1a90-1a90-1a90-1a901a901a90"
Filter usage to a specific charge by its code.
"storage"
Filter usage by pricing group. Pass key/value pairs as query parameters, e.g. filter_by_group[cloud]=aws.
Show child attributes
Show child attributes
{ "cloud": "aws" }
When true, returns usage since subscription start instead of the current billing period. Requires one of charge_id, charge_code, group (or their deprecated filter_by_* equivalents) to be set.
true
Filter presentation_breakdowns by a JSON-encoded array of presentation group key values. Only breakdowns matching the provided values will be returned. Pass an empty array to disable presentation_breakdowns entirely.
"[\"engineering\", \"operations\"]"
Response
Customer usage
Show child attributes
Show child attributes