# 当前 Key 信息

查看 Key 实际可读的主题、限额与 IP 白名单。

> Source: https://tokenearly.com/developers/rest/me · Docs index: https://tokenearly.com/developers/llms.txt · OpenAPI: https://api.tokenearly.com/v1/openapi.json

`GET https://api.tokenearly.com/v1/me`

`topics` 是最终生效的主题：Key 设定的范围与套餐开放来源的交集。接入前先调一次，确认范围符合预期。

**需要 API Key**

## 参数

没有参数。

## 请求示例

**cURL**

```bash
curl "https://api.tokenearly.com/v1/me" \
  -H "Authorization: Bearer $TOKENEARLY_API_KEY"
```

**Python**

```python
import os, requests

resp = requests.get(
    "https://api.tokenearly.com/v1/me",
    headers={"Authorization": f"Bearer {os.environ['TOKENEARLY_API_KEY']}"},
    timeout=10,
)
resp.raise_for_status()
print(resp.json())
```

**Node.js**

```javascript
// Node 18+ (built-in fetch)
async function main() {
  const resp = await fetch("https://api.tokenearly.com/v1/me", {
    headers: { Authorization: `Bearer ${process.env.TOKENEARLY_API_KEY}` },
  });
  const body = await resp.json();
  if (!resp.ok) throw new Error(`${body.error.code}: ${body.error.message}`);
  console.log(body);
}

main().catch((err) => {
  console.error(err);
  process.exit(1);
});
```

**Go**

```go
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
)

func main() {
	req, _ := http.NewRequest("GET", "https://api.tokenearly.com/v1/me", nil)
	req.Header.Set("Authorization", "Bearer "+os.Getenv("TOKENEARLY_API_KEY"))
	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(resp.Status, string(body))
}
```

## 示例响应

```json
{
  "key": {
    "id": "key_3f9c2a71d0b84e6c5a12",
    "name": "prod-bot",
    "prefix": "te_live_Ab12",
    "topics": [
      "*"
    ],
    "allowed_ips": [
      "203.0.113.5"
    ],
    "kind": "standard",
    "status": "active",
    "created_at": 1794100000,
    "last_used_at": 1794200000,
    "expires_at": null
  },
  "limits": {
    "api_keys": 1,
    "streams_per_key": 1,
    "rest_interval_seconds": 3,
    "api_history_days": 30
  },
  "topics": [
    "announcement.binance",
    "announcement.okx",
    "announcement.mexc"
  ],
  "trial": false,
  "expires_at": null,
  "access_expires_at": 1796800000
}
```

## 错误

| 错误码 | HTTP | 说明 |
|---|---|---|
| `missing_api_key` | 401 | 没有带 Key。用 Authorization: Bearer <Key>。 |
| `invalid_api_key` | 401 | Key 不存在，或已被重置 / 吊销。 |
| `key_expired` | 401 | 试用 Key 已到期。重新申请试用 Key，或开通后创建正式 Key。 |
| `plan_required` | 403 | 当前套餐不含开发者 API，或不含该项能力。 |
| `ip_not_allowed` | 403 | 这把 Key 设置了 IP 白名单，请求来源 IP 不在其中。 |
| `rate_limited` | 429 | 超过这把 Key 的请求频率（REST 与 MCP 合计，间隔见 `/v1/me` 的 `limits.rest_interval_seconds`）；按 Retry-After 头等待后重试。 |
