> 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 detailed information about the API account

```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"}}},"paths":{"/accountDetails":{"get":{"summary":"Get account details","description":"Returns detailed information about the API account","tags":["Account"],"responses":{"200":{"description":"Account details retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"integer"},"name":{"type":"string"},"tokensRemaining":{"type":"integer","description":"Remaining tokens in account"},"tokensUsed":{"type":"integer","description":"Tokens used this period"},"plan":{"type":"string","description":"Account plan type"},"expiresAt":{"type":"string","format":"date-time","description":"Account expiration date"},"createdAt":{"type":"string","format":"date-time","description":"Account creation date"}}}}}},"401":{"description":"Unauthorized"},"404":{"description":"Account not found"}}}}}}
```

## 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 %}
