Spend Controls¶
Spend controls let you set limits on how much your API usage can cost, protecting against runaway costs from automated workflows.
How It Works¶
You set a spending limit for a time period (daily, weekly, or monthly). GloriaMundo tracks your API-triggered workflow costs against this limit. When the limit is reached, further execution requests receive a 402 Payment Required response with "error": "spend_limit_exceeded" until the period resets.
Note
Status code 429 Too Many Requests is reserved for rate-limit violations (too many requests in a short window). Spend-limit blocks always return 402.
Setting a Spend Limit¶
Via Settings¶
- Go to Settings in the sidebar
- Find the Developer section
- Set your spend limit and period
Via API¶
curl -X PUT https://app.gloriamundo.com/api/v1/spend-limit \
-H "Authorization: Bearer ${GM_API_KEY}" \
-H "Content-Type: application/json" \
-d '{"spend_limit_cents": 5000, "spend_period": "daily"}'
This sets a daily limit of $50.00 (5000 cents).
Checking Your Limit¶
Response:
{
"success": true,
"has_limit": true,
"spend_limit_cents": 5000,
"spend_period": "daily",
"current_period_spend_cents": 1250,
"period_reset_at": "2026-03-11T00:00:00Z",
"allowed": true
}
Period Options¶
| Period | Resets At |
|---|---|
daily | Midnight UTC |
weekly | Monday midnight UTC |
monthly | First of the month, midnight UTC |
The spend counter resets automatically when the period expires.
When the Limit Is Reached¶
When your API spend reaches the limit:
- New
POST /api/v1/workflows/{id}/executerequests return402 Payment Requiredwith"error": "spend_limit_exceeded" - Existing running workflows continue to completion
- The response includes when the period resets
You can increase your limit at any time to unblock execution.
Viewing Usage¶
Returns your API call history with per-run costs for the specified number of days.
Spend Limits vs Credit Balance¶
Spend limits and credit balance are independent controls:
- Credit balance — Your overall account balance. When it runs out, nothing runs. Learn more.
- Spend limits — An additional cap specifically for API-triggered workflows. Protects against unexpected high usage from automated systems.
Both are checked before execution. Either one can block a run.
Removing a Spend Limit¶
To remove your spend limit, set spend_limit_cents to 0:
curl -X PUT https://app.gloriamundo.com/api/v1/spend-limit \
-H "Authorization: Bearer ${GM_API_KEY}" \
-H "Content-Type: application/json" \
-d '{"spend_limit_cents": 0, "spend_period": "daily"}'
Warning
You must always include spend_limit_cents in the request body. Omitting it returns a 400 Bad Request error.