Margin Summary
curl --request GET \
--url https://api.nozle.app/engine/api/v1/margin/summary \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.nozle.app/engine/api/v1/margin/summary"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.nozle.app/engine/api/v1/margin/summary', 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://api.nozle.app/engine/api/v1/margin/summary"
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://api.nozle.app/engine/api/v1/margin/summary")
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://api.nozle.app/engine/api/v1/margin/summary",
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://api.nozle.app/engine/api/v1/margin/summary")
.header("Authorization", "Bearer <token>")
.asString();Margin Intelligence
Margin Summary
GET
/
engine
/
api
/
v1
/
margin
/
summary
Margin Summary
curl --request GET \
--url https://api.nozle.app/engine/api/v1/margin/summary \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.nozle.app/engine/api/v1/margin/summary"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.nozle.app/engine/api/v1/margin/summary', 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://api.nozle.app/engine/api/v1/margin/summary"
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://api.nozle.app/engine/api/v1/margin/summary")
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://api.nozle.app/engine/api/v1/margin/summary",
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://api.nozle.app/engine/api/v1/margin/summary")
.header("Authorization", "Bearer <token>")
.asString();Base URL:
The API answers
An unparseable value returns
The totals cover every margin event of your organization in the range. All amounts are integer cents.
https://api.nozle.app/engine/api/v1.
Get an aggregate margin summary across all customers and metrics.
Auth: sk_ only. With API key permissions, the key needs analytic:read; without it the call returns 403 with code: permission_denied.
All margin endpoints require a secret key (
sk_). These endpoints expose cost data that should never be visible to your end users.string
Start of the range, inclusive: a date (
YYYY-MM-DD, which starts at 00:00 UTC that day) or an RFC3339 timestamp such as 2026-07-01T09:30:00Z. from_date is accepted as an alias.string
End of the range: a date (
YYYY-MM-DD) includes that whole day, so to=2026-07-31 covers all of July 31. An RFC3339 timestamp is used as given and is exclusive: it is the instant the range stops at. to_date is accepted as an alias.Date range
from and to take a YYYY-MM-DD date or an RFC3339 timestamp, and you can mix the two. The Python and Go SDKs send from_date and to_date, which the API treats the same way. If you send both from and from_date (or to and to_date), from and to win.
When you leave an end out, the API fills it in:
| You send | Range used |
|---|---|
| Neither | The last month, up to now. |
Only to | The month before to. |
Only from | From from until now. If from is not in the past, one month after from. |
400 with code invalid_date_range when a value cannot be parsed, or when the end of the range is not after its start. Equal dates are valid (they cover one day); an RFC3339 to equal to from is not.
{
"code": "invalid_date_range",
"error": "the end of the range must be after its start"
}
"error": "from must be an RFC3339 timestamp or a date (YYYY-MM-DD)" (or to, with the parameter that failed).
The endpoint reads only from, to, from_date and to_date. Any other query parameter, such as a customer, metric or plan filter, is ignored without an error.
Response
{
"total_revenue_cents": 14750,
"total_cost_cents": 2360,
"total_margin_cents": 12390,
"margin_percent": 84,
"event_count": 295
}
total_margin_cents is revenue minus cost and can be negative. margin_percent is total_margin_cents / total_revenue_cents * 100, not rounded. It is 0 when total revenue is 0 or less. A range with no events returns zeros.