> For AI agents: the complete documentation index is available at https://proxykite.com/docs/llms.txt, the full documentation bundle is available at https://proxykite.com/docs/llms-full.txt.

# Usage

## Traffic


`GET /proxies/{id}/usage`

**Ability:** `read` · Traffic through the proxy in UTC time buckets.

| Query   |                                                                                                    |
| ------- | -------------------------------------------------------------------------------------------------- |
| `range` | `24h` (hourly buckets, default), `7d` (hourly) or `30d` (daily). Anything else falls back to `24h` |



**curl**

```bash
curl 'https://proxykite.com/api/v1/proxies/7/usage?range=7d' \
  -H "Authorization: Bearer $HYP_TOKEN" \
  -H 'Accept: application/json'
```


**Python**

```python
import os
import requests

r = requests.get(
    "https://proxykite.com/api/v1/proxies/7/usage?range=7d",
    headers={"Authorization": f"Bearer {os.environ['HYP_TOKEN']}", "Accept": "application/json"},
    timeout=30,
)
print(r.status_code, r.json())
```


**Node.js**

```js
const res = await fetch('https://proxykite.com/api/v1/proxies/7/usage?range=7d', {
  headers: {
    Authorization: `Bearer ${process.env.HYP_TOKEN}`,
    Accept: 'application/json',
  },
  signal: AbortSignal.timeout(30000),
});
console.log(res.status, await res.json());
```


**PHP**

```php
<?php
$ch = curl_init('https://proxykite.com/api/v1/proxies/7/usage?range=7d');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('HYP_TOKEN'),
        'Accept: application/json',
    ],
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
var_dump($status, json_decode($body, true));
```



**Response `200`**

```json
{
  "data": [
    {"t": "2026-10-09T17:00:00+00:00", "bytes_in": 1048576, "bytes_out": 52428, "requests": 312}
  ],
  "range": "7d",
  "used_bytes": 123456789,
  "quota_bytes": null
}
```

| Field                   | Meaning                                                                                                                                                     |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data[].t`              | start of the bucket (UTC)                                                                                                                                   |
| `bytes_in`, `bytes_out` | bytes in and out through the proxy in that bucket, as counted on your node                                                                                  |
| `requests`              | proxied requests (HTTP requests, CONNECT tunnels, SOCKS5 connections)                                                                                       |
| `used_bytes`            | traffic counted against the quota                                                                                                                           |
| `quota_bytes`           | traffic quota, `null` = unlimited. Reaching it disables the proxy (`over_quota`) and fires [`quota.exceeded`](https://proxykite.com/docs/guide/webhooks.md) |

## Uptime


`GET /proxies/{id}/uptime`

**Ability:** `read` · Was the proxy working, and when it was not, why. Built from the panel's state history: every change
of the proxy's `state` (see [the proxy object](https://proxykite.com/docs/api/proxies.md#the-proxy-object)) is recorded, so a downtime always carries its
cause. History starts on 2026-11-15 (or when the proxy was first seen, if later); time before that is `unknown`.

| Query   |                                                                                                               |
| ------- | ------------------------------------------------------------------------------------------------------------- |
| `range` | `24h` (5-minute buckets, default), `7d` (hourly) or `30d` (4-hour buckets). Anything else falls back to `24h` |

```bash
curl 'https://proxykite.com/api/v1/proxies/7/uptime?range=24h' \
  -H "Authorization: Bearer $HYP_TOKEN" \
  -H 'Accept: application/json'
```

**Response `200`**

```json
{
  "data": {
    "range": "24h",
    "from": "2026-11-14T06:15:00+00:00",
    "to": "2026-11-15T06:15:00+00:00",
    "step_seconds": 300,
    "uptime_pct": 97.9,
    "tracked_since": "2026-11-15T04:00:00+00:00",
    "buckets": [
      {"t": "2026-11-15T05:30:00+00:00", "up_ratio": 1.0, "state": "online", "reason": null},
      {"t": "2026-11-15T05:35:00+00:00", "up_ratio": 0.4, "state": "no_internet", "reason": "No internet through the dongle: timeout"}
    ],
    "incidents": [
      {"state": "no_internet", "reason": "No internet through the dongle: timeout",
       "started_at": "2026-11-15T05:38:10+00:00", "ended_at": "2026-11-15T06:02:41+00:00", "seconds": 1471}
    ]
  }
}
```

| Field                | Meaning                                                                                                                                                                                |
| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `uptime_pct`         | share of the tracked time in this range the proxy was `online`; `null` when nothing is tracked yet                                                                                     |
| `buckets[].up_ratio` | 0 to 1: how much of the bucket the proxy was `online` (`unknown` time is not counted)                                                                                                  |
| `buckets[].state`    | `online`, `unknown`, or the down state that covered most of the bucket's downtime (`no_internet`, `stalled`, `offline`, `node_offline`, `no_data`, `blocked`, `over_limit`, `pending`) |
| `buckets[].reason`   | the latest cause recorded for that state in the bucket, `null` for `online`/`unknown`                                                                                                  |
| `incidents`          | down periods overlapping the range, newest first, at most 50. `ended_at` `null` = still down; `seconds` is clipped to the range                                                        |
