AccountManager 启动并解锁后,会在本机开启一个轻量 HTTP API,用来给脚本或其它本地工具读取、写入账号数据。
- 地址:
http://127.0.0.1:17878 - 版本前缀:
/api/v1 - 监听范围:只监听
127.0.0.1,不对外网开放 - 启动时机:软件解锁后自动启动
- API 开关:可在
更多 → API中开启或关闭 - 界面锁定后:如果 API 开关仍开启,API 继续可用
- 退出后:API 不可用
- 数据权限:API 读写的是当前已解锁数据库
除健康检查外,其它接口都需要 Token。
Token 需要在软件内创建:
更多 → API → 新建
查看、复制、新建、删除 Token 都需要输入主密码确认。
Token 文件位置:
- 绿色版:
软件目录\data\api-token.txt - 安装版:
%APPDATA%\AccountManager\api-token.txt
创建 Token 后,请求头二选一:
Authorization: Bearer am_xxx或:
X-AccountManager-Token: am_xxxPowerShell 示例:
$token = (Get-Content ".\data\api-token.txt" -Raw).Trim()
$headers = @{ Authorization = "Bearer $token" }
Invoke-RestMethod "http://127.0.0.1:17878/api/v1/accounts" -Headers $headers删除 Token 后,除健康检查外的接口都会返回未授权;重新新建 Token 后恢复可用。
成功:
{
"ok": true,
"data": {}
}失败:
{
"ok": false,
"error": "错误原因"
}常见状态码:
200:成功201:已创建400:请求参数或 JSON 错误401:Token 错误或缺失404:账号或接口不存在423:软件未解锁
不需要 Token。
GET /api/v1/health响应:
{
"ok": true,
"data": {
"name": "AccountManager",
"api": "v1",
"unlocked": true,
"baseUrl": "http://127.0.0.1:17878"
}
}GET /api/v1/accounts?query=&category=&tag=&includeSecrets=false参数:
query:搜索关键词,支持大小写不敏感和部分包含匹配category:分类过滤tag:标签过滤includeSecrets:是否返回password和twoFa,默认不返回
示例:
Invoke-RestMethod "http://127.0.0.1:17878/api/v1/accounts?query=outlook&tag=JP&includeSecrets=true" -Headers $headersGET /api/v1/accounts/{id}?includeSecrets=true示例:
Invoke-RestMethod "http://127.0.0.1:17878/api/v1/accounts/1?includeSecrets=true" -Headers $headersPOST /api/v1/accounts
Content-Type: application/json请求:
{
"email": "WillisBrandy7878@outlook.com",
"password": "oq4#ZI1GGHGfUF",
"twoFa": "KJNR5D5MUWMXKDLD66NJXZ5R2RAYWEE4",
"category": "API",
"tags": "JP",
"remark": ""
}PowerShell:
$body = @{
email = "WillisBrandy7878@outlook.com"
password = "oq4#ZI1GGHGfUF"
twoFa = "KJNR5D5MUWMXKDLD66NJXZ5R2RAYWEE4"
category = "API"
tags = "JP"
remark = ""
} | ConvertTo-Json
Invoke-RestMethod "http://127.0.0.1:17878/api/v1/accounts" -Method Post -Headers $headers -ContentType "application/json" -Body $bodyPATCH /api/v1/accounts/{id}
Content-Type: application/json只传需要修改的字段。传空字符串表示清空;不传表示保持原值。
请求:
{
"category": "API",
"tags": "JP, plus",
"remark": "已更新"
}DELETE /api/v1/accounts/{id}示例:
Invoke-RestMethod "http://127.0.0.1:17878/api/v1/accounts/1" -Method Delete -Headers $headersPOST /api/v1/import
Content-Type: application/json请求:
{
"category": "API",
"tags": "JP",
"duplicateMode": "skip",
"text": "WillisBrandy7878@outlook.com--oq4#ZI1GGHGfUF--KJNR5D5MUWMXKDLD66NJXZ5R2RAYWEE4"
}duplicateMode 可选:
skip:重复邮箱跳过,默认overwrite:重复邮箱覆盖keepBoth:重复邮箱也保留
响应:
{
"ok": true,
"data": {
"totalLines": 100,
"parsed": 100,
"inserted": 98,
"updated": 0,
"skippedDuplicates": 2,
"errors": []
}
}账号对象:
{
"id": 1,
"email": "WillisBrandy7878@outlook.com",
"password": "includeSecrets=true 时返回",
"twoFa": "includeSecrets=true 时返回",
"category": "API",
"tags": "JP",
"remark": "",
"matchField": "邮箱",
"matchValue": "WillisBrandy7878@outlook.com",
"createdAt": "2026-05-02T05:20:00.0000000+08:00",
"updatedAt": "2026-05-02T05:20:00.0000000+08:00"
}注意:
twoFa返回的是 2FA 密钥,不是 6 位动态验证码。- 列表接口默认不返回
password和twoFa,需要显式加includeSecrets=true。 - API 写入后,软件界面会自动刷新当前列表。