Download OpenAPI specification:
Cloudflare Workers + D1 + Hono 实现的内容管理 REST API。
articles, 通过 article_type 区分hot — 机器采集的热点 (GitHub Trending / HN / 36kr 等)knowledge — 手动创建的知识文章 (SEO / AI / 中医 等垂直领域){ ok, data, error, meta }X-API-Key Header (除 /health 外所有接口)// 成功
{ "ok": true, "data": {...}, "meta": {"page": 1, "page_size": 20, "total": 123} }
// 失败
{ "ok": false, "error": {"code": 422, "message": "Invalid body", "detail": {...}} }
文章 CRUD 端点。
article_type='knowledge')type 参数过滤列表查询。强烈建议至少传 type=hot 或 type=knowledge, 让查询走部分索引。
支持多条件组合, 分页默认 page=1, page_size=20, page_size 上限 100。
| type | string Enum: "hot" "knowledge" 文章类型 |
| status | string Enum: "draft" "scheduled" "published" "archived" 状态 |
| category_id | integer >= 1 分类 ID |
| source | string 数据源 (如 |
| tag | string 标签 slug |
| featured | boolean 仅精选 |
| pinned | boolean 仅置顶 |
| lang | string Enum: "zh" "en" "ja" "other" 原始内容语言 |
| since | integer <int64> >= 0 仅返回 |
| page | integer >= 1 Default: 1 页码 |
| page_size | integer [ 1 .. 100 ] Default: 20 每页条数 (上限 100) |
| sort | string Default: "created_at" Enum: "created_at" "updated_at" "published_at" "source_published_at" "source_score" 排序字段 |
| order | string Default: "desc" Enum: "asc" "desc" 排序方向 |
{- "ok": true,
- "data": [
- {
- "id": 1,
- "uuid": "a5d478fd-3e65-4fa6-80cb-27dbe46d7597",
- "slug": "2026-seo-关键词研究方法论-d37b31",
- "article_type": "knowledge",
- "title": "2026 SEO 关键词研究方法论",
- "content": "# 关键词研究\\n\\n系统化拆解 5 个步骤...",
- "content_format": "markdown",
- "excerpt": null,
- "cover_image": null,
- "category_id": 1,
- "status": "published",
- "visibility": "public",
- "source_lang": "zh",
- "view_count": 0,
- "like_count": 0,
- "comment_count": 0,
- "word_count": 100,
- "reading_time": 1,
- "is_featured": true,
- "is_pinned": false,
- "allow_comments": true,
- "locale": "zh-CN",
- "created_at": "2026-07-22T08:21:47.000Z",
- "updated_at": "2026-07-22T08:21:47.000Z",
- "published_at": "2026-07-22T08:21:47.000Z"
}
], - "meta": {
- "page": 1,
- "page_size": 20,
- "total": 1,
- "total_pages": 1
}
}创建知识文章 (article_type='knowledge')。
热点文章 (article_type='hot') 由采集器直接写 D1, 不通过此端点。
自动生成 uuid / slug / word_count / reading_time。
| title required | string [ 1 .. 200 ] characters |
| subtitle | string <= 500 characters |
| content required | string non-empty |
| content_format | string Default: "markdown" Enum: "markdown" "html" "plain" |
| excerpt | string <= 1000 characters |
| cover_image | string <uri> |
| category_id | integer >= 1 |
| status | string Default: "draft" Enum: "draft" "scheduled" "published" "archived" |
| visibility | string Default: "public" Enum: "public" "members" "private" "password" |
| password | string [ 4 .. 100 ] characters |
| scheduled_at | integer Unix ms, status=scheduled 时必填 |
| meta_title | string <= 200 characters |
| meta_description | string <= 500 characters |
| meta_keywords | string <= 200 characters |
| canonical_url | string <uri> |
| og_image | string <uri> |
| locale | string Default: "zh-CN" |
| is_featured | boolean Default: false |
| is_pinned | boolean Default: false |
| allow_comments | boolean Default: true |
| tag_ids | Array of integers[ items >= 1 ] 关联的 tag ID 列表 (整体替换) |
{- "title": "2026 SEO 关键词研究方法论",
- "content": "# 关键词研究\n系统化拆解 5 个步骤:\n1. 意图分析\n2. 词库扩展\n3. 难度评估\n4. SERP 分析\n5. 优先级排序\n",
- "category_id": 1,
- "tag_ids": [
- 1
], - "status": "published",
- "is_featured": true
}{- "ok": true,
- "data": {
- "id": 0,
- "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
- "slug": "string",
- "article_type": "hot",
- "title": "string",
- "subtitle": "string",
- "content": "string",
- "content_format": "markdown",
- "excerpt": "string",
- "category_id": 0,
- "status": "draft",
- "visibility": "public",
- "password_hash": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "published_at": "2019-08-24T14:15:22Z",
- "scheduled_at": "2019-08-24T14:15:22Z",
- "archived_at": "2019-08-24T14:15:22Z",
- "source": "string",
- "source_id": "string",
- "source_author": "string",
- "source_published_at": "2019-08-24T14:15:22Z",
- "source_score": 0,
- "source_metadata": { },
- "source_lang": "zh",
- "view_count": 0,
- "like_count": 0,
- "comment_count": 0,
- "word_count": 0,
- "reading_time": 0,
- "meta_title": "string",
- "meta_description": "string",
- "meta_keywords": "string",
- "locale": "zh-CN",
- "translation_group_id": "string",
- "is_featured": true,
- "is_pinned": true,
- "allow_comments": true
}
}{- "ok": true,
- "data": {
- "id": 0,
- "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
- "slug": "string",
- "article_type": "hot",
- "title": "string",
- "subtitle": "string",
- "content": "string",
- "content_format": "markdown",
- "excerpt": "string",
- "category_id": 0,
- "status": "draft",
- "visibility": "public",
- "password_hash": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "published_at": "2019-08-24T14:15:22Z",
- "scheduled_at": "2019-08-24T14:15:22Z",
- "archived_at": "2019-08-24T14:15:22Z",
- "source": "string",
- "source_id": "string",
- "source_author": "string",
- "source_published_at": "2019-08-24T14:15:22Z",
- "source_score": 0,
- "source_metadata": { },
- "source_lang": "zh",
- "view_count": 0,
- "like_count": 0,
- "comment_count": 0,
- "word_count": 0,
- "reading_time": 0,
- "meta_title": "string",
- "meta_description": "string",
- "meta_keywords": "string",
- "locale": "zh-CN",
- "translation_group_id": "string",
- "is_featured": true,
- "is_pinned": true,
- "allow_comments": true,
- "tags": [
- {
- "id": 0,
- "name": "string",
- "slug": "string",
- "description": "string",
- "article_count": 0,
- "created_at": "2019-08-24T14:15:22Z"
}
]
}
}所有字段可选。传 tag_ids 会整体替换关联 (先删后插, 不是增量)。
| uuid required | string <uuid> 文章 UUID |
| title required | string [ 1 .. 200 ] characters |
| subtitle | string <= 500 characters |
| content required | string non-empty |
| content_format | string Default: "markdown" Enum: "markdown" "html" "plain" |
| excerpt | string <= 1000 characters |
| cover_image | string <uri> |
| category_id | integer >= 1 |
| status | string Default: "draft" Enum: "draft" "scheduled" "published" "archived" |
| visibility | string Default: "public" Enum: "public" "members" "private" "password" |
| password | string [ 4 .. 100 ] characters |
| scheduled_at | integer Unix ms, status=scheduled 时必填 |
| meta_title | string <= 200 characters |
| meta_description | string <= 500 characters |
| meta_keywords | string <= 200 characters |
| canonical_url | string <uri> |
| og_image | string <uri> |
| locale | string Default: "zh-CN" |
| is_featured | boolean Default: false |
| is_pinned | boolean Default: false |
| allow_comments | boolean Default: true |
| tag_ids | Array of integers[ items >= 1 ] 关联的 tag ID 列表 (整体替换) |
{- "title": "string",
- "subtitle": "string",
- "content": "string",
- "content_format": "markdown",
- "excerpt": "string",
- "category_id": 1,
- "status": "draft",
- "visibility": "public",
- "password": "string",
- "scheduled_at": 0,
- "meta_title": "string",
- "meta_description": "string",
- "meta_keywords": "string",
- "locale": "zh-CN",
- "is_featured": false,
- "is_pinned": false,
- "allow_comments": true,
- "tag_ids": [
- 1
]
}{- "ok": true,
- "data": {
- "id": 0,
- "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
- "slug": "string",
- "article_type": "hot",
- "title": "string",
- "subtitle": "string",
- "content": "string",
- "content_format": "markdown",
- "excerpt": "string",
- "category_id": 0,
- "status": "draft",
- "visibility": "public",
- "password_hash": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "published_at": "2019-08-24T14:15:22Z",
- "scheduled_at": "2019-08-24T14:15:22Z",
- "archived_at": "2019-08-24T14:15:22Z",
- "source": "string",
- "source_id": "string",
- "source_author": "string",
- "source_published_at": "2019-08-24T14:15:22Z",
- "source_score": 0,
- "source_metadata": { },
- "source_lang": "zh",
- "view_count": 0,
- "like_count": 0,
- "comment_count": 0,
- "word_count": 0,
- "reading_time": 0,
- "meta_title": "string",
- "meta_description": "string",
- "meta_keywords": "string",
- "locale": "zh-CN",
- "translation_group_id": "string",
- "is_featured": true,
- "is_pinned": true,
- "allow_comments": true
}
}热点读端点 (由采集器写入 D1)。
/timeline 按 source_published_at 倒序 (跨源/单源时间流)/top 按 source_score 倒序 (跨源/单源榜单)按 source_published_at (原始发布时间) 倒序。
跨源或单源时间线, 传 source 过滤单源, 传 since 取"今日"或"近 N 小时"。
| source | string 数据源 (如 |
| lang | string Enum: "zh" "en" "ja" "other" 原始内容语言 |
| since | integer <int64> >= 0 仅返回 |
| page | integer >= 1 Default: 1 页码 |
| page_size | integer [ 1 .. 100 ] Default: 20 每页条数 (上限 100) |
{- "ok": true,
- "data": [
- {
- "id": 0,
- "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
- "slug": "string",
- "article_type": "hot",
- "title": "string",
- "subtitle": "string",
- "content": "string",
- "content_format": "markdown",
- "excerpt": "string",
- "category_id": 0,
- "status": "draft",
- "visibility": "public",
- "password_hash": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "published_at": "2019-08-24T14:15:22Z",
- "scheduled_at": "2019-08-24T14:15:22Z",
- "archived_at": "2019-08-24T14:15:22Z",
- "source": "string",
- "source_id": "string",
- "source_author": "string",
- "source_published_at": "2019-08-24T14:15:22Z",
- "source_score": 0,
- "source_metadata": { },
- "source_lang": "zh",
- "view_count": 0,
- "like_count": 0,
- "comment_count": 0,
- "word_count": 0,
- "reading_time": 0,
- "meta_title": "string",
- "meta_description": "string",
- "meta_keywords": "string",
- "locale": "zh-CN",
- "translation_group_id": "string",
- "is_featured": true,
- "is_pinned": true,
- "allow_comments": true
}
], - "meta": {
- "page": 0,
- "page_size": 0,
- "total": 0,
- "total_pages": 0,
- "q": "string",
- "updated": 0,
- "published": 0,
- "at": "2019-08-24T14:15:22Z"
}
}按 source_score 倒序 (无分数则按时间)。
| source | string 数据源 (如 |
| lang | string Enum: "zh" "en" "ja" "other" 原始内容语言 |
| page | integer >= 1 Default: 1 页码 |
| page_size | integer [ 1 .. 100 ] Default: 20 每页条数 (上限 100) |
{- "ok": true,
- "data": [
- {
- "id": 0,
- "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
- "slug": "string",
- "article_type": "hot",
- "title": "string",
- "subtitle": "string",
- "content": "string",
- "content_format": "markdown",
- "excerpt": "string",
- "category_id": 0,
- "status": "draft",
- "visibility": "public",
- "password_hash": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "published_at": "2019-08-24T14:15:22Z",
- "scheduled_at": "2019-08-24T14:15:22Z",
- "archived_at": "2019-08-24T14:15:22Z",
- "source": "string",
- "source_id": "string",
- "source_author": "string",
- "source_published_at": "2019-08-24T14:15:22Z",
- "source_score": 0,
- "source_metadata": { },
- "source_lang": "zh",
- "view_count": 0,
- "like_count": 0,
- "comment_count": 0,
- "word_count": 0,
- "reading_time": 0,
- "meta_title": "string",
- "meta_description": "string",
- "meta_keywords": "string",
- "locale": "zh-CN",
- "translation_group_id": "string",
- "is_featured": true,
- "is_pinned": true,
- "allow_comments": true
}
], - "meta": {
- "page": 0,
- "page_size": 0,
- "total": 0,
- "total_pages": 0,
- "q": "string",
- "updated": 0,
- "published": 0,
- "at": "2019-08-24T14:15:22Z"
}
}{- "ok": true,
- "data": [
- {
- "id": 0,
- "parent_id": 0,
- "name": "string",
- "slug": "string",
- "description": "string",
- "sort_order": 0,
- "article_count": 0,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
]
}| name required | string [ 1 .. 100 ] characters |
| slug | string <= 100 characters 缺省自动生成 |
| parent_id | integer >= 1 |
| description | string <= 500 characters |
| cover_image | string <uri> |
| sort_order | integer Default: 0 |
{- "name": "string",
- "slug": "string",
- "parent_id": 1,
- "description": "string",
- "sort_order": 0
}{- "ok": true,
- "data": {
- "id": 0,
- "parent_id": 0,
- "name": "string",
- "slug": "string",
- "description": "string",
- "sort_order": 0,
- "article_count": 0,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}{- "ok": true,
- "data": {
- "id": 0,
- "parent_id": 0,
- "name": "string",
- "slug": "string",
- "description": "string",
- "sort_order": 0,
- "article_count": 0,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}| id required | integer >= 1 |
| name required | string [ 1 .. 100 ] characters |
| slug | string <= 100 characters 缺省自动生成 |
| parent_id | integer >= 1 |
| description | string <= 500 characters |
| cover_image | string <uri> |
| sort_order | integer Default: 0 |
{- "name": "string",
- "slug": "string",
- "parent_id": 1,
- "description": "string",
- "sort_order": 0
}{- "ok": true,
- "data": {
- "id": 0,
- "parent_id": 0,
- "name": "string",
- "slug": "string",
- "description": "string",
- "sort_order": 0,
- "article_count": 0,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}| name required | string [ 1 .. 50 ] characters |
| slug | string <= 50 characters |
| description | string <= 500 characters |
{- "name": "string",
- "slug": "string",
- "description": "string"
}{- "ok": true,
- "data": {
- "id": 0,
- "name": "string",
- "slug": "string",
- "description": "string",
- "article_count": 0,
- "created_at": "2019-08-24T14:15:22Z"
}
}| id required | integer >= 1 |
| name required | string [ 1 .. 50 ] characters |
| slug | string <= 50 characters |
| description | string <= 500 characters |
{- "name": "string",
- "slug": "string",
- "description": "string"
}{- "ok": true,
- "data": {
- "id": 0,
- "name": "string",
- "slug": "string",
- "description": "string",
- "article_count": 0,
- "created_at": "2019-08-24T14:15:22Z"
}
}中文友好的 trigram 分词搜索。
查询语法:
关键词 — 子串匹配关键* — 前缀匹配关键 OR 词 — OR 关系"关键 词" — NEAR 邻近| q required | string [ 1 .. 200 ] characters |
| type | string Enum: "hot" "knowledge" 文章类型 |
| status | string Enum: "draft" "scheduled" "published" "archived" 状态 |
| page | integer >= 1 Default: 1 页码 |
| page_size | integer [ 1 .. 100 ] Default: 20 每页条数 (上限 100) |
{- "ok": true,
- "data": [
- {
- "id": 0,
- "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
- "slug": "string",
- "article_type": "hot",
- "title": "string",
- "subtitle": "string",
- "content": "string",
- "content_format": "markdown",
- "excerpt": "string",
- "category_id": 0,
- "status": "draft",
- "visibility": "public",
- "password_hash": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "published_at": "2019-08-24T14:15:22Z",
- "scheduled_at": "2019-08-24T14:15:22Z",
- "archived_at": "2019-08-24T14:15:22Z",
- "source": "string",
- "source_id": "string",
- "source_author": "string",
- "source_published_at": "2019-08-24T14:15:22Z",
- "source_score": 0,
- "source_metadata": { },
- "source_lang": "zh",
- "view_count": 0,
- "like_count": 0,
- "comment_count": 0,
- "word_count": 0,
- "reading_time": 0,
- "meta_title": "string",
- "meta_description": "string",
- "meta_keywords": "string",
- "locale": "zh-CN",
- "translation_group_id": "string",
- "is_featured": true,
- "is_pinned": true,
- "allow_comments": true
}
], - "meta": {
- "page": 0,
- "page_size": 0,
- "total": 0,
- "total_pages": 0,
- "q": "string",
- "updated": 0,
- "published": 0,
- "at": "2019-08-24T14:15:22Z"
}
}