# Credits

> Manage your Qualia credit balance

## Get Balance

Retrieve your current credit balance and how it splits: starter credits,
prepaid credits and each voucher, left and granted.

```python
from qualia import Qualia

client = Qualia()

balance = client.credits.get()
```

**Response**

```json title="CreditBalance"
{
"balance": 1700,
"grant_balance": 80,
"grant_original_balance": 100,
"bundle_balance": 1000,
"bundle_original_balance": 1000,
"bundle_last_top_up": "2026-10-01T09:00:00Z",
"vouchers": [
  {
    "label": "Launch",
    "balance": 620,
    "original_balance": 1000,
    "expires_at": "2026-12-31T00:00:00Z"
  }
]
}
```

The split is for members of the organization. When it cannot be read (a key
whose creator is no longer a member), its fields are `None` and `balance`
still answers.

## Redeem a Voucher

Redeem a credit voucher for your organization, as the billing page does. Any
member may redeem. The key needs the `credits:write` scope, and it must be an
organization key: credits are the organization's, so a workspace key is
refused. Buying credits stays in the dashboard.

```python
from qualia import Qualia
from qualia.exceptions import QualiaAPIError

client = Qualia()

try:
    redemption = client.credits.redeem("SPRING-2026")
    print(f"{redemption.credits_granted} credits added")
except QualiaAPIError as error:
    # 400: "Invalid voucher code", "Voucher code has already been redeemed",
    # "Voucher code has expired" or "Voucher code has reached maximum uses"
    print(error.message)
```

**Response**

```json title="VoucherRedemption"
{
"credits_granted": 1500,
"account_id": "11111111-1111-4111-8111-111111111111"
}
```

A key without `credits:write`, or a workspace key, raises `AuthenticationError`
(403).
