获取单个事件
按 ID 取一个事件的最新修订版。
总是返回该事件当前的最新修订版。事件不在你的主题范围内时返回 404(不区分“不存在”和“无权限”)。
需要 API Key
参数
idstringpath必填事件 ID(列表接口返回的 id)。
响应
响应中的事件字段见事件格式。
错误
| 错误码 | 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 不在其中。 |
not_found | 404 | 你的主题范围内没有这个事件(GET /v1/events/{id}),或请求的路径不存在(例如拼错了接口地址)。 |
rate_limited | 429 | 超过这把 Key 的请求频率(REST 与 MCP 合计,间隔见 /v1/me 的 limits.rest_interval_seconds);按 Retry-After 头等待后重试。 |
curl "https://api.tokenearly.com/v1/events/6b0ff643d0e4e92d84810499" \
-H "Authorization: Bearer $TOKENEARLY_API_KEY"import os, requests
resp = requests.get(
"https://api.tokenearly.com/v1/events/6b0ff643d0e4e92d84810499",
headers={"Authorization": f"Bearer {os.environ['TOKENEARLY_API_KEY']}"},
timeout=10,
)
resp.raise_for_status()
print(resp.json())// Node 18+ (built-in fetch)
async function main() {
const resp = await fetch("https://api.tokenearly.com/v1/events/6b0ff643d0e4e92d84810499", {
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);
});package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.tokenearly.com/v1/events/6b0ff643d0e4e92d84810499", 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))
}示例响应
{
"spec_version": "1.0",
"id": "6b0ff643d0e4e92d84810499",
"revision": 3,
"action": "updated",
"topic": "announcement.gate",
"type": "announcement",
"source": {
"id": "gate",
"name": "Gate.io"
},
"published_at": 1796208195,
"published_at_ms": 1796208195000,
"detected_at_ms": 1796208195896,
"data": {
"titles": {
"zh": "Gate 已上线 RITUAL 合约交易、杠杆借贷交易、交易机器人、跟单、闪兑、定投功能",
"en": "Gate Now Supports RITUAL for Futures Trading, Margin Loans, Bots, Copy, Convert, and Auto-Invest",
"ko": "Gate는 RITUAL 계약 거래, 레버리지 대출 거래, 트레이딩 봇, 팔로우 트레이딩, 스왑, 정기 투자 기능을 출시했습니다."
},
"original_lang": "zh",
"translated_langs": [
"ko"
],
"url": "https://www.gate.io/article/103112",
"exchange_category": "listing",
"listing": {
"is_listing": true,
"market": "futures"
},
"symbols": []
}
}