# Account API

View your account balance and list subscriptions with their statuses, expiry dates, and product-specific usage fields.

The Account API lets you view your account balance and list the subscriptions that belong to your account. Use it to discover subscription IDs, check whether subscriptions are active, and decide which subscription to use with the Subscription API.

**Quick answer:** call the Account API with your API key in the `X-API-Key` header to list subscriptions, confirm their status and usage, then use a subscription ID with the Subscription API.

## Authentication

Send your [API key](https://dashboard.thunderproxy.com/profile) in the `X-API-Key` header.

```txt
X-API-Key: {apiKey}
```

The `apiKey` query parameter still works for existing integrations, but it is **deprecated**. Do not put your key in a URL. If you send both, the header wins.

## Get account

```http
GET https://api.thunderproxy.com/v1/api/account
X-API-Key: {apiKey}
```

### Query parameters

| Parameter    | Default | Values                                                                                                   |
| ------------ | ------- | -------------------------------------------------------------------------------------------------------- |
| `page`       | `1`     | Positive integer. `0`, negative, decimal, and non-numeric values return `400`.                           |
| `size`       | `50`    | Positive integer, from `1` to `50`. Values above `50` are clamped to `50`. Invalid values return `400`.  |
| `activeOnly` | `false` | `true` or `false`.                                                                                       |

A page past the last page returns `200` with an empty `subscriptions` array and the correct `totalItems` and `totalPages`. An account with no subscriptions returns `totalPages: 0`.

### Example

**cURL**

```bash
curl -H "X-API-Key: YOUR_API_KEY" "https://api.thunderproxy.com/v1/api/account?activeOnly=true&size=25"
```

**Python**

```python
import requests

response = requests.get(
"https://api.thunderproxy.com/v1/api/account",
headers={"X-API-Key": "YOUR_API_KEY"},
params={
"activeOnly": "true",
"size": 25,
},
)
response.raise_for_status()
print(response.json())
```

**JavaScript**

```javascript
const response = await fetch(
"https://api.thunderproxy.com/v1/api/account?" +
new URLSearchParams({
activeOnly: "true",
size: "25",
}),
{ headers: { "X-API-Key": "YOUR_API_KEY" } },
);

if (!response.ok) {
throw new Error(`Request failed with status ${response.status}`);
}

const data = await response.json();
console.log(data);
```

## Response

Successful responses use the standard JSON envelope.

```json
{
  "success": true,
  "data": {
    "account": {
      "balance": 42.5
    },
    "subscriptions": [
      {
        "id": "65f000000000000000000001",
        "active": true,
        "expiresAt": "2026-06-01T00:00:00.000Z",
        "type": "rotating-residential",
        "authUser": "customer-user",
        "dataLeft": 5368709120
      },
      {
        "id": "65f000000000000000000002",
        "active": true,
        "expiresAt": "2026-06-10T00:00:00.000Z",
        "type": "static-isp",
        "authUser": "customer-static",
        "ips": 10
      }
    ],
    "pagination": {
      "page": 1,
      "size": 25,
      "totalItems": 2,
      "totalPages": 1
    }
  }
}
```

## Account fields

| Field     | Description                                     |
| --------- | ----------------------------------------------- |
| `balance` | Available account balance in USD for purchases. |

`dataLeft` is a raw byte count (for example, `5368709120` is 5 GiB).

## Subscription fields

| Field       | Description                                                                           |
| ----------- | ------------------------------------------------------------------------------------- |
| `id`        | Subscription ID. Use this with Subscription API endpoints.                            |
| `active`    | `true` when the subscription is not deleted.                                          |
| `expiresAt` | Renewal or expiry date for the subscription.                                          |
| `type`      | Product slug, such as `rotating-residential`, `rotating-datacenter`, or `static-isp`. |
| `authUser`  | Base proxy username for the subscription.                                             |
| `dataLeft`  | Remaining data in raw bytes for rotating residential and datacenter subscriptions.    |
| `ips`       | Number of static ISP proxies on a static ISP subscription.                            |

## Errors

Invalid query parameters return a `400` JSON response. Multiple validation messages are joined with `; `.

```json
{
  "success": false,
  "error": "Size must be a positive whole number."
}
```

Missing, invalid, or unknown API keys return a `403` JSON response with the error `unauthorized`. A banned account or an account whose email is not verified also returns `403`.

```json
{
  "success": false,
  "error": "unauthorized"
}
```

## Next steps

1. Call the Account API to list active subscriptions.
2. Pick the subscription `id` and product `type`.
3. Use the Subscription API to update settings or export the proxy list for that subscription.

- [Download the Account API OpenAPI specification](/openapi/account.yaml).
- [Use the Subscription API](/api/subscription-api).
- [Understand Activity and Renewals](/subscriptions/activity-and-renewals).
- [Test a Proxy with cURL](/setup/test-proxy-with-curl).
