Skip to docs content

CI/CD Spend Gate

The public spend-check endpoint returns month-to-date spend, forecast paces, your threshold, and an overBudget flag. Point a CI job at it with a Fluxtab API token to fail a deploy when you are over budget.

Why use it

Dashboards and Slack alerts help humans notice overruns. A gate in CI makes the budget check automatic: if MTD spend already exceeds the budget you care about, the pipeline fails before you ship more load.

This still does not hard-stop provider traffic. It only stops your pipeline when Fluxtab says you are over budget.

Setup

  1. Create a token under Settings → API access (shown once; starts with ftab_). Store it as a CI secret (for example FLUXTAB_TOKEN).
  2. Optionally note your alert threshold in Fluxtab, or plan to pass budget= on the request to override overBudget for that check only.
  3. Add a job step that calls spend-check and exits non-zero when over budget:
RESP=$(curl -sS -H "Authorization: Bearer $FLUXTAB_TOKEN" \
  "https://fluxtab.dev/api/public/spend-check?budget=500")

echo "$RESP" | grep -q '"overBudget":true' && exit 1
  1. Run the job on a schedule or on every deploy. Watch rate limits: each token is limited to 60 requests per hour by default.

Full response shape and auth details are under API Access. Forecast fields in the payload are an estimate, not a guarantee — use overBudget / mtdSpend for the gate, not the forecast alone.