> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://gtm-tools.sh/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://gtm-tools.sh/_mcp/server.

# 402 Insufficient Credits

> What to do when the wallet runs dry

`402 Insufficient Credits` means the request reached the server with valid auth, but your wallet doesn't have enough to cover the tool's cost. No work was done, no charge applied.

## Quick fix: top up

Call `buy_credits` for an immediate top-up.

```bash
curl -X POST https://api.gtm-tools.sh/api/v0/buy_credits \
  -H "Authorization: Bearer $GTM_TOOLS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount": 25}'
```

The minimum is \$5 (500 credits). The default rate is \$1 = 100 credits.

After it succeeds, retry the original call. Your balance is updated immediately.

## Long-term fix: auto-reload

Set up `set_auto_reload` so the saved card is charged automatically when the balance dips below your threshold.

```bash
curl -X POST https://api.gtm-tools.sh/api/v0/set_auto_reload \
  -H "Authorization: Bearer $GTM_TOOLS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": true,
    "threshold": 200,
    "reload_to": 5000
  }'
```

| Parameter   | Behavior                                               |
| ----------- | ------------------------------------------------------ |
| `threshold` | Trigger when the balance drops below this many credits |
| `reload_to` | Top the balance back up to this many credits           |

Once configured, batch jobs won't pause for top-ups.

## Auditing spend

If 402s are catching you off guard, audit recent activity:

```bash
# Current balance + per-tool costs
curl https://api.gtm-tools.sh/api/v0/get_credit_balance \
  -H "Authorization: Bearer $GTM_TOOLS_API_KEY"

# Purchase history (top-ups + auto-reload charges)
curl https://api.gtm-tools.sh/api/v0/list_invoices \
  -H "Authorization: Bearer $GTM_TOOLS_API_KEY"
```

Common patterns that drain a wallet faster than expected:

* A retry loop on a `5xx` or `try_again_later`: each attempt is charged in full, since the debit lands before the tool reaches its provider.
* `list_linkedin_company_employees_posts` (80 credits) called per company in a sweep.
* `list_linkedin_company_employees` (30 credits) called without `title_filters` (returns everyone but still costs the same).

See [Credit Efficiency](/credit-efficiency) for the full list of patterns to avoid.

## Free tools to fall back on

Even with a zero balance, these still work:

| Tool                                                            | Server   |
| --------------------------------------------------------------- | -------- |
| `get_api_key`                                                   | Billing  |
| `get_credit_balance`                                            | Billing  |
| `buy_credits`                                                   | Billing  |
| `set_auto_reload`                                               | Billing  |
| `get_billing_portal`                                            | Billing  |
| `list_invoices`                                                 | Billing  |
| `list_api_keys`                                                 | Billing  |
| `revoke_api_key`                                                | Billing  |
| `list_connected_linkedin_accounts`                              | LinkedIn |
| `list_connected_reddit_accounts`                                | Reddit   |
| `detect_signal` (free dispatch, but the sub-detectors will 402) | Signals  |
| `set_signals_order` / `get_signals_order`                       | Signals  |

You can always recover the wallet from a 0-credit state; `buy_credits` is itself free.