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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.muzaic.ai/muzaic-api-docs/checking-api-usage-and-balance.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
