</> Developer API

把你的生活档案接入自己的工具。

Pro 会员可以创建可撤销的 API token,通过 HTTPS API 或 Presias CLI 写入新记录,并按日期、时间阶段、内容类型和关键词获取自己的记录数据。

打开 Dashboardnpm install -g presias-cli && presias login
01

快速开始

打开右上角头像,进入 Dashboard,在 Development API 中创建 token。token 只会显示一次,请立即保存。

curl -H "Authorization: Bearer presias_live_..." \
  "https://presias.com/api/v1/moments?date=2026-08-02"
curl -X POST "https://presias.com/api/v1/moments" \
  -H "Authorization: Bearer presias_live_..." \
  -H "Content-Type: application/json" \
  -d '{"title":"Morning note","body":"Coffee and a quiet plan.","tags":["daily"]}'
02

认证

所有 API 请求都使用 Bearer token。token 与你的账户绑定,可随时在 Dashboard 中撤销。

Authorization: Bearer <api_token>
Content-Type: application/json
03

筛选规则

列表接口支持按日期、日期区间、时间阶段、关键词、标签和媒体类型筛选。写入接口支持标题、正文、时间、心情、地点、隐私状态、标签和收藏状态。

dateYYYY-MM-DD
from / toInclusive date range
periodtoday, yesterday, week, month, quarter, year
kindtext, photo, voice, video, location
qKeyword search
04

接口

GET/api/v1/moments
POST/api/v1/moments
GET/api/v1/account
GET/api/v1/media/:id/url
GET/api/v1/whoami
POST/api/tokens
DELETE/api/tokens/:id
05

CLI

CLI 是独立的 npm 包。它支持浏览器登录、token 保存、记录写入、日期查询和 today、week、month、quarter、year 等阶段查询。

presias moments --date 2026-08-02
presias moments --from 2026-08-01 --to 2026-08-31
presias moments --period week --anchor 2026-08-02
presias moments --kind photo --tag daily
presias create --title "Morning note" --body "Coffee and a quiet plan." --tags daily
presias export --out presias-export.json
06

会员权限

免费版包含 10GB 私有媒体存储额度。创建 token 和访问 Development API 只面向 Pro 会员开放,Pro 同时包含无限空间。非会员请求会返回 pro_membership_required。

{
  "error": "pro_membership_required"
}
返回数据

示例

{
  "moment": {
    "id": "rec_...",
    "occurred_at": "2026-08-02T21:18:00Z",
    "kind": "text",
    "body": "A quiet memory worth keeping.",
    "tags": ["daily"],
    "moment_media": []
  }
}

{
  "moments": [
    {
      "id": "rec_...",
      "occurred_at": "2026-08-02T21:18:00Z",
      "kind": "text",
      "body": "A quiet memory worth keeping.",
      "tags": ["daily"],
      "moment_media": []
    }
  ],
  "nextCursor": null
}