认证
所有 API 请求需要在 Header 中携带 API Key:
获取 Access Token
通过邮箱密码登录,获取短期 JWT Token(有效期 7 天)
POST
/auth/login
{
"email": "user@example.com",
"password": "your_password"
}
注册账号
创建新账号
POST
/auth/register
{
"email": "user@example.com",
"password": "your_password"
}
笔记
创建笔记
POST
/notes
| 参数 | 类型 | 说明 |
|---|---|---|
| title | string | 笔记标题,必填 |
| content | string | Markdown 正文内容,必填 |
| tags | string[] | 标签数组,可选 |
| visibility | string | private / shared,默认 private |
{
"title": "FRP 内网穿透配置笔记",
"content": "## 服务器端配置\n\nbind_port = 7000",
"tags": ["frp", "vps"],
"visibility": "private"
}
搜索笔记
GET
/notes/search?q=&tags=&limit=
{
"results": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"title": "FRP 内网穿透配置笔记",
"snippet": "...服务器配置在 /etc/frp...",
"tags": ["frp", "vps"],
"score": 0.95
}
],
"total": 1,
"took_ms": 12
}
更新笔记
PUT
/notes/{id}
支持版本号乐观锁,传入 version 防止并发覆盖冲突
删除笔记
DELETE
/notes/{id}
AI 专用接口
专为 AI 模型设计的接口,返回结构化 JSON,适合在 System Prompt 中调用
AI 检索笔记
GET
/ai/search?q=&tags=&limit=&match_all=
模糊检索,返回高亮 snippet,支持标签过滤和多关键词 AND 匹配
AI 批量写入
POST
/ai/ingest
AI 从对话中提取关键信息批量写入笔记,支持 auto_tag 自动打标签
{
"title": "用户配置了 FRP 内网穿透",
"content": "用户使用阿里云轻量服务器...",
"tags": ["frp", "阿里云"],
"auto_tag": true
}
Hermes Skill
为 AI 助手(Hermes/Claude Code)准备的 skill,直接加载即可调用 iainote 所有接口。支持笔记读写、标签管理、AI检索。
安装方法
在支持 Hermes Skill 的 AI 助手中,输入以下命令安装:
/skills install iainote
或手动安装:
git clone https://github.com/i3xai/iainote-skills.git ~/.hermes/skills/iainote
配置 API Key
安装后告诉 AI 助手你的 API Key(注册后从 /auth/keys 获取),AI 会自动使用 Bearer Token 鉴权。
在 System Prompt 中使用
将以下内容加入 AI 的 System Prompt,实现对话中的持久记忆:
你有一个云端笔记系统(iainote)。
写入笔记(当用户提供重要信息时):
curl -X POST "https://iainote.iaiaiai.cc/api/v1/ai/ingest" \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-H "Content-Type: application/json" \
-d '{"title":"<标题>","content":"<内容>","tags":["tag1"]}'
检索笔记(当需要回忆之前的信息时):
curl -X GET "https://iainote.iaiaiai.cc/api/v1/ai/search?q=<关键词>" \
-H "Authorization: Bearer <YOUR_TOKEN>"
注意:仅在用户明确表示要记忆、或需要引用之前讨论内容时才调用。
Key 管理
合并 Key 数据
POST
/keys/{id}/merge
将指定 Key 的所有笔记迁移合并到当前 Key,数据源 Key 清空
迁移 Key 数据
POST
/keys/{id}/transfer
将指定 Key 的所有笔记转移到另一个 Key