> For the complete documentation index, see [llms.txt](https://docs.muzaic.ai/muzaic-api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.muzaic.ai/muzaic-api-docs/checking-api-usage-and-balance.md).

# Checking API usage and balance

Manage your Muzaic API usage and view your current monthly balance via the `/accountDetails` endpoint.

## Using accountDetails endpoint

## Get account details

> Returns token balance and quotas for the API key.\
> Use this before generating audio to show remaining tokens in your UI.\
> Requires an API key (or Bearer token issued with API key context).\
> Also available as \`GET /accountDetails/{origin}\`.<br>

```json
{"openapi":"3.0.0","info":{"title":"Muzaic Core API","version":"1.0.0"},"tags":[{"name":"Account","description":"Account information operations"}],"servers":[{"url":"https://m10.muzaic.ai","description":"Core API server"}],"security":[{"apiKeyAuth":[]}],"components":{"securitySchemes":{"apiKeyAuth":{"type":"apiKey","in":"header","name":"MuzaicAPI-Secret-Key","description":"Your Muzaic API Secret Key. Get it after signing in at https://adminpanel.muzaic.ai/\n(account / API keys). Required for normal Core API usage.\n"}}},"paths":{"/accountDetails":{"get":{"summary":"Get account details","description":"Returns token balance and quotas for the API key.\nUse this before generating audio to show remaining tokens in your UI.\nRequires an API key (or Bearer token issued with API key context).\nAlso available as `GET /accountDetails/{origin}`.\n","tags":["Account"],"responses":{"200":{"description":"Account details retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"apiVersion":{"type":"string"},"secretKey":{"type":"string","description":"API key value for this account context"},"tokensAvailable":{"type":"number","description":"Tokens you can spend right now"},"currentBalance":{"type":"integer"},"resources":{"type":"object","additionalProperties":true},"tokens":{"type":"object","properties":{"daily":{"type":"object","properties":{"quota":{"type":"number","nullable":true},"remaining":{"type":"number","nullable":true}}},"weekly":{"type":"object","properties":{"quota":{"type":"number","nullable":true},"remaining":{"type":"number","nullable":true}}},"monthly":{"type":"object","properties":{"quota":{"type":"number","nullable":true},"remaining":{"type":"number","nullable":true}}}}}}}}}},"401":{"description":"Unauthorized"}}}}}}
```

## Response handling

When making a request to an endpoint, you can retrieve several pieces of information:

* `apiVersion`: Indicates the current version of the Muzaic API.
* `secretKey`: The user's secret key for authentication.
* `freeTokensAvailable`: Shows if there are free tokens available (greater than 0) for the account holder.
* `totalUsedTokens`: Provides information on the lifetime usage of tokens.
* `currentBalance`: Helps estimate the cost for the next billing cycle.

#### Example response

```json
{
    "apiVersion": "1.2.0",
    "secretKey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "freeTokensAvailable": 0,
    "totalUsedTokens": 2238247,
    "currentBalance": 248903
}
```

{% hint style="info" %}
**Important:** Always include the 'Muzaic API Secret Key' in your request headers.
{% endhint %}
