# Check credits

`GET https://www.tryoncloud.com/api/v1/credits`

Returns how many try-ons your account can still run, from the same pool `POST /generate` spends from.

## Request

```bash
curl https://www.tryoncloud.com/api/v1/credits -H "X-API-KEY: $TRYONCLOUD_API_KEY"
```

## Response

```json
{
  "credits_remaining": 4870,
  "purchased_remaining": 4870,
  "purchased_total": 5000,
  "free_remaining": 0,
  "spends_from": "purchased"
}
```

| Field | Meaning |
|---|---|
| `credits_remaining` | Try-ons you can run right now. Use this one |
| `purchased_remaining` | Purchased credits left (they never expire) |
| `purchased_total` | All credits ever purchased |
| `free_remaining` | Free allowance left (only used before your first purchase) |
| `spends_from` | `purchased` once you have bought credits, otherwise `free_allowance` |

## Tips

- Check before a big batch, and alert yourself when `credits_remaining` drops below a few days of usage.
- Rate limit: 60 requests per minute per key. Do not call it before every try-on; a `402` from `/generate` already tells you when you have run out.
- [Buy credits](/pricing#developer-api) from the dashboard Billing page.

## Errors

| HTTP | code | Meaning |
|---|---|---|
| 401 | `NO_KEY`, `INVALID_KEY` | Missing or wrong key |
| 429 | `RATE_LIMITED` | Over 60 requests per minute |
| 500 | `CREDITS_UNAVAILABLE` | Temporary problem, retry |
