# Get top-ups and spending

Source: https://provod.ai/en/docs/credits

**`GET /v1/credits`**

Read cumulative workspace top-ups and actual spending.

## Authentication

`Authorization: Bearer <MANAGEMENT_API_KEY>`: a management key bound to the workspace.

The credential determines the workspace. `X-Org-Id` is unsupported.

## Parameters

No request body or parameters are required.

## Response · 200


| Field                | Type   | Description                                                                         |
| -------------------- | ------ | ----------------------------------------------------------------------------------- |
| `data.total_credits` | number | Total payment and manual top-ups over the workspace’s lifetime.                     |
| `data.total_usage`   | number | Total charges for requests and paid guardrail checks over the workspace’s lifetime. |


Amounts are in RUB. This response does not include currency or exact decimal strings. Read [GET /v1/balance](/en/docs/api-key-usage) with an inference key for the available balance after reservations. Subtracting `total_usage` from `total_credits` does not account for reservations, refunds or other balance adjustments.

### Response example

Identifiers and amounts in these examples are illustrative.


**Response JSON**


```json
{
  "data": {
    "total_credits": 1000,
    "total_usage": 125.5
  }
}
```



## Request example

Load the key into a server environment variable. TypeScript uses Node.js fetch; Python uses only the standard library.




TypeScript



Python



cURL




```typescript
const response = await fetch("https://api.provod.ai/v1/credits", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.MANAGEMENT_API_KEY}`,
  },
});
if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`);
console.log(await response.json());
```



```python
import json
import os
from urllib.request import Request, urlopen

request = Request(
    "https://api.provod.ai/v1/credits",
    method="GET",
    headers={"Authorization": f"Bearer {os.environ['MANAGEMENT_API_KEY']}"},
)
with urlopen(request) as response:
    print(json.load(response))
```



```bash
curl --fail-with-body --silent --show-error -X GET \
  "https://api.provod.ai/v1/credits" \
  -H "Authorization: Bearer ${MANAGEMENT_API_KEY}"
```



## Errors


| HTTP  | Error        | Cause                                                                                       |
| ----- | ------------ | ------------------------------------------------------------------------------------------- |
| `401` | Unauthorized | Missing, invalid, disabled, revoked or expired key. The `X-Org-Id` header is also rejected. |
| `403` | Forbidden    | Wrong key kind or insufficient workspace access.                                            |


Authentication error example:

```json
{
  "error": {
    "code": "invalid_api_key",
    "message": "Invalid API key",
    "metadata": {}
  }
}
```

## Next steps

* [Management keys](/en/docs/management-keys)
* [Generation charges](/en/docs/generation-metadata)
