> For the complete documentation index, see [llms.txt](https://docs.main.atgraphite.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.main.atgraphite.com/apikey_stats.md).

# API key stats

## Get quantitative request statistics for a given api key and time period

Returns quantitative request statistics.

#### Sample request

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

```
https://api.main.atgraphite.com/apikey_stats
   ?apikey=YourApiKeyToken
   &timerange=day
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/apikey_stats?apikey=YourApiKeyToken&timerange=day'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter   | Description                                                                               |
| ----------- | ----------------------------------------------------------------------------------------- |
| apikey\*    | the string representing the api key                                                       |
| timerange\* | the string pre-defined time period parameter, either `hour`, `day`, `week` or `fortnight` |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "calls": 252,
            "timestamp": 1670410800
        },
        {
            "calls": 256,
            "timestamp": 1670414400
        }
    ] 
}
```

## Get last api calls for a given api key

Returns 20 last calls.

#### Sample request

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

```
https://api.main.atgraphite.com/apikey_lastcalls
   ?apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/apikey_lastcalls?apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                         |
| --------- | ----------------------------------- |
| apikey\*  | the string representing the api key |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "chain": {
                "type": "graphite",
                "network": "mainnet"
            },
            "action": "avgblocktime",
            "from": "10.190.6.130",
            "module": "stats",
            "timestamp": 1670492713,
            "data": null
        },
        {
            "chain": {
                "type": "graphite",
                "network": "mainnet"
            },
            "action": "gettotalwalletcount",
            "from": "10.190.6.130",
            "module": "account",
            "timestamp": 1670492713,
            "data": null
        }
    ] 
}
```
