# Get account

> Credit balance and 30 days of usage.

`GET https://api.agent.clatterlabs.xyz/v1/account` (key permission: `account:read`)

Your credit balance and the last 30 days of usage across Line CLI, Cosmos Agent and the Agent API.

## Authorizations

- `Authorization` (string, required): Your API key as a bearer token: `Bearer clsk_...`. Create keys in the [Console](https://console.clatterlabs.com/api-keys).
- `X-Clatter-Account` (string, required): The Account ID that owns the key, like `CL-7K2M9QXA`. Find it in Console › Settings. A missing value answers `401 missing_account_id`; someone else's answers `401 account_mismatch`.

## Response

- `cloud_id` (string): Your Account ID.
- `plan` (string): `Free tier`, or `Clatter Labs team (unlimited)`.
- `balance_usd` (number): Credits left, in US dollars.
- `granted_usd / spent_usd` (number): Credits granted so far and credits used.
- `metered_usd` (number): List price of everything metered (equals `spent_usd` unless the account is a team account).
- `out_of_credits` (boolean): `true` when metered products answer `402 out_of_credits`.
- `usage_30d` (object): Totals for the last 30 days: events, tokens in/out, computer and browser milliseconds, actions, storage bytes, cost.
- `by_product_30d` (object[]): The same, split by product (`line`, `agent`, `api`).

## Example request

```bash
curl "https://api.agent.clatterlabs.xyz/v1/account" \
  -H "Authorization: Bearer $CLATTER_API_KEY" \
  -H "X-Clatter-Account: $CLATTER_ACCOUNT_ID"
```

## Example response

```json
{
  "object": "account",
  "cloud_id": "CL-7K2M9QXA",
  "team": false,
  "plan": "Free",
  "balance_usd": 4.94,
  "granted_usd": 5,
  "spent_usd": 0.06,
  "metered_usd": 0.06,
  "out_of_credits": false,
  "usage_30d": {
    "events": 42,
    "tokens_in": 391204,
    "tokens_out": 18450,
    "compute_ms": 912000,
    "actions": 37,
    "browser_ms": 0,
    "storage_bytes": 20480,
    "cost_usd": 0.061,
    "charged_usd": 0.061
  },
  "by_product_30d": [
    {
      "product": "api",
      "label": "Agent API",
      "events": 12,
      "tokens": 210331,
      "cost_usd": 0.031,
      "charged_usd": 0.031
    },
    {
      "product": "line",
      "label": "Line CLI",
      "events": 30,
      "tokens": 199323,
      "cost_usd": 0.03,
      "charged_usd": 0.03
    }
  ]
}
```


