Skip to main content
Nozle does not send margin alerts today. There is no margin alert type, webhook, email or scheduled check, and no way to set a margin floor that notifies you. The dashboard margin views are lists you open and read. If you want to be told when margin drops, run the check in your own code, on your own schedule, and send the notification yourself. What Nozle does provide:
  • can() economics: a point-in-time estimate of cost, revenue and margin for one call, with the status and the costs it leaves out. See The can() endpoint.
  • A margin policy: a versioned policy (mode, on_unavailable, thresholds) that can() applies to that estimate. In deny mode it denies the call with economic_policy_denied. In warn mode it returns decision: "warn" and the call stays allowed. on_unavailable (allow, warn or deny) decides what happens when the estimate is unavailable or stale. A policy never notifies anyone: it only changes the response of the call.
  • The Cost Intelligence report: ledger-backed costs per Feature and customer, built from your Cost Sheets. See Cost Intelligence report.
Do not build a margin check on margin.trend or the other /margin/* queries. They sum stored margin events only and do not include Cost Sheet costs, so a script built on them can report a cost of 0 while the Cost Intelligence report shows real costs. See Margin Intelligence.

Check the margin of one call

Call can() from your backend before protected work and act on the estimate. Check status first: only estimated carries a margin.
can() estimates one call. It excludes shared_period_costs and finalized_invoice_adjustments, so it is not a customer or plan margin.

Watch costs over a period

Poll the Cost Intelligence report on a schedule you run, and compare summary.total_cost with a limit you keep in your own code. The report returns cost only. It does not return revenue or margin.
Read summary.total_cost, summary.currency, and the per-customer customers breakdown. To compare cost with revenue, read the revenue of the same period from your finalized invoices. Check the uncosted array too: usage without a Cost Sheet rule is listed there instead of being counted as zero. The key needs analytic:read when API key permissions are on.

Usage alerts in React

Usage alerts are separate from margin. The UsageAlert component shows a warning when usage approaches a limit: