# Get credits

`GET /v1/credits`

Returns the customer's credits. Only a customer's key may. A job holds the most it may cost from the balance until it completes, then gives back
what it did not cost.

## Headers

- `Authorization` (Bearer key, required): An API key. [Request access](/) to get one.

## Responses

| Status | Meaning |
|---|---|
| 200 | The customer's balance, and what this key may still spend. |
| 401 | Send a valid API key as `Authorization: Bearer <key>`. |
| 403 | The key is not a customer's. |
| 500 | Something went wrong on our side. |

200 returns [Credits](/docs/types/credits.md). Every error is a [Problem](/docs/types/problem.md), whose `detail` says what went wrong.

## Examples

### cURL

```bash
$ curl https://api.sequencylabs.com/v1/credits \
  -H "Authorization: Bearer $SEQUENCY_API_KEY"
```

### Python

```python
import os
import httpx

response = httpx.get(
    "https://api.sequencylabs.com/v1/credits",
    headers={"Authorization": f"Bearer {os.environ['SEQUENCY_API_KEY']}"},
)
response.raise_for_status()
data = response.json()
```

### JavaScript

```javascript
const response = await fetch("https://api.sequencylabs.com/v1/credits", {
  headers: {
    Authorization: `Bearer ${process.env.SEQUENCY_API_KEY}`,
  },
});
const data = await response.json();
```

### Response (200 OK)

```json
{
  "balance": 5000.0,
  "key_limit": null,
  "key_spent": 10.0
}
```
