Pulse Analytics API
轻量产品埋点服务。API Key 一等公民,适合 Agent / 脚本 / 服务端。浏览器采集可用 public websiteId;查询与管理需 x-api-key。
鉴权
除 health / collect(浏览器模式)外,请求需带 API Key:
x-api-key: pk_live_… 或 Authorization: Bearer pk_live_… · 权限范围: collect / read / admin
https://pulse.nezus.cnSystem
2/v1/healthHealth check
无需鉴权。仅返回服务状态与版本。
响应示例
{
"ok": true,
"service": "pulse",
"version": "0.2.1",
"ts": 1710000000000
}cURL
curl -sS 'https://pulse.nezus.cn/v1/health'
/v1/openapi.jsonOpenAPI JSON
机器可读规范。人类请看 /docs。
cURL
curl -sS 'https://pulse.nezus.cn/v1/openapi.json'
Collect
2/v1/collect上报 pageview / event
浏览器可仅传 websiteId(public id)。可用 text/plain JSON 避免 CORS 预检。Agent 可带 collect scope 的 API Key。
请求体
{
"websiteId": "ws_xxx",
"type": "event",
"name": "quiz_complete",
"path": "/q/abstract-mbti/result",
"props": {
"quizId": "abstract-mbti",
"typeId": "INTJ"
},
"visitorId": "v_demo",
"sessionId": "s_demo"
}响应示例
{
"ok": true,
"accepted": 1,
"id": "ev_xxx"
}cURL
curl -sS -X POST 'https://pulse.nezus.cn/v1/collect' \
-H 'content-type: application/json' \
-d '{"websiteId":"ws_xxx","type":"event","name":"quiz_complete","path":"/q/abstract-mbti/result","props":{"quizId":"abstract-mbti","typeId":"INTJ"},"visitorId":"v_demo","sessionId":"s_demo"}'/v1/collect/batch批量上报
需要 collect scope。最多 100 条。
请求体
{
"items": [
{
"websiteId": "ws_xxx",
"type": "pageview",
"path": "/"
},
{
"websiteId": "ws_xxx",
"type": "event",
"name": "quiz_start",
"path": "/q/x"
}
]
}cURL
curl -sS -X POST 'https://pulse.nezus.cn/v1/collect/batch' \
-H 'x-api-key: $PULSE_KEY' \
-H 'content-type: application/json' \
-d '{"items":[{"websiteId":"ws_xxx","type":"pageview","path":"/"},{"websiteId":"ws_xxx","type":"event","name":"quiz_start","path":"/q/x"}]}'Websites
13/v1/websites列出站点
需要 read 或 admin。
cURL
curl -sS 'https://pulse.nezus.cn/v1/websites' \ -H 'x-api-key: $PULSE_KEY'
/v1/websites创建站点
需要全局 admin(未绑定站点的 key)。withKeys=true 时返回 collect/read 明文 key(仅一次)。
请求体
{
"name": "viral-quiz",
"domain": "quiz.nezus.cn",
"withKeys": true
}cURL
curl -sS -X POST 'https://pulse.nezus.cn/v1/websites' \
-H 'x-api-key: $PULSE_KEY' \
-H 'content-type: application/json' \
-d '{"name":"viral-quiz","domain":"quiz.nezus.cn","withKeys":true}'/v1/overview全部站点总览(管理台首页数据源)
一次请求返回 key 可见的所有站点:1d/7d/30d 窗口与环比、近 14 天 PV 迷你曲线、近 5 分钟在线访客。需要 read。
cURL
curl -sS 'https://pulse.nezus.cn/v1/overview' \ -H 'x-api-key: $PULSE_KEY'
/v1/websites/{id}/timeseries按日时间序列
query: days、startDay/endDay 或 startAt/endAt(毫秒;默认近 30 天,最长 366 天)。返回站点时区下补零的每日 pageviews / events / visitors。
参数
| 名称 | 位置 | 必填 | 类型 |
|---|---|---|---|
| id | path | 是 | string |
| startAt | query | 否 | integer |
| endAt | query | 否 | integer |
cURL
curl -sS 'https://pulse.nezus.cn/v1/websites/{id}/timeseries' \
-H 'x-api-key: $PULSE_KEY'/v1/websites/{id}/stats聚合统计
query: days(最近 N 个自然日)| startDay+endDay | startAt+endAt(毫秒)。默认近 7 天;支持全部筛选参数。
参数
| 名称 | 位置 | 必填 | 类型 |
|---|---|---|---|
| id | path | 是 | string |
| startAt | query | 否 | integer |
| endAt | query | 否 | integer |
响应示例
{
"pageviews": 120,
"events": 40,
"visitors": 18,
"startAt": 0,
"endAt": 0
}cURL
curl -sS 'https://pulse.nezus.cn/v1/websites/{id}/stats' \
-H 'x-api-key: $PULSE_KEY'/v1/websites/{id}/overview1d / 7d / 30d 总览 + 环比
返回 current / previous / change,用于管理台卡片。时间窗为站点时区的自然日(0 点起算),非滚动 24h:d1=今日 00:00→now 对比昨日全天;d7/d30 含今日在内的 N 个自然日。
参数
| 名称 | 位置 | 必填 | 类型 |
|---|---|---|---|
| id | path | 是 | string |
cURL
curl -sS 'https://pulse.nezus.cn/v1/websites/{id}/overview' \
-H 'x-api-key: $PULSE_KEY'/v1/websites/{id}/metrics维度拆解
type=path | event | referrer
参数
| 名称 | 位置 | 必填 | 类型 |
|---|---|---|---|
| id | path | 是 | string |
| type | query | 否 | path | event | referrer |
| startAt | query | 否 | integer |
| endAt | query | 否 | integer |
| limit | query | 否 | integer |
cURL
curl -sS 'https://pulse.nezus.cn/v1/websites/{id}/metrics' \
-H 'x-api-key: $PULSE_KEY'/v1/websites/{id}/events原始事件列表
参数
| 名称 | 位置 | 必填 | 类型 |
|---|---|---|---|
| id | path | 是 | string |
| name | query | 否 | string |
| pathPrefix | query | 否 | string |
| startAt | query | 否 | integer |
| endAt | query | 否 | integer |
| limit | query | 否 | integer |
cURL
curl -sS 'https://pulse.nezus.cn/v1/websites/{id}/events' \
-H 'x-api-key: $PULSE_KEY'/v1/websites/{id}/interest社交证明 interest
pathPrefix 或 eventName + days(默认 7)。
参数
| 名称 | 位置 | 必填 | 类型 |
|---|---|---|---|
| id | path | 是 | string |
| pathPrefix | query | 否 | string |
| eventName | query | 否 | string |
| days | query | 否 | integer |
cURL
curl -sS 'https://pulse.nezus.cn/v1/websites/{id}/interest' \
-H 'x-api-key: $PULSE_KEY'/v1/websites/{id}站点详情
参数
| 名称 | 位置 | 必填 | 类型 |
|---|---|---|---|
| id | path | 是 | string |
cURL
curl -sS 'https://pulse.nezus.cn/v1/websites/{id}' \
-H 'x-api-key: $PULSE_KEY'/v1/websites/{id}修改站点设置(admin)
name / domain / timezone(IANA,null=服务器时区)/ retentionDays(0=永久,null=服务器默认)。修改时区会按新时区重建全部历史聚合。
参数
| 名称 | 位置 | 必填 | 类型 |
|---|---|---|---|
| id | path | 是 | string |
请求体
{
"timezone": "Asia/Shanghai",
"retentionDays": 365
}cURL
curl -sS -X PATCH 'https://pulse.nezus.cn/v1/websites/{id}' \
-H 'x-api-key: $PULSE_KEY' \
-H 'content-type: application/json' \
-d '{"timezone":"Asia/Shanghai","retentionDays":365}'/v1/websites/{id}永久删除站点(全局 admin)
连同全部事件、汇总、目标、漏斗与密钥一起删除,不可恢复。
参数
| 名称 | 位置 | 必填 | 类型 |
|---|---|---|---|
| id | path | 是 | string |
cURL
curl -sS -X DELETE 'https://pulse.nezus.cn/v1/websites/{id}' \
-H 'x-api-key: $PULSE_KEY'/v1/websites/{id}/prune立即清理明细事件(admin)
删除早于 days 天的原始事件与访客明细;每日汇总保留。缺省使用站点保留天数(或 PULSE_RETENTION_DAYS)。
参数
| 名称 | 位置 | 必填 | 类型 |
|---|---|---|---|
| id | path | 是 | string |
请求体
{
"days": 365
}cURL
curl -sS -X POST 'https://pulse.nezus.cn/v1/websites/{id}/prune' \
-H 'x-api-key: $PULSE_KEY' \
-H 'content-type: application/json' \
-d '{"days":365}'Keys
3/v1/websites/{id}/keys列出 Key(仅 prefix)
参数
| 名称 | 位置 | 必填 | 类型 |
|---|---|---|---|
| id | path | 是 | string |
cURL
curl -sS 'https://pulse.nezus.cn/v1/websites/{id}/keys' \
-H 'x-api-key: $PULSE_KEY'/v1/websites/{id}/keys创建 Key
明文 key 仅在响应中返回一次。scopes: collect | read | admin
参数
| 名称 | 位置 | 必填 | 类型 |
|---|---|---|---|
| id | path | 是 | string |
请求体
{
"name": "agent-read",
"scopes": [
"read"
]
}cURL
curl -sS -X POST 'https://pulse.nezus.cn/v1/websites/{id}/keys' \
-H 'x-api-key: $PULSE_KEY' \
-H 'content-type: application/json' \
-d '{"name":"agent-read","scopes":["read"]}'/v1/keys/{id}吊销 Key
参数
| 名称 | 位置 | 必填 | 类型 |
|---|---|---|---|
| id | path | 是 | string |
cURL
curl -sS -X DELETE 'https://pulse.nezus.cn/v1/keys/{id}' \
-H 'x-api-key: $PULSE_KEY'Reports
8/v1/websites/{id}/report一次返回整页报表
总数、按日序列、可选对比(compare=prev|year)、页面/事件/来源/渠道排行与目标转化。所有筛选同时作用于每一部分。
参数
| 名称 | 位置 | 必填 | 类型 |
|---|---|---|---|
| id | path | 是 | string |
| compare | query | 否 | prev | year |
| days | query | 否 | integer |
| startDay | query | 否 | string |
| endDay | query | 否 | string |
| path | query | 否 | string |
| referrer | query | 否 | string |
| channel | query | 否 | direct | organic_search | social | referral | email | paid | campaign |
| utm_source | query | 否 | string |
| utm_medium | query | 否 | string |
| utm_campaign | query | 否 | string |
| country | query | 否 | string |
| browser | query | 否 | string |
| os | query | 否 | string |
| device | query | 否 | desktop | mobile | tablet |
| language | query | 否 | string |
| event | query | 否 | string |
cURL
curl -sS 'https://pulse.nezus.cn/v1/websites/{id}/report' \
-H 'x-api-key: $PULSE_KEY'/v1/websites/{id}/breakdown某一维度的排行
by = path | event | referrer | channel | utm_source | utm_medium | utm_campaign | country | browser | os | device | language。维度自身的筛选会被忽略。
参数
| 名称 | 位置 | 必填 | 类型 |
|---|---|---|---|
| id | path | 是 | string |
| by | query | 是 | string |
| limit | query | 否 | integer |
| days | query | 否 | integer |
| startDay | query | 否 | string |
| endDay | query | 否 | string |
| path | query | 否 | string |
| referrer | query | 否 | string |
| channel | query | 否 | direct | organic_search | social | referral | email | paid | campaign |
| utm_source | query | 否 | string |
| utm_medium | query | 否 | string |
| utm_campaign | query | 否 | string |
| country | query | 否 | string |
| browser | query | 否 | string |
| os | query | 否 | string |
| device | query | 否 | desktop | mobile | tablet |
| language | query | 否 | string |
| event | query | 否 | string |
cURL
curl -sS 'https://pulse.nezus.cn/v1/websites/{id}/breakdown' \
-H 'x-api-key: $PULSE_KEY'/v1/websites/{id}/goals目标及转化率
参数
| 名称 | 位置 | 必填 | 类型 |
|---|---|---|---|
| id | path | 是 | string |
| days | query | 否 | integer |
cURL
curl -sS 'https://pulse.nezus.cn/v1/websites/{id}/goals' \
-H 'x-api-key: $PULSE_KEY'/v1/websites/{id}/goals创建目标(admin)
type=event:value 为事件名;type=path:value 以 / 开头,结尾 * 表示前缀。
参数
| 名称 | 位置 | 必填 | 类型 |
|---|---|---|---|
| id | path | 是 | string |
请求体
{
"name": "Signup",
"type": "event",
"value": "signup"
}cURL
curl -sS -X POST 'https://pulse.nezus.cn/v1/websites/{id}/goals' \
-H 'x-api-key: $PULSE_KEY' \
-H 'content-type: application/json' \
-d '{"name":"Signup","type":"event","value":"signup"}'/v1/websites/{id}/goals/{goalId}删除目标(admin)
参数
| 名称 | 位置 | 必填 | 类型 |
|---|---|---|---|
| id | path | 是 | string |
| goalId | path | 是 | string |
cURL
curl -sS -X DELETE 'https://pulse.nezus.cn/v1/websites/{id}/goals/{goalId}' \
-H 'x-api-key: $PULSE_KEY'/v1/websites/{id}/funnels漏斗及各步骤访客数
每一步必须在上一步之后 windowMinutes 分钟内完成;按访客计。
参数
| 名称 | 位置 | 必填 | 类型 |
|---|---|---|---|
| id | path | 是 | string |
| days | query | 否 | integer |
cURL
curl -sS 'https://pulse.nezus.cn/v1/websites/{id}/funnels' \
-H 'x-api-key: $PULSE_KEY'/v1/websites/{id}/funnels创建漏斗(admin)
参数
| 名称 | 位置 | 必填 | 类型 |
|---|---|---|---|
| id | path | 是 | string |
请求体
{
"name": "Landing → Signup",
"steps": [
{
"type": "path",
"value": "/lp"
},
{
"type": "event",
"value": "signup"
}
],
"windowMinutes": 1440
}cURL
curl -sS -X POST 'https://pulse.nezus.cn/v1/websites/{id}/funnels' \
-H 'x-api-key: $PULSE_KEY' \
-H 'content-type: application/json' \
-d '{"name":"Landing → Signup","steps":[{"type":"path","value":"/lp"},{"type":"event","value":"signup"}],"windowMinutes":1440}'/v1/websites/{id}/funnels/{funnelId}删除漏斗(admin)
参数
| 名称 | 位置 | 必填 | 类型 |
|---|---|---|---|
| id | path | 是 | string |
| funnelId | path | 是 | string |
cURL
curl -sS -X DELETE 'https://pulse.nezus.cn/v1/websites/{id}/funnels/{funnelId}' \
-H 'x-api-key: $PULSE_KEY'Share
3/v1/websites/{id}/share创建/重置只读分享链接(admin)
参数
| 名称 | 位置 | 必填 | 类型 |
|---|---|---|---|
| id | path | 是 | string |
响应示例
{
"shareId": "k3j…",
"path": "/share/k3j…"
}cURL
curl -sS -X POST 'https://pulse.nezus.cn/v1/websites/{id}/share' \
-H 'x-api-key: $PULSE_KEY'/v1/websites/{id}/share停止分享(admin)
参数
| 名称 | 位置 | 必填 | 类型 |
|---|---|---|---|
| id | path | 是 | string |
cURL
curl -sS -X DELETE 'https://pulse.nezus.cn/v1/websites/{id}/share' \
-H 'x-api-key: $PULSE_KEY'/v1/share/{shareId}/report公开只读报表
无需 key,凭分享链接 token 访问;参数同 /v1/websites/{id}/report,仅返回站点名称、域名与时区。另有 /breakdown、/funnels。
参数
| 名称 | 位置 | 必填 | 类型 |
|---|---|---|---|
| shareId | path | 是 | string |
cURL
curl -sS 'https://pulse.nezus.cn/v1/share/{shareId}/report'