# 我的推送

和你的 Bark、企业微信等渠道收到的同一份推送（按你的网页设置过滤）。

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

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

我的推送：经过你在网页上设置的来源开关、关键词、通知语言（原文先推、译文补推）与会员延迟之后，真正推送给你的那一份，和 Bark、企业微信收到的完全相同。与主题事件（`GET /v1/events`）是两种不同的数据，见[我的推送](https://tokenearly.com/developers/my-alerts)。需要先在网页「全局通知管理 → 通知渠道」打开「开发者 API」开关，否则不会产生新的我的推送；响应里的 `channel_enabled` 表示当前开关状态。默认最新的在前，用 `before` 翻页；断线后用 `after=<最后一条通知 id>` 按时间正序补拉。保留最近 7 天。

**需要 API Key**

## 参数

| 参数 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
| `after` | query | string |  | 只返回这条推送之后的，按时间正序（补拉用）。 |
| `before` | query | string |  | 只返回这条推送之前的，按时间倒序（翻页用）。 |
| `limit` | query | integer |  | 最多返回条数，1–200，默认 50。 |

## 请求示例

**cURL**

```bash
curl "https://api.tokenearly.com/v1/alerts?limit=5" \
  -H "Authorization: Bearer $TOKENEARLY_API_KEY"
```

**Python**

```python
import os, requests

resp = requests.get(
    "https://api.tokenearly.com/v1/alerts?limit=5",
    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/alerts?limit=5", {
    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/alerts?limit=5", 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
{
  "alerts": [
    {
      "id": "6af57203e1b0c95f3a7d2e47",
      "category": "announcement",
      "source": {
        "id": "binance",
        "name": "Binance"
      },
      "followup": true,
      "lang": "zh",
      "label": "translation",
      "title": "【币安(BINANCE)】",
      "text": "【译文】\n币安将上线 Fooken (FOO) 并添加种子标签\n— — — — — — — — — —\nhttps://www.binance.com/zh-CN/support/announcement/detail/abc123\n— — — — — — — — — —\n2026-11-12 16:00:00 (UTC+8)",
      "url": "https://www.binance.com/zh-CN/support/announcement/detail/abc123",
      "titles": {
        "en": "Binance Will List Fooken (FOO) with Seed Tag Applied",
        "zh": "币安将上线 Fooken (FOO) 并添加种子标签",
        "ko": "바이낸스, 시드 태그가 적용된 Fooken(FOO) 상장"
      },
      "ref": {
        "type": "announcement",
        "topic": "announcement.binance",
        "event_id": "6af57200e1b0c95f3a7d2e40"
      },
      "created_at": 1794470403
    },
    {
      "id": "6af57201e1b0c95f3a7d2e41",
      "category": "announcement",
      "source": {
        "id": "binance",
        "name": "Binance"
      },
      "followup": false,
      "lang": "en",
      "label": "original",
      "title": "【币安(BINANCE)】",
      "text": "【原文·英文】\nBinance Will List Fooken (FOO) with Seed Tag Applied\n— — — — — — — — — —\nhttps://www.binance.com/en/support/announcement/detail/abc123\n— — — — — — — — — —\n2026-11-12 16:00:00 (UTC+8)",
      "url": "https://www.binance.com/en/support/announcement/detail/abc123",
      "titles": {
        "en": "Binance Will List Fooken (FOO) with Seed Tag Applied"
      },
      "ref": {
        "type": "announcement",
        "topic": "announcement.binance",
        "event_id": "6af57200e1b0c95f3a7d2e40"
      },
      "created_at": 1794470401
    }
  ],
  "has_more": true,
  "next_cursor": "6af57201e1b0c95f3a7d2e41",
  "cursor_param": "before",
  "channel_enabled": true
}
```

## 错误

| 错误码 | 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 不在其中。 |
| `invalid_cursor` | 400 | after / before 不是合法的 ID（查事件时是事件 ID，查我的推送时是推送 ID），两者同时出现，或（仅查事件）updated_after 与 before 同时使用。 |
| `invalid_parameter` | 400 | 参数类型或取值不合法（例如 limit 超出范围）。 |
| `rate_limited` | 429 | 超过这把 Key 的请求频率（REST 与 MCP 合计，间隔见 `/v1/me` 的 `limits.rest_interval_seconds`）；按 Retry-After 头等待后重试。 |
