---
title: "Daily sweep: send quota-80/quota-100 emails when MTD usage crosses thresholds"
method: POST
path: "/internal/cron/quota-warnings"
tags: ["internal"]
---

# Daily sweep: send quota-80/quota-100 emails when MTD usage crosses thresholds

`POST /internal/cron/quota-warnings`

Daily cron scanning month-to-date `daily_usage` per active org.

Thresholds: quota-100 at ratio >= 1.0, quota-80 at ratio >= 0.8.
Fires for ALL tiers including Pro (MVP parity with
Stripe/Twilio/Anthropic — per-user mute deferred). Frequency caps
(3d / 7d) enforced by send.py via org_email_log so a daily re-scan
while still above threshold is a cheap no-op.

Month boundaries read from _mtd_bounds; daily_usage lag is ~1 day
because daily-usage-snapshot writes yesterday's bucket at 00:05 UTC
and this cron fires at 00:15 UTC. Today's usage will not appear
until tomorrow's snapshot, which is fine — a customer crossing 80%
on day N gets the email on day N+1 at worst.

## Headers

- `x-internal-secret` string, nullable

## Response `200`

Successful Response

- object

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/goldprice/apis/gold-api.md) · [All operations](https://skmtc.net/goldprice/apis/gold-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/goldprice/gold-api/revisions/7885a141754c/schema)
