# Buying credits

> Credits are bought in the dashboard by workspace owners and billing members, not through the API. What you can set up, and what happens when credits run out.

- Human-readable page: https://dashboard.sproutsdata.ai/docs/guides/credits/buying-credits
- This document: https://dashboard.sproutsdata.ai/docs/agents/guides/credits/buying-credits
- Index of every agent document: https://dashboard.sproutsdata.ai/llms.txt
- API base URL: https://api.sproutsdata.ai

## Summary

Credits are bought only in the dashboard (`/credits`), by workspace owners and billing members. No API key, OAuth token or MCP client can buy credits. Agents can read the balance and spend; they cannot pay.

## Rules

- Buying: dashboard `/credits`, "Buy credits", pay by card. Credits arrive when the payment succeeds and are spendable by every key and member at once.
- Who: workspace owners and members with a billing role. Other members can view the balance and transactions only.
- An API key that attempts a purchase gets 403 `credits.purchase_not_allowed`. Do not attempt it; tell the user to ask an owner or billing member.
- Auto top-up (dashboard only): when the balance falls below a chosen level, buys a chosen amount with the card saved by the last purchase. Needs a saved card. Turns itself off after repeated payment failures or with no saved card.
- Purchases appear in `GET /v1/credits/transactions`.

## When credits run out

- Billed calls: 402 `credits.insufficient` before running; nothing charged; `extra.required_credits`, `extra.available_credits`.
- Free operations continue to work.
- Agent runs already started keep their held price and continue.
- Enrichment jobs stop with `stop_reason: "no_credits"` when the workspace can no longer cover them; values found until then are charged.
- After credits are added, resend refused calls; a refused call never ran.
- Frozen wallet: `GET /v1/credits` shows `status: "frozen"`; billed calls get 402 `credits.wallet_frozen`. Contact support@sproutsdata.ai.

## What an agent should do on 402

1. Stop issuing billed calls.
2. Report `extra.required_credits` and `extra.available_credits` to the user.
3. Offer a smaller request that fits (lower `limit`, fewer records), or ask the user to have credits bought at `/credits` in the dashboard.
4. Do not retry until the balance (`GET /v1/credits`, `available`) covers the call.

## See also

- `https://dashboard.sproutsdata.ai/docs/agents/guides/credits`
- `https://dashboard.sproutsdata.ai/docs/agents/guides/credits/balance-and-spend`
