Per-API-key usage limits and spend alerts
Every API key on your workspace now reports its own live usage, and you can bound each key independently: a requests-per-minute rate limit, a monthly request quota, and a usage-alert threshold that flags a key before it exhausts its quota. One noisy integration — or a leaked key — trips its own limit instead of spending the throughput your other keys depend on. This is the per-key scoping mature communications APIs expose: the org-wide default applies to every key until you override a single key, and you can read live usage and headroom for each key at any time.Rate limits and monthly quotas
There are two independent controls per key — set either, both, or none:- Rate limit (requests per minute). When a key crosses its per-minute window, that key alone receives
429 RATE_LIMIT_EXCEEDEDwith aRetry-Afterhint. Your other keys are untouched. - Monthly request quota. A hard ceiling per UTC month. Cross it and the key gets
429with a monthly-quota code until the month resets on the 1st (UTC).
The usage-alert threshold
Set a whole-percent alert threshold (1–100) to flag any key whose monthly-quota usage crosses it.GET /api/v1/developer/governance marks each key with alerting: true once its usage reaches the threshold, so a runaway key shows up in your console (and your polling) before it hits the hard quota.
The threshold is advisory — it does not block traffic. Blocking happens only at the rate limit or the quota.
Read state and live usage
Owner / admin / developer scope.effective_limitsis what actually gates the key — the per-key override when one exists, otherwise the org default.overrideisnullwhen the key inherits the org default.monthly_quotaisnullwhen neither the key nor the org has a monthly quota set (usage is still reported; nothing blocks).usage_percentis floored — 79.9% reports79and does not prematurely trip an 80% threshold.- The read hydrates at most 250 keys with live usage;
keys_truncated: truetells you the list was cut.
Set the org-wide default
null on a field to clear it (the key inherits the platform default). alert_threshold_percent accepts an integer from 1 to 100, or null to disable flagging.
The body must contain at least one field — an empty body is a 422, not a silent no-op.
Override a single key
null on a dimension to inherit the org default for that dimension; send both as null to remove the override entirely. A key you do not own returns 404 — the write can never be applied to another tenant’s key.
Constraints and behavior
- Writes take effect on the next request — there is no propagation lag.
- Both writes are audit-logged (
developer.api_governance.org_updated,developer.api_governance.key_updated). - Existing keys are unchanged until you set a limit — a key left unconfigured behaves exactly as before.
- Values of
0are rejected (a zero cap would hard-block the key, which is never the intent; to disable a key, revoke it). Usenullto clear instead. - The rate/quota guards are fail-open on infrastructure errors: a cache blip never 429s or blocks a well-behaved key; only a real over-limit verdict does.