# apiUsage

{% hint style="info" %}
This endpoint returns your Hydromancer API usage.
{% endhint %}

## POST Request

<table><thead><tr><th width="161.9998779296875">Field</th><th width="119">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>type</code></td><td>string</td><td>Must be <code>"apiUsage"</code></td></tr><tr><td><code>days</code></td><td>integer</td><td>Number of days to look back (optional, default 30)</td></tr></tbody></table>

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X POST https://api.hydromancer.xyz/info \
  -H "Authorization: Bearer $HYDROMANCER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "apiUsage",
    "days": 7
  }'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import os

response = requests.post(
    'https://api.hydromancer.xyz/info',
    json={
        'type': 'apiUsage',
        'days': 7
    },
    headers={
        'Authorization': f'Bearer {os.environ.get("HYDROMANCER_API_KEY")}',
        'Content-Type': 'application/json'
    }
)

print(response.json())
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
import axios from 'axios';

try {
    const response = await axios.post('https://api.hydromancer.xyz/info', {
        type: 'apiUsage',
        days: 7
    }, {
        headers: {
            'Authorization': `Bearer ${process.env.HYDROMANCER_API_KEY}`,
            'Content-Type': 'application/json'
        }
    });

    console.log(response.data);
} catch (error) {
    console.error('Error:', error.message);
}
```

{% endtab %}
{% endtabs %}

***

## Response Fields

| Field                    | Type   | Description                             |
| ------------------------ | ------ | --------------------------------------- |
| `day`                    | string | Date in `YYYY-MM-DD` format             |
| `request_type`           | string | Endpoint or request type name           |
| `total_requests`         | int    | Total number of requests                |
| `success_requests`       | int    | Number of successful requests           |
| `failure_requests`       | int    | Number of failed requests               |
| `avg_processing_time_ms` | float  | Average processing time in milliseconds |
| `tokens_consumed`        | int    | Number of rate limit tokens consumed    |

<details>

<summary>Response</summary>

```json
[
    {
        "day": "2026-03-16",
        "request_type": "allMids",
        "total_requests": 1,
        "success_requests": 1,
        "failure_requests": 0,
        "avg_processing_time_ms": 2.0,
        "tokens_consumed": 1
    },
    {
        "day": "2026-03-16",
        "request_type": "delegations",
        "total_requests": 5,
        "success_requests": 5,
        "failure_requests": 0,
        "avg_processing_time_ms": 0.0,
        "tokens_consumed": 5
    }
]
```

</details>


---

# 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.hydromancer.xyz/readme/rest-api/api-usage/apiusage.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.
