REST API 参考
所有端点都需要 Bearer 令牌认证。从控制台获取你的令牌。
# 基础 URL
https://api.agent-memo.ai
# 认证请求头
Authorization: Bearer YOUR_API_KEY
记忆
GET
/api/memories列出记忆,支持可选过滤条件
Query: ?topic=&type=&importance=&limit=&offset=
POST
/api/memories创建一条新记忆
{ "content": "...", "type": "project", "topic": "auth", "importance": 2, "tags": ["decision"] }GET
/api/memories/:id按 ID 获取单条记忆
PUT
/api/memories/:id更新已有记忆
{ "content": "updated content", "importance": 3 }DELETE
/api/memories/:id删除一条记忆
POST
/api/memories/search跨记忆语义搜索
{ "query": "database choice", "type": ["project"], "limit": 5 }GET
/api/memories/topics列出所有主题及记忆计数
POST
/api/memories/check-duplicate存储前检查语义重复
{ "content": "...", "threshold": 0.92 }知识图谱
POST
/api/kg/add添加实体关系(事实)
{ "subject": "auth-service", "predicate": "uses", "object": "JWT", "confidence": 0.95 }POST
/api/kg/query查询实体关系
{ "entity": "auth-service", "direction": "outgoing" }POST
/api/kg/invalidate使事实失效(标记为不再有效)
{ "factId": "..." }POST
/api/kg/timeline查看实体的事实时间线
{ "entity": "auth-service" }GET
/api/kg/stats知识图谱统计
响应格式
所有响应均为 JSON 格式。成功响应直接返回数据。错误响应返回包含 error 字段的 JSON 对象。
成功(200)
{
"id": "abc-123",
"content": "Use PostgreSQL",
"type": "project",
"topic": "database",
"importance": 3,
"created_at": "2026-04-08T..."
}错误(4xx/5xx)
{
"error": "Memory not found"
}速率限制
Beta 期间没有强制的速率限制。请合理使用——典型用量远低于每分钟 100 次请求。付费方案推出后将引入速率限制。