# 主题清单

全部可订阅的主题；带 Key 时标注是否可读。

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

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

无需 Key，不计入限频。新接入的交易所、新闻源或信号源会自动出现在这里；推特主题是我们精选的 KOL 账号，名单会增减，以这里为准。带上 Key 时，每个主题多一个 `accessible` 字段，表示你的 Key 是否有权限读取。

**公开接口，无需 Key（带 Key 时返回更多信息）**

## 参数

没有参数。

## 请求示例

**cURL**

```bash
curl "https://api.tokenearly.com/v1/topics"
```

**Python**

```python
import requests

resp = requests.get("https://api.tokenearly.com/v1/topics", 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/topics");
  console.log(await resp.json());
}

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

**Go**

```go
package main

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

func main() {
	req, _ := http.NewRequest("GET", "https://api.tokenearly.com/v1/topics", nil)
	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
{
  "spec_version": "1.0",
  "topics": [
    {
      "id": "announcement.binance",
      "type": "announcement",
      "source_id": "binance",
      "names": {
        "zh": "币安",
        "en": "Binance",
        "ko": "바이낸스"
      },
      "accessible": true
    },
    {
      "id": "announcement.okx",
      "type": "announcement",
      "source_id": "okx",
      "names": {
        "zh": "欧易",
        "en": "OKX",
        "ko": "OKX"
      },
      "accessible": false
    },
    {
      "id": "announcement.mexc",
      "type": "announcement",
      "source_id": "mexc",
      "names": {
        "zh": "抹茶",
        "en": "MEXC",
        "ko": "MEXC"
      },
      "accessible": false
    }
  ]
}
```

## 错误

| 错误码 | HTTP | 说明 |
|---|---|---|
| `invalid_api_key` | 401 | Key 不存在，或已被重置 / 吊销。 |
| `key_expired` | 401 | 试用 Key 已到期。重新申请试用 Key，或开通后创建正式 Key。 |
| `ip_not_allowed` | 403 | 这把 Key 设置了 IP 白名单，请求来源 IP 不在其中。 |
| `plan_required` | 403 | 当前套餐不含开发者 API，或不含该项能力。 |
