> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stagingspaces.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Credits

> How credits work in the StagingSpaces API

# Credits

Credits are the currency of the StagingSpaces API. Each credit costs \$1.

## Credit costs

| Action                | Credits |
| --------------------- | ------- |
| Stage an image        | 1       |
| Enhance to 4K         | 1       |
| Product placement     | Free    |
| Claim code redemption | Free    |

## Getting credits

* **First API key bonus:** 10 free credits on your first key creation
* **Dashboard purchase:** Buy credit packs at [studio.stagingspaces.app](https://studio.stagingspaces.app)
* **Auto top-up:** Automatically buy credits when balance falls below a threshold

## Checking balance

```bash theme={null}
curl https://stagingspaces-production-6fb7.up.railway.app/api/v1/credits \
  -H "Authorization: Bearer YOUR_API_KEY"
```

```json theme={null}
{
  "credits": 47,
  "has_payment_method": true,
  "total_purchased": 100,
  "total_used": 53
}
```

## Auto top-up

Avoid staging interruptions by enabling auto top-up:

```bash theme={null}
curl -X PUT https://stagingspaces-production-6fb7.up.railway.app/api/v1/settings/auto-topup \
  -H "Authorization: Bearer <firebase-token>" \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": true,
    "amount": 20,
    "threshold": 5
  }'
```

When your balance drops below **5 credits**, we'll automatically charge your card for **20 credits**.

<Info>
  Auto top-up requires a payment method on file. Add one in your [dashboard billing settings](https://studio.stagingspaces.app).
</Info>

## Insufficient credits

If you run out of credits and don't have auto top-up enabled, staging requests return a `402` error:

```json theme={null}
{
  "error": "Insufficient credits",
  "credits_required": 1,
  "credits_available": 0,
  "message": "Purchase credits at studio.stagingspaces.app/api-settings"
}
```
