Unified AI Gateway

开发者接口文档

面向前端、客户端和第三方调用方。本文档按业务 TAB 分组,包含参数字段、字段解释、请求示例、 返回 JSON 示例和返回字段说明。自动生成的 Swagger 仍保留在 /docs

公共调用规则

Base URL

https://ai.gateway.uahpet.com

本地开发常用:http://127.0.0.1:18000

鉴权

Authorization: Bearer uah_xxx

GET /health/demo/api-docs 外,业务接口都需要 API Key。

异步任务

图片/视频生成接口先返回 task_id。客户端应按 poll_after_seconds 等待后再查询,避免触发 429。

统一错误 JSON

身份字段规则:所有业务接口调用时都不需要传入 user_idpet_id。服务端会使用统一临时 ID,或在选择 identity_asset_id 后自动从身份资源推导;返回 JSON 中出现的 user_id/pet_id 仅用于内部追踪和兼容展示。

{
  "error": {
    "code": "invalid_request",
    "message": "Request validation failed.",
    "request_id": "req_xxx"
  }
}
错误码HTTP说明
unauthorized401缺少 API Key 或 Key 无效。
forbidden403Key 没有访问该接口、模型或图片/视频生成权限。
invalid_request422字段缺失、类型错误、枚举值错误、上传格式错误。
not_found404任务、图片、日记或身份资源不存在。
rate_limit_exceeded429请求过快或超出当前 Key 限流。
provider_error502上游模型服务失败。

基础接口

GET /health

服务健康检查。无需 API Key。

请求参数

无。

请求示例

curl https://ai.gateway.uahpet.com/health

生成响应示例

{
  "status": "ok",
  "service": "uah-ai-gateway",
  "version": "0.3.0"
}
字段类型说明
statusstring服务状态,正常为 ok
servicestring服务名。
versionstring服务版本。

GET /v1/models

查询当前 API Key 可见模型别名。

请求参数

字段位置必填说明
AuthorizationHeaderBearer uah_xxx

请求示例

curl -H "Authorization: Bearer uah_xxx" \
  https://ai.gateway.uahpet.com/v1/models

返回 JSON

{
  "data": [
    { "id": "uah-general", "type": "text" },
    { "id": "uah-avatar", "type": "image" }
  ]
}
字段类型说明
dataarray模型列表。
data[].idstring网关模型别名,调用其他接口时使用。
data[].typestring模型类型,例如 textimagevideo

姿态图生成

POST /v1/pet-avatar/generate

上传宠物照片或提供图片 URL,创建四姿态头像生成任务。兼容路径:/v1/pet-avatars/generate

请求参数

字段位置类型必填默认/枚举说明
AuthorizationHeaderstring-Bearer API Key。需要 uah-avatar 且允许图片生成;当前实现也要求 Key 具备 uah-animation 视频能力,用于后续身份资源联动。
source_imageForm filefile二选一-宠物原图文件。与 source_image_url 只能传一个,图片需满足服务端配置的最小尺寸和最大体积限制。
source_image_urlForm/JSONstring二选一HTTP/HTTPS宠物原图 URL。后端会下载图片并按上传文件相同规则校验和保存到 COS;兼容复制出的 Markdown 链接格式 [url](url)
speciesForm/JSONstringdog / cat宠物物种,用于提示词、场景和后续日记配图库资源锁定。
pet_nameForm/JSONstring-宠物名,长度 1-128。
breedForm/JSONstring-品种补充,长度 1-128。
poseForm/JSONstringall单姿态选择:alllyingsittingwalkingrunning
posesForm repeat/JSONstring[]-多姿态选择;Form 可重复传字段,JSON 传字符串数组。支持 lyingsittingwalkingrunning,不能重复。传了 poses 时优先于 pose
localeForm/JSONstringen-US语言环境:en-USzh-CN

姿态图请求/响应枚举取值

字段枚举值说明
speciesdog / cat宠物物种枚举;请求和身份资源返回均使用该取值。
items[].speciesdog / cat请求强校验;身份资源返回同样取值。
poseall / lying / sitting / walking / running请求强校验;all 表示全部四姿态。
poses[]lying / sitting / walking / running单个姿态枚举。
imageslying / sitting / walking / running单个姿态枚举。
items[].poseslying / sitting / walking / running单个姿态枚举。
localeen-US / zh-CN请求强校验;默认 en-US
statuspending / processing / success / partial_success / failed头像任务状态。
images.*.statuspending / processing / success / failed单姿态生成状态。
identity.statussuccess / partial_success / animation_pending / failed身份资源状态;animation_pending 表示姿态图可用但动图仍未完成。
items[].statusstring|null身份资源状态,例如 successpartial_successanimation_pendingfailed
items[].poses.*.animation_statuspending / processing / success / partial_success / failed / delete_failed关联动图任务状态,可能为空。

请求示例

curl -X POST "https://ai.gateway.uahpet.com/v1/pet-avatar/generate" \
  -H "Authorization: Bearer uah_xxx" \
  -F "source_image=@pet_image.png" \
  -F "species=dog" \
  -F "poses=sitting" \
  -F "poses=running"

请求示例:图片 URL

curl -X POST "https://ai.gateway.uahpet.com/v1/pet-avatar/generate" \
  -H "Authorization: Bearer uah_xxx" \
  -F "source_image_url=https://example.com/pet.png" \
  -F "species=dog" \
  -F "poses=all"

请求示例:JSON 图片 URL

curl -X POST "https://ai.gateway.uahpet.com/v1/pet-avatar/generate" \
  -H "Authorization: Bearer uah_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "pet_name": "yu",
    "species": "cat",
    "pose": "sitting",
    "source_image_url": "https://example.com/pet.png",
    "locale": "en-US",
    "breed": "Poodle"
  }'

返回 JSON

{
  "request_id": "req_xxx",
  "task_id": "avatar_task_xxx",
  "status": "pending",
  "message": "Avatar generation task created.",
  "poll_after_seconds": 8
}
字段类型说明
request_idstring请求 ID。
task_idstring头像任务 ID,后续查询任务使用。
statusstring初始通常是 pending
messagestring任务创建说明。
poll_after_secondsinteger|null建议等待多少秒后查询任务。

GET /v1/pet-avatar/tasks/{task_id}

查询头像任务。兼容路径:/v1/pet-avatars/tasks/{task_id}

请求参数

字段位置类型必填说明
AuthorizationHeaderstringBearer API Key,需要 uah-avatar 和图片权限。
task_idPathstring创建任务时返回的头像任务 ID。

请求示例

curl -H "Authorization: Bearer uah_xxx" \
  "https://ai.gateway.uahpet.com/v1/pet-avatar/tasks/avatar_task_xxx"

返回 JSON

{
  "request_id": "req_xxx",
  "task_id": "avatar_task_xxx",
  "status": "success",
  "user_id": "temporary",
  "pet_id": "temporary",
  "provider": "apiyi",
  "model": "gpt-image-2-all",
  "source_cos_key": "ai-gateway/avatar/source/...",
  "source_url": "https://...",
  "identity_asset_id": "identity_xxx",
  "images": {
    "sitting": {
      "status": "success",
      "generated_cos_key": "ai-gateway/avatar/generated/...",
      "generated_url": "https://..."
    },
    "running": {
      "status": "failed",
      "error_code": "provider_error",
      "error_message": "Avatar generation failed."
    }
  }
}
字段类型说明
statusstring任务状态:pendingprocessingsuccesspartial_successfailed
source_urlstring原图可访问链接,可能是带有效期的签名 URL。
identity_asset_idstring|null头像成功后生成的宠物身份资源 ID。日记配图会用它。
imagesobject按姿态聚合的结果,key 为 lying/sitting/walking/running
images.*.generated_urlstring|null姿态图 URL,仅成功时返回。
images.*.error_codestring|null姿态生成失败时返回。
poll_after_secondsinteger|null任务未结束时返回,表示建议下次查询间隔。

GET /v1/pet-avatars

分页查询宠物身份资源。

请求参数

字段位置类型必填默认/限制说明
AuthorizationHeaderstring-Bearer API Key,需要 uah-avatar 和图片权限。
pageQueryinteger默认 1,最小 1当前页码。
page_sizeQueryinteger默认 20,1-100每页数量。

请求示例

curl -H "Authorization: Bearer uah_xxx" \
  "https://ai.gateway.uahpet.com/v1/pet-avatars?page=1&page_size=20"

返回 JSON

{
  "page": 1,
  "page_size": 20,
  "total": 1,
  "items": [
    {
      "identity_asset_id": "identity_xxx",
      "avatar_task_id": "avatar_task_xxx",
      "animation_task_id": "anim_task_xxx",
      "user_id": "temporary",
      "pet_id": "temporary",
      "species": "dog",
      "status": "ready",
      "source_url": "https://...",
      "poses": {
        "sitting": {
          "image_url": "https://...",
          "animation_status": "success",
          "webp_url": "https://...",
          "mp4_url": "https://..."
        }
      }
    }
  ]
}
字段类型说明
items[].identity_asset_idstring身份资源 ID。
items[].statusstring身份资源状态,例如 readyanimation_pending
items[].posesobject姿态资源,key 为姿态名。
items[].poses.*.image_urlstring姿态静态图 URL。
items[].poses.*.webp_urlstring|null关联动图 WebP URL,有动图任务成功时返回。

GET /v1/pet-avatars/{identity_asset_id}

查询单个身份资源详情。

请求参数

字段位置类型必填说明
identity_asset_idPathstring身份资源 ID。

请求示例

curl -H "Authorization: Bearer uah_xxx" \
  "https://ai.gateway.uahpet.com/v1/pet-avatars/identity_xxx"

返回 JSON

{
  "identity_asset_id": "identity_xxx",
  "avatar_task_id": "avatar_task_xxx",
  "animation_task_id": "anim_task_xxx",
  "user_id": "temporary",
  "pet_id": "temporary",
  "species": "dog",
  "status": "ready",
  "source_url": "https://...",
  "poses": {
    "sitting": {
      "image_url": "https://...",
      "animation_status": "success",
      "webp_url": "https://...",
      "mp4_url": "https://..."
    }
  }
}

字段含义与列表接口的 items[] 单项一致。

POST /v1/pet-avatars/feedback

Submit feedback for one or more generated pet-avatar images. Re-submitting a COS key updates its latest feedback.

Request example

{
  "feedbacks": [
    {"cos_key": "ai-gateway/avatars/generated/task-1/sitting.png", "liked": true, "selected": true},
    {"cos_key": "ai-gateway/avatars/generated/task-2/walking.png", "liked": false, "selected": false}
  ]
}
feedbacksarrayrequired1–100 image feedback records.
feedbacks[].cos_keystringrequiredAvatar-task generated COS key; unknown or duplicate keys are rejected.
feedbacks[].likedbooleanone requiredWhether the user likes the image.
feedbacks[].selectedbooleanone requiredWhether the user selected the image.

Provide liked, selected, or both. An omitted value does not overwrite an existing annotation.

Response example

{
  "result": {
    "code": 200,
    "message": "success",
    "request_id": "req_xxx"
  }
}

循环动图生成

POST /v1/pet-animation/generate

使用头像任务的姿态图生成 WebP/MP4 动图。

请求参数

字段位置类型必填默认/枚举说明
avatar_task_idBodystring1-128已完成或部分成功的头像任务 ID。
poseBodystringallalllyingsittingwalkingrunning

循环动图请求/响应枚举取值

字段枚举值说明
poseall / lying / sitting / walking / running请求强校验。
images keylying / sitting / walking / running单姿态枚举。
statuspending / processing / success / partial_success / failed / deleting / delete_failed动图任务状态。
images.*.statuspending / processing / success / failed单姿态动图状态。
output_formats[]webp / mp4当前输出格式。

请求示例

{
  "avatar_task_id": "avatar_task_xxx",
  "pose": "all"
}

返回 JSON

{
  "request_id": "req_xxx",
  "task_id": "anim_task_xxx",
  "status": "pending",
  "message": "Animation generation task created.",
  "poll_after_seconds": 15
}
字段类型说明
task_idstring动图任务 ID。
statusstring任务初始状态。
poll_after_secondsinteger建议查询间隔。

GET /v1/pet-animation/tasks/{task_id}

查询动图任务。

请求参数

字段位置类型必填说明
task_idPathstring动图任务 ID。

返回 JSON

{
  "request_id": "req_xxx",
  "task_id": "anim_task_xxx",
  "avatar_task_id": "avatar_task_xxx",
  "status": "success",
  "user_id": "temporary",
  "pet_id": "temporary",
  "provider": "openrouter",
  "model": "bytedance/seedance-2.0-fast",
  "duration_seconds": 4,
  "output_formats": ["webp", "mp4"],
  "images": {
    "sitting": {
      "status": "success",
      "mp4_cos_key": "ai-gateway/animation/generated/.../sitting/result.mp4",
      "mp4_url": "https://...",
      "webp_cos_key": "ai-gateway/animation/generated/.../sitting/result.webp",
      "webp_url": "https://...",
      "error_code": null,
      "error_message": null
    }
  }
}
字段类型说明
duration_secondsinteger生成视频时长。
output_formatsstring[]输出格式,当前为 webpmp4
images.*.webp_cos_keystring|nullWebP 动图 COS 对象 Key,仅成功时返回;可用于后端持久引用或重新签名。
images.*.webp_urlstring|nullWebP 动图 URL,可能是带有效期的签名 URL。
images.*.mp4_cos_keystring|nullMP4 视频 COS 对象 Key,仅成功时返回;可用于后端持久引用或重新签名。
images.*.mp4_urlstring|nullMP4 视频 URL。
images.*.error_codestring|null单姿态失败时返回错误码和错误说明。
images.*.error_messagestring|null单姿态失败时返回错误码和错误说明。

DELETE /v1/pet-animation/tasks/{task_id}

删除已完成、失败、部分成功或删除失败状态的动图任务和存储文件。

请求参数

字段位置类型必填说明
task_idPathstring动图任务 ID。

成功响应

204 No Content,无响应体。

日记配图生成

POST /v1/pet-diary-image-libraries/select

从已生成图库中按日期和事实选择当天最合适的配图。

请求参数

字段位置类型必填说明
diary_idBodystring|null关联日记 ID。
dateBodydate日记日期,格式 YYYY-MM-DD
facts.speciesBodystringdogcat
facts.seasonBodystring|null季节。
facts.weatherBodystring|null天气。
facts.locationBodystring|null地点。
facts.activityBodystring|null活动。
facts.moodBodystring|null心情。
facts.holidayBodystring|null节日。

请求示例

{
  "date": "2026-07-01",
  "facts": {
    "species": "dog",
    "season": "summer",
    "weather": "sunny",
    "activity": "walk",
    "mood": "happy"
  }
}

返回 JSON

{
  "selection_id": "diary_sel_xxx",
  "image_id": "diary_lib_img_xxx",
  "generated_cos_key": "ai-gateway/diary-images/generated/...",
  "scene_id": "outdoor_walk_spring",
  "image_url": "https://...",
  "match_reason": {
    "score": 12,
    "matched": ["season", "activity"]
  }
}

POST /v1/pet-diary-images/generate

创建日记配图任务。参考图支持三种来源:传 identity_asset_id 使用已生成身份资源,传 source_image_url 使用外部图片 URL,或传 cos_key 直接复用 COS 内已有图片。三者必须且只能传一个。

请求参数

字段位置类型必填说明
diary_idBodystring|null关联日记 ID。
identity_asset_idBodystring|null三选一宠物身份资源 ID。使用该模式时服务端自动按身份资源物种校验场景。
source_image_urlBodystring|null三选一HTTP/HTTPS 图片 URL。服务端会下载、校验尺寸和格式后保存到 COS,再创建任务。
cos_keyBodystring|null三选一已存在图片的 COS Object Key。仅接受 ai-gateway/ 前缀且对象必须存在;服务端直接复用该图片,不下载也不复制。
speciesBodystringURL/COS Key 模式必填宠物物种:dogcat。身份资源模式以身份资源物种为准。
scene_idsBodystring[]当前默认 V4.3 日记配图库场景 ID 数组。V3.0/V4.0/V4.1/V4.2 仍保留,可通过元数据接口 version 参数切换;单张生成也传数组,例如 ["indoor_curl_sleep"];多张生成传多个 ID。三种参考图来源都支持。场景目录从 /v1/app-metadata/diary-image-library-scenes 获取。
prompt_versionBodystring|null日记配图提示词版本。可传短写 V4.3/V4.2/V4.1/V4.0/V3.0,也可传完整版本号;不传使用默认 V4.3。
force_regenerateBodyboolean多场景图库生成时保留的参数,默认 false

请求示例:身份资源模式

{
  "identity_asset_id": "identity_xxx",
  "scene_ids": ["indoor_curl_sleep"],
  "prompt_version": "V4.3",
  "diary_id": "dia_xxx"
}

请求示例:图片 URL 模式

{
  "source_image_url": "https://example.com/pet.png",
  "species": "dog",
  "scene_ids": ["indoor_curl_sleep"],
  "diary_id": "dia_xxx"
}

请求示例:COS Key 模式

{
  "cos_key": "ai-gateway/avatar/generated/temporary/avatar_task_xxx/sitting.png",
  "species": "dog",
  "scene_ids": ["indoor_curl_sleep", "outdoor_walk_spring"],
  "prompt_version": "V4.3"
}

请求示例:多场景图库模式

{
  "identity_asset_id": "identity_xxx",
  "scene_ids": ["indoor_curl_sleep", "outdoor_walk_spring"],
  "force_regenerate": false
}

日记配图请求/响应枚举取值

字段枚举值说明
selected_poselying / sitting / walking / running后端强校验;由场景推荐姿态决定。
recommended_poselying / sitting / walking / running后端强校验;由场景推荐姿态决定。
scene.speciesall / dog / cat日记配图场景适用物种。
scene.categorycommon / federal_holiday / personal / species_day日记配图场景分类。
statuspending / processing / success / failed日记配图任务状态。

返回 JSON

{
  "request_id": "req_xxx",
  "task_id": "diary_image_xxx",
  "status": "pending",
  "selected_pose": "sitting",
  "poll_after_seconds": 2
}

返回 JSON:多场景图库模式

{
  "request_id": "req_xxx",
  "task_id": "diary_lib_xxx",
  "status": "pending",
  "profile": "dog",
  "total_count": 2,
  "poll_after_seconds": 2
}
字段类型说明
request_idstring请求 ID。
task_idstring日记配图任务 ID,用于查询任务结果。
statusstring初始通常为 pending
selected_posestring场景自动选择的参考姿态,枚举见上表。
poll_after_secondsnumber建议客户端等待多少秒后查询任务。

GET /v1/pet-diary-images/tasks/{task_id}

查询日记配图任务。

请求参数

字段位置类型必填说明
task_idPathstring日记配图任务 ID。

返回 JSON

{
  "task_id": "diary_image_xxx",
  "request_id": "req_xxx",
  "user_id": "temporary",
  "pet_id": "temporary",
  "diary_id": "dia_xxx",
  "identity_asset_id": null,
  "scene_id": "home_sofa",
  "selected_pose": "lying",
  "status": "success",
  "generated_cos_key": "ai-gateway/diary-images/generated/...",
  "image_id": "diary_img_xxx",
  "image_url": "https://..."
}
字段类型说明
task_idstring任务 ID 与请求追踪 ID。
request_idstring请求 ID。
user_idQuerystring|null1-128用户 ID;不传时使用临时默认用户。
pet_idQuerystring|null1-128宠物 ID;不传时不过滤宠物。
diary_idstring|null请求中传入的关联日记 ID。
identity_asset_idstring|null身份资源模式返回身份资源 ID;图片 URL 模式为 null
scene_idstring日记配图场景 ID。
selected_posestring自动选择的姿态。
generated_cos_keystring|nullCOS 对象 Key,生成成功后返回;与 image_url 指向同一张图。
statusstring任务状态,枚举见上表。
image_idstring|null生成成功后的图片 ID。
image_urlstring|null生成成功后的图片 URL,可能是带有效期的签名 URL。
error_codestring|null失败时返回的错误码;成功时为空。
error_messagestring|nullError message returned on failure.
poll_after_secondsnumber|null处理中任务的建议轮询间隔;终态通常不返回。

GET /v1/pet-diary-images 返回分页列表,GET /v1/pet-diary-images/{image_id} 按图片 ID 查询,单项结构同上。

AI洞察生成

POST /v1/ai-insights/generate

生成首页 AI 洞察卡片。

请求参数

字段位置类型必填说明
request_idstring请求 ID。
snapshotBodyobject首页数据快照。
snapshot.pet.petIdBodystring宠物 ID,用于调试和追踪。
snapshot.pet.petNameBodystring宠物昵称,文案会优先使用。
snapshot.pet.speciesBodystringdogcat
snapshot.pet.breedBodystring|nullNoBreed name.
snapshot.pet.breedTagsBodystring[]NoBreed tags.
snapshot.pet.bodySizeBodystring|nullNo体型枚举,建议与品种参考基线 body_size_class 对齐:toy=超小型、small=小型、medium=中型、large=大型、giant=超大型。
snapshot.pet.ageMonthsBodynumber|nullNoAge in months.
snapshot.pet.ageStageBodystring|nullNo生命阶段枚举,建议与品种参考基线幼年/成年/老年三档对齐:puppy=幼年、adult=成年、senior=老年;猫幼年同样传 puppy。
snapshot.pet.sexBodystring|nullNoSex.
snapshot.pet.isNeuteredBodyboolean|nullNoWhether the pet is neutered.
snapshot.pet.weightKgBodynumber|nullNoWeight in kg.
snapshot.pet.healthTagsBodystring[]健康标签。
snapshot.pet.activityGoalMinutesBodynumber|nullNoActivity minutes goal.
snapshot.pet.stepGoalBodynumber|nullNoStep goal.
snapshot.current.locationStatusBodystring|nullNoCurrent location status, such as known, unknown, or stale.
snapshot.current.placeTypeBodystring|nullNoCurrent place type, such as home or park.
snapshot.current.geofenceStatusBodystring|nullNoSafe-zone status.
snapshot.current.outsideSafeZoneDurationMinBodynumber|nullNoMinutes outside the safe zone.
snapshot.current.lostModeStatusBodystring|nullNoLost mode status.
snapshot.current.familyCompanionStatusBodystring|nullNoFamily companion status.
snapshot.current.connectionStatusBodystring|nullNoDevice connection status.
snapshot.current.offlineDurationMinBodynumber|nullNoOffline duration in minutes.
snapshot.current.wearingStatusBodystring|nullNoWearing status.
snapshot.current.notWearingDurationMinBodynumber|nullNoNot-wearing duration in minutes.
snapshot.current.batteryPctBodynumber|nullNoBattery percentage.
snapshot.current.chargingStatusBodystring|nullNoCharging status.
snapshot.current.currentActivityStateBodystring|nullNoCurrent activity state.
snapshot.current.currentPostureBodystring|nullNoCurrent posture.
snapshot.current.lastDeviceSyncAtBodydatetime最近设备同步时间。
snapshot.today.wearingMinutesTodayBodynumber|nullNoWearing minutes today.
snapshot.today.wearingCoveragePctTodayBodynumber|nullNoWearing coverage today.
snapshot.today.activeMinutesTodayBodynumber|nullNoActive minutes today.
snapshot.today.stepsTodayBodynumber|nullNoSteps today.
snapshot.today.lowIntensityMinutesTodayBodynumber|nullNoLow-intensity active minutes today.
snapshot.today.mediumIntensityMinutesTodayBodynumber|nullNoMedium-intensity active minutes today.
snapshot.today.highIntensityMinutesTodayBodynumber|nullNoHigh-intensity active minutes today.
snapshot.today.outdoorMinutesTodayBodynumber|nullNoOutdoor minutes today.
snapshot.today.walkSessionCountTodayBodynumber|nullNoWalk session count today.
snapshot.today.dayRestMinutesTodayBodynumber白天休息分钟数。
snapshot.today.barkCountTodayBodynumber|nullNoBark count today.
snapshot.today.barkDurationSecTodayBodynumber|nullNoBark duration today in seconds.
snapshot.today.barkPeakPeriodTodayBodystring|nullNoPeak barking period today.
snapshot.today.restingHrTodayBodynumber|nullNoResting heart rate today.
snapshot.today.restingRrTodayBodynumber|nullNoResting respiratory rate today.
snapshot.today.hrvRestingTodayBodynumber|nullNoResting HRV today.
snapshot.today.abnormalStillnessDurationMinTodayBodynumber异常静止时长。
snapshot.completedDaily.yesterday.wearingCoveragePctYesterdayBodynumber昨日佩戴覆盖率,0-1 小数或百分比口径需与业务约定保持一致。
snapshot.completedDaily.yesterday.activeMinutesYesterdayBodynumber昨日总活动分钟数。
snapshot.completedDaily.yesterday.stepsYesterdayBodynumber昨日步数。
snapshot.completedDaily.yesterday.highIntensityMinutesYesterdayBodynumber昨日高强度活动分钟数。
snapshot.completedDaily.yesterday.outdoorMinutesYesterdayBodynumber昨日户外活动分钟数。
snapshot.completedDaily.yesterday.walkSessionCountYesterdayBodynumber昨日散步次数。
snapshot.completedDaily.yesterday.dayRestMinutesYesterdayBodynumber昨日白天休息分钟数。
snapshot.completedDaily.yesterday.barkCountYesterdayBodynumber昨日叫声次数。
snapshot.completedDaily.yesterday.barkDurationSecYesterdayBodynumber昨日叫声总时长,单位秒。
snapshot.completedDaily.yesterday.barkPeakPeriodYesterdayBodystring昨日叫声高峰时段,例如 18:00-20:00 或业务枚举值。
snapshot.completedDaily.yesterday.restingHrYesterdayBodynumber昨日静息心率,单位 bpm。
snapshot.completedDaily.yesterday.restingRrYesterdayBodynumber昨日静息呼吸率,单位 breaths/min。
snapshot.completedDaily.yesterday.hrvRestingYesterdayBodynumber昨日静息 HRV。
snapshot.completedDaily.lastNight.wearingCoveragePctLastNightBodynumber昨晚佩戴覆盖率,0-1 小数或百分比口径需与业务约定保持一致。
snapshot.completedDaily.lastNight.sleepDurationLastNightBodynumber|nullNoLast night sleep duration in minutes.
snapshot.completedDaily.lastNight.wakeCountLastNightBodynumber|nullNoLast night wake count.
snapshot.completedDaily.lastNight.nightActivityMinutesLastNightBodynumber|nullNoNight activity minutes last night.
snapshot.completedDaily.lastNight.longestSleepBlockMinutesLastNightBodynumber|nullNoLongest continuous sleep block last night in minutes.
snapshot.completedDaily.lastNight.sleepFragmentationScoreLastNightBodynumber|nullNoSleep fragmentation score last night.
snapshot.completedDaily.lastNight.nightBarkCountLastNightBodynumber|nullNoNight bark count last night.
snapshot.completedDaily.lastNight.restingHrLastNightBodynumber|nullNoResting heart rate last night.
snapshot.completedDaily.lastNight.restingRrLastNightBodynumber|nullNoResting respiratory rate last night.
snapshot.completedDaily.lastNight.hrvRestingLastNightBodynumber|nullNoResting HRV last night.
snapshot.completedWeek.weekStartDateBodydate上周统计起始日期,建议 ISO 日期格式 YYYY-MM-DD
snapshot.completedWeek.weekEndDateBodydate上周统计结束日期,建议 ISO 日期格式 YYYY-MM-DD
snapshot.completedWeek.validDaysLastWeekBodynumber上周有效数据天数。
snapshot.completedWeek.wearingCoveragePctLastWeekBodynumber上周佩戴覆盖率,0-1 小数或百分比口径需与业务约定保持一致。
snapshot.completedWeek.activeMinutesLastWeekBodynumber上周总活动分钟数。
snapshot.completedWeek.activityGoalCompletionRateLastWeekBodynumber上周活动目标完成率。
snapshot.completedWeek.avgSleepDurationLastWeekBodynumber上周平均睡眠时长,单位分钟。
snapshot.completedWeek.avgRestingHrLastWeekBodynumber上周平均静息心率,单位 bpm。
snapshot.completedWeek.avgRestingRrLastWeekBodynumber上周平均静息呼吸率,单位 breaths/min。
snapshot.completedWeek.avgHrvRestingLastWeekBodynumber上周平均静息 HRV。
snapshot.completedWeek.barkCountLastWeekBodynumber上周叫声次数。
snapshot.completedMonth.monthStartDateBodydate上月统计起始日期,建议 ISO 日期格式 YYYY-MM-DD
snapshot.completedMonth.monthEndDateBodydate上月统计结束日期,建议 ISO 日期格式 YYYY-MM-DD
snapshot.completedMonth.validDaysLastMonthBodynumber上月有效数据天数。
snapshot.completedMonth.wearingCoveragePctLastMonthBodynumber上月佩戴覆盖率,0-1 小数或百分比口径需与业务约定保持一致。
snapshot.completedMonth.activeMinutesLastMonthBodynumber上月总活动分钟数。
snapshot.completedMonth.avgSleepDurationLastMonthBodynumber上月平均睡眠时长,单位分钟。
snapshot.completedMonth.avgRestingHrLastMonthBodynumber上月平均静息心率,单位 bpm。
snapshot.completedMonth.avgRestingRrLastMonthBodynumber上月平均静息呼吸率,单位 breaths/min。
snapshot.completedMonth.avgHrvRestingLastMonthBodynumber上月平均静息 HRV。
snapshot.completedMonth.barkCountLastMonthBodynumber上月叫声次数。
snapshot.rollingBaseline.baselineActiveMinutesBodyobjectNoRolling baseline for active minutes; recommended fields include valueRange, source, validDays, phase, and quality.
snapshot.rollingBaseline.baselineSleepDurationBodyobjectNoRolling baseline for sleep duration.
snapshot.rollingBaseline.baselineWakeCountBodyobjectNoRolling baseline for wake count.
snapshot.rollingBaseline.baselineRestingHrBodyobjectNoRolling baseline for resting heart rate.
snapshot.referenceBodyobject预留参考信息。
snapshot.context.weatherTodayBodyobject今日天气,常用字段:tempMinCtempMaxCcurrentTempCfeelsLikeChumidityPctconditionaqi
snapshot.context.timeOfDayBodystring|nullNoTime of day.
snapshot.context.seasonBodystring|nullNoSeason.
snapshot.context.weekdayTypeBodystring|nullNoWeekday, weekend, or holiday type.
snapshot.context.knownPlaceTypeBodystring|nullNoKnown place type.
snapshot.context.ownerNearbyBodyboolean|nullNoWhether the owner is nearby.
snapshot.quality.*Bodystring数据质量。常用键:wearingQualityTodaywearingQualityYesterdaywearingQualityLastNightlocationQualityconnectionQualityactivityQualitysleepQualityhrQualityrrQualityhrvQualitybarkQualitybaselineQualityweatherQualityprofileQuality。值为 GOODFAIRPOORMISSING
simulated_fieldsBodystring[]标记哪些字段是模拟值。
template_idBodystring|nullNoTemplate ID for testing or tracing.
template_versionBodystring|nullNoTemplate version for testing or tracing.

AI 洞察请求/响应枚举取值

字段枚举值约束说明
snapshot.pet.speciesdog / cat建议枚举;用于物种文案和后续业务分流。
snapshot.pet.bodySizetoy / small / medium / large / giant建议与品种参考基线 body_size_class 保持一致:toy=超小型、small=小型、medium=中型、large=大型、giant=超大型。
snapshot.pet.ageStagepuppy / adult / senior建议与基线幼年/成年/老年三档保持一致,猫幼年同样传 puppy
snapshot.pet.sexmale / female / unknown建议枚举。
snapshot.current.locationStatusknown / unknown / stale建议枚举。
snapshot.current.placeTypehome / park / backyard / unknown建议枚举;当前文案会识别 homeparkbackyard
snapshot.current.geofenceStatusinside_safe_zone / outside_safe_zone / inside_forbidden_zone / unknown建议枚举;可选值:inside_safe_zone / outside_safe_zone / inside_forbidden_zone / unknown。
snapshot.current.lostModeStatusoff / on / recovered_pending_close建议枚举。
snapshot.current.familyCompanionStatuswith_member / alone / unknown建议枚举。
snapshot.current.connectionStatusonline / offline / intermittent建议枚举。
snapshot.current.wearingStatuswearing / not_wearing / unknown建议枚举。
snapshot.current.chargingStatuscharging / not_charging / full / unknown建议枚举。
snapshot.current.currentActivityStateresting / walking / running / sleeping / active / unknown建议枚举;引擎还可识别 playingeating
snapshot.current.currentPosturelying / sitting / standing / moving / unknown建议枚举。
snapshot.today.barkPeakPeriodTodaymorning / afternoon / evening / night / unknown建议枚举。
snapshot.rollingBaseline.*.sourceindividual / species / default建议枚举。
snapshot.rollingBaseline.*.phasecold_start / warming / established建议枚举。
snapshot.context.weatherToday.conditionsunny / rain / thunder / snow / windy / cloudy / hot / unknown建议枚举;hot 或高体感温度会触发环境候选。
snapshot.context.timeOfDaymorning / afternoon / evening / night建议枚举。
snapshot.context.seasonspring / summer / autumn / winter建议枚举。
snapshot.context.weekdayTypeweekday / weekend / holiday建议枚举。
snapshot.quality.*GOOD / FAIR / POOR / MISSING后端强校验;所有 quality 字典值必须属于该集合。
card.stateP0_SAFETY / ATTENTION / DATA_QUALITY / CALM / RECOVERY响应强校验。
card.toneurgent / attention / gentle / calm响应强校验。
card.nextAction.urgencyurgent / soon / normal响应强校验。
card.nextAction.targetsafety / device / health / activity / data_quality / calm响应强校验。
card.suppressed[].reasonDEDUPED / COOLDOWN / LOWER_PRIORITY / LOW_CONFIDENCE / NOT_HOME_SURFACE / USER_DISMISSED / DATA_QUALITY_BLOCKED响应强校验。
card.destinations[].destinationhealth_detail / weekly_report / monthly_report / diary / device_reminder / audit响应强校验。

请求示例

{
  "request_id": "req_insight_001",
  "snapshot": {
    "pet": {
      "petId": "pet-1",
      "petName": "Milo",
      "species": "dog",
      "breed": "Labrador",
      "bodySize": "large",
      "ageMonths": 48,
      "weightKg": 28.5,
      "activityGoalMinutes": 70,
      "stepGoal": 5500
    },
    "current": {
      "placeType": "home",
      "geofenceStatus": "inside_safe_zone",
      "outsideSafeZoneDurationMin": 0,
      "connectionStatus": "online",
      "wearingStatus": "wearing",
      "batteryPct": 80,
      "currentActivityState": "resting",
      "currentPosture": "lying"
    },
    "today": {
      "activeMinutesToday": 70,
      "stepsToday": 5200,
      "restingHrToday": 86,
      "barkCountToday": 8
    },
    "completedDaily": {
      "lastNight": {
        "sleepDurationLastNight": 540,
        "wakeCountLastNight": 2,
        "sleepFragmentationScoreLastNight": 25
      }
    },
    "rollingBaseline": {
      "baselineSleepDuration": {
        "valueRange": { "low": 480, "mid": 540, "high": 660 },
        "source": "individual",
        "validDays": 21,
        "phase": "established",
        "quality": "GOOD"
      }
    },
    "context": {
      "weatherToday": {
        "tempMaxC": 27,
        "feelsLikeC": 25,
        "condition": "sunny"
      },
      "timeOfDay": "afternoon",
      "season": "summer",
      "ownerNearby": true
    },
    "quality": {
      "locationQuality": "GOOD",
      "connectionQuality": "GOOD",
      "wearingQualityToday": "GOOD",
      "activityQuality": "GOOD",
      "sleepQuality": "GOOD",
      "hrQuality": "GOOD",
      "baselineQuality": "GOOD",
      "weatherQuality": "GOOD",
      "profileQuality": "GOOD"
    }
  },
  "simulated_fields": [],
  "template_id": "calm_home",
  "template_version": "v1"
}

返回字段

返回 JSON 示例

{
  "insight_id": "insight_xxx",
  "request_id": "req_insight_001",
  "user_id": "temporary",
  "pet_id": "temporary",
  "card": {
    "state": "CALM",
    "text": {
      "zh-CN": "Milo 今天在家休息得挺安稳,按平时来就好。",
      "en-US": "Milo seems relaxed at home today, so the usual routine should be fine."
    },
    "nowText": {
      "zh-CN": "Milo 现在在家休息,看起来挺平稳。",
      "en-US": "Milo is resting at home and looks settled."
    },
    "recentText": {
      "zh-CN": "今天没有需要优先处理的风险信号。",
      "en-US": "There are no high-priority risk signals today."
    },
    "nextText": {
      "zh-CN": "按平时来就好。",
      "en-US": "The usual routine should be fine."
    },
    "nextAction": {
      "type": "keep_routine",
      "urgency": "normal",
      "target": "calm",
      "text": {
        "zh-CN": "按平时来",
        "en-US": "Use the usual routine"
      },
      "deepLink": null
    },
    "tone": "calm",
    "evidence": [],
    "sourceCandidateIds": [],
    "suppressed": [],
    "destinations": [],
    "templateId": "calm_home",
    "aiUsed": false,
    "safetyCheckPassed": true,
    "fallbackReason": null
  },
  "debug": {
    "candidates": [],
    "quality": [],
    "arbitration": ["selected:calm_fallback"],
    "selectedCandidateId": null,
    "templateId": "calm_home"
  },
  "rule_version": "home-insight-v1",
  "prompt_version": "home-insight-copy-v1",
  "template_id": "calm_home",
  "template_version": "v1",
  "estimated_cost": null,
  "created_at": "2026-07-01T12:00:00Z"
}

AI 洞察响应字段说明

字段类型说明
insight_idstring洞察 ID。
request_idstring请求 ID。
user_idstring用户 ID。
pet_idstring宠物 ID。
card.statestring首页洞察状态,例如 CALMATTENTION
card.textobjectMain card text.
card.nowTextobject多语言文案。
card.recentTextobject多语言文案。
card.nextTextobject多语言文案。
card.nextActionobject|null建议动作。
card.nextAction.deepLinkstring|null建议动作对应的 App 内跳转链接。
card.evidencearray命中规则使用的证据。
qualityobject输入数据质量。
rule_versionstringRule version.
prompt_versionstring|null本次洞察使用的提示词版本。
estimated_costnumber|null模型费用估算;纯规则生成可能为 null。

健康详情洞察 v3

POST /v1/health-detail-insights/generate

AI Gateway 是被动洞察服务:主服务传入已标准化的事实,Gateway 校验 Day / Week / Month 日历窗口、推导确定性规则,并仅对已验证结论进行 AI 润色。

schemaVersion:六个指标 activity、rest、hr、hrv、rr、bark 全部固定为 health-detail-v3locale 仅支持 en-USzh-CN,缺省为 en-US,响应只返回所选语言的 summary

支持 18 种组合:activity / rest / hr / hrv / rr / bark 各自的 day、week、month。请求不接受旧版 quality、预计算偏离结论或旧字段;响应统一使用 camelCase。

查看完整 v3 字段表、18 个请求示例、校验边界和规则矩阵

在本页展开完整协议
# 健康详情 AI 洞察接口接入规范(主服务)

**协议版本:** `health-detail-v3`
**接口:** `POST /v1/health-detail-insights/generate`
**调用方:** 主服务(完成原始数据清洗、聚合和个人基线维护)
**服务方:** AI Gateway(校验输入、执行确定性规则并生成面向用户的洞察)

> 本文是主服务唯一的健康详情接入协议。AI Gateway 是被动服务:不会补齐原始数据、重算调用方已提供的聚合值、诊断疾病或推断确定病因。

## 1. 通用请求契约

六个指标均使用 camelCase:`activity`、`rest`、`hr`、`hrv`、`rr`、`bark`;每个指标支持 `day`、`week`、`month` 三个窗口,共 18 个请求形态。

| 字段名 | 数据类型 | 必须 | 详细说明 |
|---|---|---:|---|
| `schemaVersion` | string | 是 | 固定为 `health-detail-v3`。旧版本请求不兼容。 |
| `userId` | string | 是 | 主服务中的用户标识。 |
| `petId` | string | 是 | 主服务中的宠物标识。 |
| `metric` | enum | 是 | `activity`、`rest`、`hr`、`hrv`、`rr`、`bark`。 |
| `viewWindow` | enum | 是 | `day`、`week`、`month`。 |
| `locale` | enum | 否 | `zh-CN` 或 `en-US`;缺失时默认 `en-US`,只返回所选语言的 `summary`。 |
| `petProfile` | object | 是 | 宠物资料,字段见下表。 |
| `period` | object | 是 | 本地自然时间窗口,字段见下表。 |
| `metrics` | object | 是 | 当前指标和当前窗口的标准化事实;具体字段见各接口。 |
| `previousPeriod` | object | 否 | 紧邻、同类型、已完成的上一完整 Week 或 Month;仅用于改善或恶化规则。 |

### 1.1 `petProfile`

| 字段名 | 数据类型 | 必须 | 详细说明 |
|---|---|---:|---|
| `petProfile.name` | string | 是 | 面向用户文案使用的宠物展示名。 |
| `petProfile.species` | enum | 是 | `dog` 或 `cat`。 |
| `petProfile.activityTolerance` | enum | 否 | `low`、`medium`、`high`、`unknown`;仅用于 Activity 的解释和建议。 |
| `petProfile.heatTolerance` | enum | 否 | `low`、`medium`、`high`、`unknown`;仅用于 Activity 热暴露解释。 |
| `petProfile.coldTolerance` | enum | 否 | `low`、`medium`、`high`、`unknown`;仅用于低温解释。 |
| `petProfile.humidHeatSensitivity` | enum | 否 | `low`、`medium`、`high`、`unknown`;仅用于湿热解释。 |
| `petProfile.healthRiskTags` | array<enum> | 否 | `respiratory`、`cardiovascular`、`musculoskeletal`。只能增强已有结论的建议,不能单独触发诊断或提醒。 |

### 1.2 `period`

| 字段名 | 数据类型 | 必须 | 详细说明 |
|---|---|---:|---|
| `period.startDate` | string(date) | 是 | 本地日期,格式 `YYYY-MM-DD`。Day 必须等于 `endDate`;Week 必须覆盖连续 7 日;Month 必须从自然月 1 日覆盖到月末。 |
| `period.endDate` | string(date) | 是 | 本地日期,格式 `YYYY-MM-DD`。 |
| `period.timezone` | string | 是 | IANA 时区,例如 `Asia/Shanghai`;用于日期、小时数组、夜间和事件的解释。 |
| `period.isCompleted` | boolean | 是 | 窗口是否结束。`false` 时只能输出截至目前的观察,不能输出完整周期的低值、趋势或最终不足结论。 |
| `period.elapsedNights` | integer | Rest、HR、HRV、RR 的 Week/Month 必须 | 已结束、理论可观察的夜晚数;Week 范围 0-7,Month 范围 0-当月天数。 |
| `period.validNights` | integer | Rest、HR、HRV、RR 的 Week/Month 必须 | 有效夜晚数,范围 0-`elapsedNights`。Rest 使用可用休息夜;HR、HRV、RR 使用至少 4 个有效样本的夜晚。 |

## 2. 通用基线契约

所有名为 `baseline` 的对象均使用以下结构。

```json
{
  "baselineLower": 40,
  "baselineUpper": 80,
  "baselineSource": "personal"
}
```

| 字段名 | 数据类型 | 必须 | 详细说明 |
|---|---|---:|---|
| `baselineLower` | number/null | 是 | 个体常见范围下界。`baselineSource=unavailable` 时必须为 `null`。 |
| `baselineUpper` | number/null | 是 | 个体常见范围上界,且不得小于 `baselineLower`。`unavailable` 时必须为 `null`。 |
| `baselineSource` | enum | 是 | `personal`、`blended`、`reference`、`unavailable`。只有 `personal` 可单独触发偏高或偏低结论。 |

Activity、Rest、HR 支持四种来源;HRV、RR 、Bark仅支持 `personal`、`unavailable`。`blended`、`reference` 只能帮助解释,不能单独触发个体偏离提醒。

## 3. 通用响应契约

主服务只应依赖以下字段。结构化证据、质量、展示样式和费用可以由 Gateway 内部保留,但不属于本接口响应契约。

```json
{
  "insightId": "hdi_20260723_activity_day_0001",
  "petId": "pet-1",
  "metric": "activity",
  "viewWindow": "day",
  "period": {
    "startDate": "2026-07-23",
    "endDate": "2026-07-23",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "status": "attention",
  "severity": "medium",
  "summary": "Pocky 今天的活动比平时多一些:活动了 95 分钟,比它平时多 21 分钟。接下来让它多留一点安静休息的时间。",
  "generation": {
    "ruleId": "ACTIVITY_HIGH_DAY",
    "ruleVersion": "health-detail-v3",
    "aiPolished": true,
    "generatedAt": "2026-07-23T10:00:00+08:00"
  }
}
```

| 字段名 | 数据类型 | 必须 | 详细说明 |
|---|---|---:|---|
| `insightId` | string | 是 | 单条洞察唯一标识。 |
| `petId` | string | 是 | 请求中的宠物标识。 |
| `metric` | enum | 是 | 请求指标。 |
| `viewWindow` | enum | 是 | 请求时间窗口。 |
| `period` | object | 是 | 响应窗口信息。 |
| `period.startDate` | string(date) | 是 | 响应窗口开始日期。 |
| `period.endDate` | string(date) | 是 | 响应窗口结束日期。 |
| `period.isCompleted` | boolean | 是 | 请求窗口完成状态。 |
| `status` | enum | 是 | `attention`、`normal`、`improving`、`data_collecting`、`insufficient_data`。 |
| `severity` | enum | 是 | `none`、`low`、`medium`、`high`。详情页不据此直接推送。 |
| `summary` | string | 是 | 选定语言的一段自然语言,结构为“现象 + 关键依据 + 轻解释或建议”。 |
| `generation` | object | 是 | 生成元数据。 |
| `generation.ruleId` | string | 是 | 命中的确定性规则 ID。 |
| `generation.aiPolished` | boolean | 是 | 是否经 AI 润色;模板结果或 AI 失败回退为 `false`。 |
| `generation.generatedAt` | string(date-time) | 是 | ISO 8601 且带时区的生成时间。 |

优先级为:`insufficient_data` > 高严重度 `attention` > 中严重度 `attention` > 低严重度 `attention` > `improving` > `data_collecting` > `normal`。

# 4. Activity(活动)

`metric` 固定为 `activity`。天气枚举仅允许 `sunny`、`cloudy`、`overcast`、`rainy`、`snowy`、`foggy`、`windy`、`unknown`。

## Day

```json
{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "activity",
  "viewWindow": "day",
  "locale": "zh-CN",
  "petProfile": {
    "name": "Pocky",
    "species": "dog",
    "heatTolerance": "low"
  },
  "period": {
    "startDate": "2026-07-23",
    "endDate": "2026-07-23",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "metrics": {
    "wearingMinutes": 1440,
    "activityTime": {
      "activityMinutes": 95,
      "activityMinutesGoal": 60,
      "baseline": {
        "baselineLower": 56,
        "baselineUpper": 84,
        "baselineSource": "personal"
      },
      "hourlyActivityMinutes": [
        0,
        0,
        0,
        0,
        0,
        0,
        8,
        14,
        10,
        3,
        0,
        0,
        0,
        0,
        0,
        0,
        5,
        18,
        20,
        12,
        5,
        0,
        0,
        0
      ]
    },
    "steps": {
      "steps": 6800,
      "stepsGoal": 5000,
      "baseline": {
        "baselineLower": 4160,
        "baselineUpper": 6240,
        "baselineSource": "personal"
      }
    },
    "outings": {
      "count": 2,
      "totalDurationMinutes": 48,
      "items": [
        {
          "startAt": "2026-07-23T07:20:00+08:00",
          "endAt": "2026-07-23T07:35:00+08:00",
          "durationMinutes": 15
        },
        {
          "startAt": "2026-07-23T16:10:00+08:00",
          "endAt": "2026-07-23T16:43:00+08:00",
          "durationMinutes": 33
        }
      ]
    },
    "context": {
      "weather": "sunny",
      "tempMaxC": 33,
      "feelsLikeMaxC": 37,
      "humidityPct": 74
    }
  }
}
```

| 字段名 | 数据类型 | 必须 | 详细说明 |
|---|---|---:|---|
| `metrics.wearingMinutes` | integer | 是 | 当日有效佩戴分钟,范围 0-1440。 |
| `metrics.activityTime.activityMinutes` | integer | 是 | 当日活动分钟,范围 0-1440。 |
| `metrics.activityTime.activityMinutesGoal` | integer/null | 否 | 当日活动目标,只用于解释和达标文案。 |
| `metrics.activityTime.baseline` | Baseline | 是 | 活动分钟基线。 |
| `metrics.activityTime.hourlyActivityMinutes` | array<integer/null> | 是 | 固定 24 项,对应本地 0-23 时;非空项范围 0-60,非空项之和必须等于 `activityMinutes`。`null` 是未采集,不是静止。 |
| `metrics.steps` | object | 否 | 设备支持步数时传入。 |
| `metrics.steps.steps` | integer | 条件必填 | 传入 `steps` 时必填的总步数。 |
| `metrics.steps.stepsGoal` | integer/null | 否 | 当日步数目标。 |
| `metrics.steps.baseline` | Baseline | 条件必填 | 步数基线。 |
| `metrics.outings` | object | 否 | 外出汇总和片段。 |
| `metrics.outings.count` | integer | 条件必填 | 必须等于 `items` 长度。 |
| `metrics.outings.totalDurationMinutes` | integer | 条件必填 | 必须等于各片段时长之和。 |
| `metrics.outings.items[].startAt` | string(date-time) | 是 | 带时区且位于请求 Day 内。 |
| `metrics.outings.items[].endAt` | string(date-time) | 是 | 带时区、晚于开始时间且位于请求 Day 内。 |
| `metrics.outings.items[].durationMinutes` | integer | 是 | 必须与起止时间间隔一致。 |
| `metrics.context.weather` | enum | 否 | 上述天气枚举。 |
| `metrics.context.tempMaxC` | number | 否 | 最高环境温度,摄氏度。 |
| `metrics.context.feelsLikeMaxC` | number | 否 | 最高体感温度,摄氏度。 |
| `metrics.context.humidityPct` | number | 否 | 相对湿度,范围 0-100。 |

Day 未完成时,允许输出已超过上限、热暴露或集中活动事实;不得输出当天活动不足或最终未达标。

## Week

```json
{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "activity",
  "viewWindow": "week",
  "locale": "en-US",
  "petProfile": {
    "name": "Pocky",
    "species": "dog"
  },
  "period": {
    "startDate": "2026-07-13",
    "endDate": "2026-07-19",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "metrics": {
    "wearingMinutesByDay": [
      1440,
      1440,
      1440,
      1440,
      1440,
      1440,
      1440
    ],
    "activityTime": {
      "averageDailyActivityMinutes": 72,
      "activityMinutesGoal": 60,
      "baseline": {
        "baselineLower": 56,
        "baselineUpper": 84,
        "baselineSource": "personal"
      },
      "dailyActivityMinutes": [
        70,
        55,
        80,
        68,
        90,
        75,
        66
      ]
    },
    "steps": {
      "averageDailySteps": 5314,
      "stepsGoal": 5000,
      "baseline": {
        "baselineLower": 4160,
        "baselineUpper": 6240,
        "baselineSource": "personal"
      },
      "dailySteps": [
        5000,
        4300,
        5900,
        5100,
        6700,
        5400,
        4800
      ]
    },
    "dailyOutings": [
      {
        "date": "2026-07-13",
        "count": 2,
        "totalDurationMinutes": 30
      }
    ],
    "dailyWeather": [
      {
        "date": "2026-07-13",
        "weather": "cloudy",
        "tempMaxC": 29,
        "feelsLikeMaxC": 31,
        "humidityPct": 68
      }
    ]
  },
  "previousPeriod": {
    "startDate": "2026-07-06",
    "endDate": "2026-07-12",
    "isCompleted": true,
    "averageDailyActivityMinutes": 80,
    "averageDailySteps": 5900
  }
}
```

| 字段名 | 数据类型 | 必须 | 详细说明 |
|---|---|---:|---|
| `metrics.wearingMinutesByDay` | array<integer/null> | 是 | 固定 7 项,按日期排列;非空范围 0-1440。 |
| `metrics.activityTime.averageDailyActivityMinutes` | number | 是 | 非空 `dailyActivityMinutes` 的均值。 |
| `metrics.activityTime.activityMinutesGoal` | integer/null | 否 | 每日活动目标。 |
| `metrics.activityTime.baseline` | Baseline | 是 | 日均活动基线。 |
| `metrics.activityTime.dailyActivityMinutes` | array<integer/null> | 是 | 固定 7 项,非空项均值必须等于日均值。 |
| `metrics.steps.averageDailySteps` | number | 条件必填 | 提供 `steps` 时,为非空 `dailySteps` 的均值。 |
| `metrics.steps.stepsGoal` | integer/null | 否 | 每日步数目标。 |
| `metrics.steps.dailySteps` | array<integer/null> | 条件必填 | 提供 `steps` 时固定 7 项。 |
| `metrics.dailyOutings` | array<object> | 否 | 每日外出汇总;日期在窗口内且唯一。未出现日期表示未知,不代表 0。 |
| `metrics.dailyWeather` | array<object> | 否 | 每日天气上下文;日期在窗口内且唯一。 |
| `previousPeriod.averageDailyActivityMinutes` | number | 条件必填 | 提供上一周期时必填。 |
| `previousPeriod.averageDailySteps` | number | 否 | 可用时提供。 |

## Month

请求结构与 Activity Week 相同;`startDate` 必须为月初,`endDate` 必须为月末,`wearingMinutesByDay`、`dailyActivityMinutes`、`dailySteps` 的长度必须等于当月天数。`previousPeriod` 必须是紧邻上一完整自然月。

```json
{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "activity",
  "viewWindow": "month",
  "locale": "en-US",
  "petProfile": {
    "name": "Pocky",
    "species": "dog"
  },
  "period": {
    "startDate": "2026-02-01",
    "endDate": "2026-02-28",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "metrics": {
    "wearingMinutesByDay": [
      1440,
      1440,
      1440,
      1440,
      1440,
      1440,
      1440,
      1440,
      1440,
      1440,
      1440,
      1440,
      1440,
      1440,
      1440,
      1440,
      1440,
      1440,
      1440,
      1440,
      1440,
      1440,
      1440,
      1440,
      1440,
      1440,
      1440,
      1440
    ],
    "activityTime": {
      "averageDailyActivityMinutes": 70,
      "activityMinutesGoal": 60,
      "baseline": {
        "baselineLower": 56,
        "baselineUpper": 84,
        "baselineSource": "personal"
      },
      "dailyActivityMinutes": [
        70,
        70,
        70,
        70,
        70,
        70,
        70,
        70,
        70,
        70,
        70,
        70,
        70,
        70,
        70,
        70,
        70,
        70,
        70,
        70,
        70,
        70,
        70,
        70,
        70,
        70,
        70,
        70
      ]
    },
    "steps": {
      "averageDailySteps": 5000,
      "stepsGoal": 5000,
      "baseline": {
        "baselineLower": 4160,
        "baselineUpper": 6240,
        "baselineSource": "personal"
      },
      "dailySteps": [
        5000,
        5000,
        5000,
        5000,
        5000,
        5000,
        5000,
        5000,
        5000,
        5000,
        5000,
        5000,
        5000,
        5000,
        5000,
        5000,
        5000,
        5000,
        5000,
        5000,
        5000,
        5000,
        5000,
        5000,
        5000,
        5000,
        5000,
        5000
      ]
    }
  },
  "previousPeriod": {
    "startDate": "2026-01-01",
    "endDate": "2026-01-31",
    "isCompleted": true,
    "averageDailyActivityMinutes": 76
  }
}
```

示例数组已按 2026-02 的完整自然月补齐 28 项。字段语义与 Week 相同。

# 5. Rest(休息)

`metric` 固定为 `rest`。Rest Day 以选中日期结束的上一夜为主,当日休息仅作为辅助证据。

## Day

```json
{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "rest",
  "viewWindow": "day",
  "locale": "zh-CN",
  "petProfile": {
    "name": "Pocky",
    "species": "dog",
    "healthRiskTags": [
      "respiratory"
    ]
  },
  "period": {
    "startDate": "2026-07-23",
    "endDate": "2026-07-23",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "metrics": {
    "night": {
      "startAt": "2026-07-22T21:30:00+08:00",
      "endAt": "2026-07-23T07:00:00+08:00",
      "isCompleted": true,
      "wearingMinutes": 550,
      "nightRest": {
        "minutes": 420,
        "baseline": {
          "baselineLower": 390,
          "baselineUpper": 510,
          "baselineSource": "personal"
        }
      },
      "interruptions": {
        "count": 4,
        "baseline": {
          "baselineLower": 0,
          "baselineUpper": 3,
          "baselineSource": "personal"
        }
      },
      "longestRestBlockMinutes": 150,
      "nightActivity": {
        "minutes": 24,
        "baseline": {
          "baselineLower": 0,
          "baselineUpper": 16,
          "baselineSource": "personal"
        }
      },
      "restSegments": []
    },
    "day": {
      "wearingMinutes": 600,
      "hourlyRestMinutes": [
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        12,
        18,
        0,
        0,
        20,
        25,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0
      ],
      "dayRestBaseline": {
        "baselineLower": 20,
        "baselineUpper": 55,
        "baselineSource": "personal"
      }
    }
  }
}
```

| 字段名 | 数据类型 | 必须 | 详细说明 |
|---|---|---:|---|
| `metrics.night.startAt` / `endAt` | string(date-time) | 是 | 带时区的上一夜窗口,允许跨自然日。 |
| `metrics.night.isCompleted` | boolean | 是 | 夜晚是否结束;`false` 时不能形成夜间主判断。 |
| `metrics.night.wearingMinutes` | integer | 是 | 夜间有效佩戴分钟。少于 300 时为数据不足。 |
| `metrics.night.nightRest.minutes` | integer | 是 | 夜间总休息分钟。 |
| `metrics.night.nightRest.baseline` | Baseline | 是 | 夜间总休息基线。 |
| `metrics.night.interruptions.count` | integer | 是 | 夜间中断次数。 |
| `metrics.night.interruptions.baseline` | Baseline | 是 | 夜间中断基线。 |
| `metrics.night.longestRestBlockMinutes` | integer | 是 | 最长连续休息分钟。 |
| `metrics.night.nightActivity.minutes` | integer | 是 | 夜间活动分钟。 |
| `metrics.night.nightActivity.baseline` | Baseline | 是 | 夜间活动基线。 |
| `metrics.night.restSegments` | array<object>/null | 是 | `null` 表示设备不提供分段能力;未覆盖时段为未知。元素含 `startAt`、`endAt`、`durationMinutes`、`type`,其中 `type` 为 `awake`、`lightMovement`、`deepRest`。 |
| `metrics.day.wearingMinutes` | integer | 是 | 选中自然日有效佩戴分钟。 |
| `metrics.day.hourlyRestMinutes` | array<integer/null> | 是 | 固定 24 项,非空范围 0-60;`null` 表示该小时不可用。 |
| `metrics.day.dayRestBaseline` | Baseline | 是 | 白天总休息分钟基线。 |

## Week

```json
{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "rest",
  "viewWindow": "week",
  "locale": "zh-CN",
  "petProfile": {
    "name": "Pocky",
    "species": "dog"
  },
  "period": {
    "startDate": "2026-07-13",
    "endDate": "2026-07-19",
    "timezone": "Asia/Shanghai",
    "isCompleted": true,
    "elapsedNights": 7,
    "validNights": 6
  },
  "metrics": {
    "nightRest": {
      "averageMinutes": 405,
      "baseline": {
        "baselineLower": 390,
        "baselineUpper": 510,
        "baselineSource": "personal"
      }
    },
    "interruptions": {
      "averageCount": 4,
      "baseline": {
        "baselineLower": 0,
        "baselineUpper": 3,
        "baselineSource": "personal"
      }
    },
    "nightActivity": {
      "averageMinutes": 24,
      "baseline": {
        "baselineLower": 0,
        "baselineUpper": 16,
        "baselineSource": "personal"
      }
    },
    "dayRest": {
      "averageMinutes": 48,
      "baseline": {
        "baselineLower": 20,
        "baselineUpper": 55,
        "baselineSource": "personal"
      }
    },
    "anomalyNights": {
      "lowNightRestCount": 2,
      "highInterruptionCount": 3,
      "highNightActivityCount": 1
    },
    "nightlyRestDurations": [
      {
        "nightDate": "2026-07-13",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 360
      },
      {
        "nightDate": "2026-07-14",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 360
      },
      {
        "nightDate": "2026-07-15",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 360
      },
      {
        "nightDate": "2026-07-16",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 360
      },
      {
        "nightDate": "2026-07-17",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 360
      },
      {
        "nightDate": "2026-07-18",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 360
      },
      {
        "nightDate": "2026-07-19",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      }
    ]
  },
  "previousPeriod": {
    "startDate": "2026-07-06",
    "endDate": "2026-07-12",
    "isCompleted": true,
    "validNights": 6,
    "nightRestAverageMinutes": 455,
    "interruptionsAverageCount": 2,
    "nightActivityAverageMinutes": 12,
    "dayRestAverageMinutes": 30,
    "lowNightRestCount": 0,
    "highInterruptionCount": 1,
    "highNightActivityCount": 0
  }
}
```

| 字段名 | 数据类型 | 必须 | 详细说明 |
|---|---|---:|---|
| `metrics.nightRest.averageMinutes` | number/null | 是 | 有效夜平均夜间总休息;`validNights=0` 时为 `null`。 |
| `metrics.interruptions.averageCount` | number/null | 是 | 有效夜平均中断次数。 |
| `metrics.nightActivity.averageMinutes` | number/null | 是 | 有效夜平均夜间活动分钟。 |
| `metrics.dayRest.averageMinutes` | number/null | 是 | 有效日平均白天休息分钟。 |
| 上述四项 `baseline` | Baseline | 是 | 对应指标的独立基线。 |
| `metrics.anomalyNights` | object | 是 | `lowNightRestCount`、`highInterruptionCount`、`highNightActivityCount`;均在 0-`validNights`。 |
| `metrics.nightlyRestDurations` | array<object> | 是 | 固定 7 项,按 `nightDate` 升序;无效夜的 `lightMovementMinutes`、`deepRestMinutes` 必须同时为 `null`。 |
| `previousPeriod` | object | 否 | 紧邻已完成上一周;必须包含日期、`validNights`、四项均值和三项异常夜计数。 |

Week 少于 3 个有效夜晚时不输出周期趋势或稳定结论。

## Month

请求结构与 Rest Week 相同,窗口必须为完整自然月;`elapsedNights`、`nightlyRestDurations` 长度等于当月天数,`previousPeriod` 必须是紧邻上一完整自然月。Month 少于 10 个有效夜晚时不输出周期趋势或稳定结论。

```json
{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "rest",
  "viewWindow": "month",
  "locale": "en-US",
  "petProfile": {
    "name": "Pocky",
    "species": "dog"
  },
  "period": {
    "startDate": "2026-02-01",
    "endDate": "2026-02-28",
    "timezone": "Asia/Shanghai",
    "isCompleted": true,
    "elapsedNights": 28,
    "validNights": 25
  },
  "metrics": {
    "nightRest": {
      "averageMinutes": 450,
      "baseline": {
        "baselineLower": 390,
        "baselineUpper": 510,
        "baselineSource": "personal"
      }
    },
    "interruptions": {
      "averageCount": 2,
      "baseline": {
        "baselineLower": 0,
        "baselineUpper": 3,
        "baselineSource": "personal"
      }
    },
    "nightActivity": {
      "averageMinutes": 12,
      "baseline": {
        "baselineLower": 0,
        "baselineUpper": 16,
        "baselineSource": "personal"
      }
    },
    "dayRest": {
      "averageMinutes": 30,
      "baseline": {
        "baselineLower": 20,
        "baselineUpper": 55,
        "baselineSource": "personal"
      }
    },
    "anomalyNights": {
      "lowNightRestCount": 0,
      "highInterruptionCount": 1,
      "highNightActivityCount": 0
    },
    "nightlyRestDurations": [
      {
        "nightDate": "2026-02-01",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 405
      },
      {
        "nightDate": "2026-02-02",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 405
      },
      {
        "nightDate": "2026-02-03",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 405
      },
      {
        "nightDate": "2026-02-04",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 405
      },
      {
        "nightDate": "2026-02-05",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 405
      },
      {
        "nightDate": "2026-02-06",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 405
      },
      {
        "nightDate": "2026-02-07",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 405
      },
      {
        "nightDate": "2026-02-08",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 405
      },
      {
        "nightDate": "2026-02-09",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 405
      },
      {
        "nightDate": "2026-02-10",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 405
      },
      {
        "nightDate": "2026-02-11",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 405
      },
      {
        "nightDate": "2026-02-12",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 405
      },
      {
        "nightDate": "2026-02-13",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 405
      },
      {
        "nightDate": "2026-02-14",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 405
      },
      {
        "nightDate": "2026-02-15",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 405
      },
      {
        "nightDate": "2026-02-16",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 405
      },
      {
        "nightDate": "2026-02-17",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 405
      },
      {
        "nightDate": "2026-02-18",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 405
      },
      {
        "nightDate": "2026-02-19",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 405
      },
      {
        "nightDate": "2026-02-20",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 405
      },
      {
        "nightDate": "2026-02-21",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 405
      },
      {
        "nightDate": "2026-02-22",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 405
      },
      {
        "nightDate": "2026-02-23",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 405
      },
      {
        "nightDate": "2026-02-24",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 405
      },
      {
        "nightDate": "2026-02-25",
        "lightMovementMinutes": 45,
        "deepRestMinutes": 405
      },
      {
        "nightDate": "2026-02-26",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-02-27",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-02-28",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      }
    ]
  }
}
```

# 6. HR(静息心率)

`metric` 固定为 `hr`,单位为 `bpm`。仅接收静息心率,不接收运动心率。夜间静息心率为主判断,全天静息心率只可作为同方向辅助证据。

## Day

```json
{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "hr",
  "viewWindow": "day",
  "locale": "zh-CN",
  "petProfile": {
    "name": "Pocky",
    "species": "dog",
    "healthRiskTags": [
      "cardiovascular"
    ]
  },
  "period": {
    "startDate": "2026-07-23",
    "endDate": "2026-07-23",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "metrics": {
    "night": {
      "startAt": "2026-07-22T21:30:00+08:00",
      "endAt": "2026-07-23T07:00:00+08:00",
      "isCompleted": true
    },
    "nightRestHrAverage": {
      "value": 66,
      "sampleCount": 6,
      "baseline": {
        "baselineLower": 58,
        "baselineUpper": 64,
        "baselineSource": "personal"
      }
    },
    "allDayRestHrAverage": {
      "value": 70,
      "sampleCount": 13,
      "baseline": {
        "baselineLower": 62,
        "baselineUpper": 68,
        "baselineSource": "personal"
      }
    },
    "hourlyPoints": [
      [],
      [],
      [
        68
      ],
      [
        66,
        67
      ],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      []
    ],
    "context": {
      "weather": "cloudy",
      "temperatureCelsius": 28,
      "humidityPct": 72
    }
  }
}
```

| 字段名 | 数据类型 | 必须 | 详细说明 |
|---|---|---:|---|
| `metrics.night` | object | 是 | 以选中日结束的上一夜,含带时区的 `startAt`、`endAt` 和 `isCompleted`。 |
| `metrics.nightRestHrAverage` | object | 是 | 夜间主指标,含 `value`、`sampleCount`、`baseline`。`sampleCount` 至少 4 才能主判断。 |
| `metrics.allDayRestHrAverage` | object | 否 | 全天静息心率,含 `value`、`sampleCount`、`baseline`;至少 8 个同方向样本才可增强已触发结论。 |
| `metrics.hourlyPoints` | array<array<number>> | 否 | 固定 24 项;每项是该小时零到多个静息样本,空数组表示无样本。只解释已触发异常时段。 |
| `metrics.context` | object | 否 | `weather`、`temperatureCelsius`、`humidityPct`;只解释已有结论。 |

`value` 样本不足时为 `null`;`sampleCount=0` 时 `value` 必须为 `null`。上述 `baseline` 支持四种通用来源。

## Week

```json
{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "hr",
  "viewWindow": "week",
  "locale": "en-US",
  "petProfile": {
    "name": "Pocky",
    "species": "dog"
  },
  "period": {
    "startDate": "2026-07-13",
    "endDate": "2026-07-19",
    "timezone": "Asia/Shanghai",
    "isCompleted": true,
    "elapsedNights": 7,
    "validNights": 6
  },
  "metrics": {
    "nightRestHrAverage": {
      "value": 66,
      "sampleCount": 36,
      "baseline": {
        "baselineLower": 58,
        "baselineUpper": 64,
        "baselineSource": "personal"
      }
    },
    "allDayRestHrAverage": {
      "value": 68,
      "sampleCount": 78,
      "baseline": {
        "baselineLower": 62,
        "baselineUpper": 68,
        "baselineSource": "personal"
      }
    },
    "dailyNightRestHr": [
      {
        "date": "2026-07-13",
        "nightRestHrAverage": 66,
        "sampleCount": 6
      },
      {
        "date": "2026-07-14",
        "nightRestHrAverage": 66,
        "sampleCount": 6
      },
      {
        "date": "2026-07-15",
        "nightRestHrAverage": 66,
        "sampleCount": 6
      },
      {
        "date": "2026-07-16",
        "nightRestHrAverage": 66,
        "sampleCount": 6
      },
      {
        "date": "2026-07-17",
        "nightRestHrAverage": 66,
        "sampleCount": 6
      },
      {
        "date": "2026-07-18",
        "nightRestHrAverage": 66,
        "sampleCount": 6
      },
      {
        "date": "2026-07-19",
        "nightRestHrAverage": null,
        "sampleCount": 0
      }
    ]
  },
  "previousPeriod": {
    "startDate": "2026-07-06",
    "endDate": "2026-07-12",
    "isCompleted": true,
    "validNights": 6,
    "nightRestHrAverage": 61,
    "allDayRestHrAverage": 65,
    "highNightRestHrCount": 0,
    "lowNightRestHrCount": 1
  }
}
```

| 字段名 | 数据类型 | 必须 | 详细说明 |
|---|---|---:|---|
| `metrics.nightRestHrAverage` | object | 是 | 当前周期夜间平均;字段同 Day,`sampleCount` 是周期样本总数。 |
| `metrics.allDayRestHrAverage` | object | 否 | 当前周期全天平均;字段同 Day。 |
| `metrics.dailyNightRestHr` | array<object> | 是 | 固定 7 项,元素为 `date`、`nightRestHrAverage`、`sampleCount`。无效夜为 `null` 和 0。 |
| `previousPeriod` | object | 否 | 紧邻完整上一周;含日期、`validNights`、夜间/全天均值、`highNightRestHrCount`、`lowNightRestHrCount`。 |

Week 少于 3 个有效夜晚时不输出趋势结论。

## Month

请求结构与 HR Week 相同;必须覆盖完整自然月,逐夜数组长度等于当月天数,`previousPeriod` 是紧邻上一完整月。Month 少于 10 个有效夜晚时不输出趋势结论。

```json
{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "hr",
  "viewWindow": "month",
  "locale": "en-US",
  "petProfile": {
    "name": "Pocky",
    "species": "dog"
  },
  "period": {
    "startDate": "2026-02-01",
    "endDate": "2026-02-28",
    "timezone": "Asia/Shanghai",
    "isCompleted": true,
    "elapsedNights": 28,
    "validNights": 25
  },
  "metrics": {
    "nightRestHrAverage": {
      "value": 65,
      "sampleCount": 150,
      "baseline": {
        "baselineLower": 58,
        "baselineUpper": 64,
        "baselineSource": "personal"
      }
    },
    "dailyNightRestHr": [
      {
        "date": "2026-02-01",
        "nightRestHrAverage": 65,
        "sampleCount": 6
      },
      {
        "date": "2026-02-02",
        "nightRestHrAverage": 65,
        "sampleCount": 6
      },
      {
        "date": "2026-02-03",
        "nightRestHrAverage": 65,
        "sampleCount": 6
      },
      {
        "date": "2026-02-04",
        "nightRestHrAverage": 65,
        "sampleCount": 6
      },
      {
        "date": "2026-02-05",
        "nightRestHrAverage": 65,
        "sampleCount": 6
      },
      {
        "date": "2026-02-06",
        "nightRestHrAverage": 65,
        "sampleCount": 6
      },
      {
        "date": "2026-02-07",
        "nightRestHrAverage": 65,
        "sampleCount": 6
      },
      {
        "date": "2026-02-08",
        "nightRestHrAverage": 65,
        "sampleCount": 6
      },
      {
        "date": "2026-02-09",
        "nightRestHrAverage": 65,
        "sampleCount": 6
      },
      {
        "date": "2026-02-10",
        "nightRestHrAverage": 65,
        "sampleCount": 6
      },
      {
        "date": "2026-02-11",
        "nightRestHrAverage": 65,
        "sampleCount": 6
      },
      {
        "date": "2026-02-12",
        "nightRestHrAverage": 65,
        "sampleCount": 6
      },
      {
        "date": "2026-02-13",
        "nightRestHrAverage": 65,
        "sampleCount": 6
      },
      {
        "date": "2026-02-14",
        "nightRestHrAverage": 65,
        "sampleCount": 6
      },
      {
        "date": "2026-02-15",
        "nightRestHrAverage": 65,
        "sampleCount": 6
      },
      {
        "date": "2026-02-16",
        "nightRestHrAverage": 65,
        "sampleCount": 6
      },
      {
        "date": "2026-02-17",
        "nightRestHrAverage": 65,
        "sampleCount": 6
      },
      {
        "date": "2026-02-18",
        "nightRestHrAverage": 65,
        "sampleCount": 6
      },
      {
        "date": "2026-02-19",
        "nightRestHrAverage": 65,
        "sampleCount": 6
      },
      {
        "date": "2026-02-20",
        "nightRestHrAverage": 65,
        "sampleCount": 6
      },
      {
        "date": "2026-02-21",
        "nightRestHrAverage": 65,
        "sampleCount": 6
      },
      {
        "date": "2026-02-22",
        "nightRestHrAverage": 65,
        "sampleCount": 6
      },
      {
        "date": "2026-02-23",
        "nightRestHrAverage": 65,
        "sampleCount": 6
      },
      {
        "date": "2026-02-24",
        "nightRestHrAverage": 65,
        "sampleCount": 6
      },
      {
        "date": "2026-02-25",
        "nightRestHrAverage": 65,
        "sampleCount": 6
      },
      {
        "date": "2026-02-26",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-02-27",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-02-28",
        "nightRestHrAverage": null,
        "sampleCount": 0
      }
    ]
  }
}
```

# 7. HRV(恢复状态)

`metric` 固定为 `hrv`。用户文案称“恢复状态”,数据证据是静息 HRV 的 RMSSD,单位 `ms`。不接收原始 RR 间期,不将 HRV 表述为压力、疾病或恢复能力评分。

## Day

```json
{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "hrv",
  "viewWindow": "day",
  "locale": "zh-CN",
  "petProfile": {
    "name": "Pocky",
    "species": "dog"
  },
  "period": {
    "startDate": "2026-07-23",
    "endDate": "2026-07-23",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "metrics": {
    "night": {
      "startAt": "2026-07-22T21:30:00+08:00",
      "endAt": "2026-07-23T07:00:00+08:00",
      "isCompleted": true
    },
    "nightRestRmssdAverage": {
      "value": 42,
      "sampleCount": 6,
      "baseline": {
        "baselineLower": 45,
        "baselineUpper": 63,
        "baselineSource": "personal"
      }
    },
    "allDayRestRmssdAverage": {
      "value": 44,
      "sampleCount": 11,
      "baseline": {
        "baselineLower": 46,
        "baselineUpper": 65,
        "baselineSource": "personal"
      }
    },
    "hourlyRmssdPoints": [
      [],
      [],
      [
        41
      ],
      [
        39,
        42
      ],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      []
    ],
    "context": {
      "weather": "cloudy",
      "temperatureCelsius": 28,
      "humidityPct": 72
    }
  }
}
```

| 字段名 | 数据类型 | 必须 | 详细说明 |
|---|---|---:|---|
| `metrics.night` | object | 是 | 字段和夜间完成规则同 HR Day。 |
| `metrics.nightRestRmssdAverage` | object | 是 | 夜间主指标,含 `value`、有效 RMSSD 片段数 `sampleCount`、`baseline`;至少 4 片段才能主判断。 |
| `metrics.allDayRestRmssdAverage` | object | 否 | 全天辅助指标;至少 8 个同方向片段才可增强结论。 |
| `metrics.hourlyRmssdPoints` | array<array<number>> | 否 | 固定 24 项,每项为该小时零到多个有效 RMSSD 片段;空数组表示无片段。 |
| `metrics.context` | object | 否 | 环境上下文,只解释已触发结论。 |

HRV 的所有基线仅允许 `personal`、`unavailable`。

## Week

```json
{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "hrv",
  "viewWindow": "week",
  "locale": "en-US",
  "petProfile": {
    "name": "Pocky",
    "species": "dog"
  },
  "period": {
    "startDate": "2026-07-13",
    "endDate": "2026-07-19",
    "timezone": "Asia/Shanghai",
    "isCompleted": true,
    "elapsedNights": 7,
    "validNights": 6
  },
  "metrics": {
    "nightRestRmssdAverage": {
      "value": 42,
      "sampleCount": 36,
      "baseline": {
        "baselineLower": 45,
        "baselineUpper": 63,
        "baselineSource": "personal"
      }
    },
    "dailyNightRestRmssd": [
      {
        "date": "2026-07-13",
        "nightRestRmssdAverage": 42,
        "sampleCount": 6
      },
      {
        "date": "2026-07-14",
        "nightRestRmssdAverage": 42,
        "sampleCount": 6
      },
      {
        "date": "2026-07-15",
        "nightRestRmssdAverage": 42,
        "sampleCount": 6
      },
      {
        "date": "2026-07-16",
        "nightRestRmssdAverage": 42,
        "sampleCount": 6
      },
      {
        "date": "2026-07-17",
        "nightRestRmssdAverage": 42,
        "sampleCount": 6
      },
      {
        "date": "2026-07-18",
        "nightRestRmssdAverage": 42,
        "sampleCount": 6
      },
      {
        "date": "2026-07-19",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      }
    ]
  },
  "previousPeriod": {
    "startDate": "2026-07-06",
    "endDate": "2026-07-12",
    "isCompleted": true,
    "validNights": 6,
    "nightRestRmssdAverage": 51,
    "allDayRestRmssdAverage": 53,
    "lowNightRestRmssdCount": 1
  }
}
```

| 字段名 | 数据类型 | 必须 | 详细说明 |
|---|---|---:|---|
| `metrics.nightRestRmssdAverage` | object | 是 | 当前周期夜间平均,字段同 Day。 |
| `metrics.allDayRestRmssdAverage` | object | 否 | 当前周期全天平均,字段同 Day。 |
| `metrics.dailyNightRestRmssd` | array<object> | 是 | 固定 7 项,元素为 `date`、`nightRestRmssdAverage`、`sampleCount`。 |
| `previousPeriod` | object | 否 | 紧邻完整上一周;含日期、有效夜晚、夜间/全天均值和 `lowNightRestRmssdCount`。 |

Week 少于 3 个有效夜晚时不输出周期主判断。

## Month

请求结构与 HRV Week 相同;完整自然月、逐夜数组长度和上一周期要求同 HR Month。Month 少于 10 个有效夜晚时不输出周期主判断。

```json
{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "hrv",
  "viewWindow": "month",
  "locale": "en-US",
  "petProfile": {
    "name": "Pocky",
    "species": "dog"
  },
  "period": {
    "startDate": "2026-02-01",
    "endDate": "2026-02-28",
    "timezone": "Asia/Shanghai",
    "isCompleted": true,
    "elapsedNights": 28,
    "validNights": 25
  },
  "metrics": {
    "nightRestRmssdAverage": {
      "value": 48,
      "sampleCount": 150,
      "baseline": {
        "baselineLower": 45,
        "baselineUpper": 63,
        "baselineSource": "personal"
      }
    },
    "dailyNightRestRmssd": [
      {
        "date": "2026-02-01",
        "nightRestRmssdAverage": 48,
        "sampleCount": 6
      },
      {
        "date": "2026-02-02",
        "nightRestRmssdAverage": 48,
        "sampleCount": 6
      },
      {
        "date": "2026-02-03",
        "nightRestRmssdAverage": 48,
        "sampleCount": 6
      },
      {
        "date": "2026-02-04",
        "nightRestRmssdAverage": 48,
        "sampleCount": 6
      },
      {
        "date": "2026-02-05",
        "nightRestRmssdAverage": 48,
        "sampleCount": 6
      },
      {
        "date": "2026-02-06",
        "nightRestRmssdAverage": 48,
        "sampleCount": 6
      },
      {
        "date": "2026-02-07",
        "nightRestRmssdAverage": 48,
        "sampleCount": 6
      },
      {
        "date": "2026-02-08",
        "nightRestRmssdAverage": 48,
        "sampleCount": 6
      },
      {
        "date": "2026-02-09",
        "nightRestRmssdAverage": 48,
        "sampleCount": 6
      },
      {
        "date": "2026-02-10",
        "nightRestRmssdAverage": 48,
        "sampleCount": 6
      },
      {
        "date": "2026-02-11",
        "nightRestRmssdAverage": 48,
        "sampleCount": 6
      },
      {
        "date": "2026-02-12",
        "nightRestRmssdAverage": 48,
        "sampleCount": 6
      },
      {
        "date": "2026-02-13",
        "nightRestRmssdAverage": 48,
        "sampleCount": 6
      },
      {
        "date": "2026-02-14",
        "nightRestRmssdAverage": 48,
        "sampleCount": 6
      },
      {
        "date": "2026-02-15",
        "nightRestRmssdAverage": 48,
        "sampleCount": 6
      },
      {
        "date": "2026-02-16",
        "nightRestRmssdAverage": 48,
        "sampleCount": 6
      },
      {
        "date": "2026-02-17",
        "nightRestRmssdAverage": 48,
        "sampleCount": 6
      },
      {
        "date": "2026-02-18",
        "nightRestRmssdAverage": 48,
        "sampleCount": 6
      },
      {
        "date": "2026-02-19",
        "nightRestRmssdAverage": 48,
        "sampleCount": 6
      },
      {
        "date": "2026-02-20",
        "nightRestRmssdAverage": 48,
        "sampleCount": 6
      },
      {
        "date": "2026-02-21",
        "nightRestRmssdAverage": 48,
        "sampleCount": 6
      },
      {
        "date": "2026-02-22",
        "nightRestRmssdAverage": 48,
        "sampleCount": 6
      },
      {
        "date": "2026-02-23",
        "nightRestRmssdAverage": 48,
        "sampleCount": 6
      },
      {
        "date": "2026-02-24",
        "nightRestRmssdAverage": 48,
        "sampleCount": 6
      },
      {
        "date": "2026-02-25",
        "nightRestRmssdAverage": 48,
        "sampleCount": 6
      },
      {
        "date": "2026-02-26",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-02-27",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-02-28",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      }
    ]
  }
}
```

# 8. RR(呼吸状态)

`metric` 固定为 `rr`。用户文案称“呼吸状态”,数据证据是静息呼吸频率,单位 `breaths/min`。不接收呼吸波形、绝对医学阈值、品种参考或上游预计算风险评级。

## Day

```json
{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "rr",
  "viewWindow": "day",
  "locale": "zh-CN",
  "petProfile": {
    "name": "Pocky",
    "species": "dog",
    "healthRiskTags": [
      "respiratory"
    ]
  },
  "period": {
    "startDate": "2026-07-23",
    "endDate": "2026-07-23",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "metrics": {
    "night": {
      "startAt": "2026-07-22T21:30:00+08:00",
      "endAt": "2026-07-23T07:00:00+08:00",
      "isCompleted": true
    },
    "nightRestRrAverage": {
      "value": 24,
      "sampleCount": 6,
      "baseline": {
        "baselineLower": 16,
        "baselineUpper": 21,
        "baselineSource": "personal"
      }
    },
    "allDayRestRrAverage": {
      "value": 23,
      "sampleCount": 12,
      "baseline": {
        "baselineLower": 16,
        "baselineUpper": 21,
        "baselineSource": "personal"
      }
    },
    "hourlyPoints": [
      [],
      [],
      [
        22
      ],
      [
        24,
        23
      ],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      []
    ],
    "context": {
      "weather": "cloudy",
      "temperatureCelsius": 28,
      "humidityPct": 72
    }
  }
}
```

| 字段名 | 数据类型 | 必须 | 详细说明 |
|---|---|---:|---|
| `metrics.night` | object | 是 | 字段和夜间完成规则同 HR Day。 |
| `metrics.nightRestRrAverage` | object | 是 | 夜间主指标,含 `value`、`sampleCount`、`baseline`;至少 4 样本才能主判断。 |
| `metrics.allDayRestRrAverage` | object | 否 | 全天辅助指标;至少 8 个同方向样本才可增强结论。 |
| `metrics.hourlyPoints` | array<array<number>> | 否 | 固定 24 项;单小时零到多个有效静息呼吸样本。 |
| `metrics.context` | object | 否 | 环境上下文,只解释已触发结论。 |

RR 的所有基线仅允许 `personal`、`unavailable`。

## Week

```json
{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "rr",
  "viewWindow": "week",
  "locale": "en-US",
  "petProfile": {
    "name": "Pocky",
    "species": "dog"
  },
  "period": {
    "startDate": "2026-07-13",
    "endDate": "2026-07-19",
    "timezone": "Asia/Shanghai",
    "isCompleted": true,
    "elapsedNights": 7,
    "validNights": 6
  },
  "metrics": {
    "nightRestRrAverage": {
      "value": 22,
      "sampleCount": 36,
      "baseline": {
        "baselineLower": 16,
        "baselineUpper": 21,
        "baselineSource": "personal"
      }
    },
    "dailyNightRestRr": [
      {
        "date": "2026-07-13",
        "nightRestRrAverage": 22,
        "sampleCount": 6
      },
      {
        "date": "2026-07-14",
        "nightRestRrAverage": 22,
        "sampleCount": 6
      },
      {
        "date": "2026-07-15",
        "nightRestRrAverage": 22,
        "sampleCount": 6
      },
      {
        "date": "2026-07-16",
        "nightRestRrAverage": 22,
        "sampleCount": 6
      },
      {
        "date": "2026-07-17",
        "nightRestRrAverage": 22,
        "sampleCount": 6
      },
      {
        "date": "2026-07-18",
        "nightRestRrAverage": 22,
        "sampleCount": 6
      },
      {
        "date": "2026-07-19",
        "nightRestRrAverage": null,
        "sampleCount": 0
      }
    ]
  },
  "previousPeriod": {
    "startDate": "2026-07-06",
    "endDate": "2026-07-12",
    "isCompleted": true,
    "validNights": 6,
    "nightRestRrAverage": 20,
    "allDayRestRrAverage": 20,
    "highNightRestRrCount": 0
  }
}
```

| 字段名 | 数据类型 | 必须 | 详细说明 |
|---|---|---:|---|
| `metrics.nightRestRrAverage` | object | 是 | 当前周期夜间平均,字段同 Day。 |
| `metrics.allDayRestRrAverage` | object | 否 | 当前周期全天平均,字段同 Day。 |
| `metrics.dailyNightRestRr` | array<object> | 是 | 固定 7 项,元素为 `date`、`nightRestRrAverage`、`sampleCount`。 |
| `previousPeriod` | object | 否 | 紧邻完整上一周;含日期、有效夜晚、夜间/全天均值和 `highNightRestRrCount`。 |

Week 少于 3 个有效夜晚时不输出周期主判断。

## Month

请求结构与 RR Week 相同;完整自然月、逐夜数组长度和上一周期要求同 HR Month。Month 少于 10 个有效夜晚时不输出周期主判断。

```json
{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "rr",
  "viewWindow": "month",
  "locale": "en-US",
  "petProfile": {
    "name": "Pocky",
    "species": "dog"
  },
  "period": {
    "startDate": "2026-02-01",
    "endDate": "2026-02-28",
    "timezone": "Asia/Shanghai",
    "isCompleted": true,
    "elapsedNights": 28,
    "validNights": 25
  },
  "metrics": {
    "nightRestRrAverage": {
      "value": 20,
      "sampleCount": 150,
      "baseline": {
        "baselineLower": 16,
        "baselineUpper": 21,
        "baselineSource": "personal"
      }
    },
    "dailyNightRestRr": [
      {
        "date": "2026-02-01",
        "nightRestRrAverage": 20,
        "sampleCount": 6
      },
      {
        "date": "2026-02-02",
        "nightRestRrAverage": 20,
        "sampleCount": 6
      },
      {
        "date": "2026-02-03",
        "nightRestRrAverage": 20,
        "sampleCount": 6
      },
      {
        "date": "2026-02-04",
        "nightRestRrAverage": 20,
        "sampleCount": 6
      },
      {
        "date": "2026-02-05",
        "nightRestRrAverage": 20,
        "sampleCount": 6
      },
      {
        "date": "2026-02-06",
        "nightRestRrAverage": 20,
        "sampleCount": 6
      },
      {
        "date": "2026-02-07",
        "nightRestRrAverage": 20,
        "sampleCount": 6
      },
      {
        "date": "2026-02-08",
        "nightRestRrAverage": 20,
        "sampleCount": 6
      },
      {
        "date": "2026-02-09",
        "nightRestRrAverage": 20,
        "sampleCount": 6
      },
      {
        "date": "2026-02-10",
        "nightRestRrAverage": 20,
        "sampleCount": 6
      },
      {
        "date": "2026-02-11",
        "nightRestRrAverage": 20,
        "sampleCount": 6
      },
      {
        "date": "2026-02-12",
        "nightRestRrAverage": 20,
        "sampleCount": 6
      },
      {
        "date": "2026-02-13",
        "nightRestRrAverage": 20,
        "sampleCount": 6
      },
      {
        "date": "2026-02-14",
        "nightRestRrAverage": 20,
        "sampleCount": 6
      },
      {
        "date": "2026-02-15",
        "nightRestRrAverage": 20,
        "sampleCount": 6
      },
      {
        "date": "2026-02-16",
        "nightRestRrAverage": 20,
        "sampleCount": 6
      },
      {
        "date": "2026-02-17",
        "nightRestRrAverage": 20,
        "sampleCount": 6
      },
      {
        "date": "2026-02-18",
        "nightRestRrAverage": 20,
        "sampleCount": 6
      },
      {
        "date": "2026-02-19",
        "nightRestRrAverage": 20,
        "sampleCount": 6
      },
      {
        "date": "2026-02-20",
        "nightRestRrAverage": 20,
        "sampleCount": 6
      },
      {
        "date": "2026-02-21",
        "nightRestRrAverage": 20,
        "sampleCount": 6
      },
      {
        "date": "2026-02-22",
        "nightRestRrAverage": 20,
        "sampleCount": 6
      },
      {
        "date": "2026-02-23",
        "nightRestRrAverage": 20,
        "sampleCount": 6
      },
      {
        "date": "2026-02-24",
        "nightRestRrAverage": 20,
        "sampleCount": 6
      },
      {
        "date": "2026-02-25",
        "nightRestRrAverage": 20,
        "sampleCount": 6
      },
      {
        "date": "2026-02-26",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-02-27",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-02-28",
        "nightRestRrAverage": null,
        "sampleCount": 0
      }
    ]
  }
}
```

# 9. Bark(吠叫状态)

`metric` 固定为 `bark`,时长单位为秒。Bark 基线仅允许 `personal`、`unavailable`。不接收原始音频、声学特征、具体地址、坐标、绝对医学阈值或疾病风险评分。

## Day

```json
{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "bark",
  "viewWindow": "day",
  "locale": "zh-CN",
  "petProfile": {
    "name": "Milo",
    "species": "dog"
  },
  "period": {
    "startDate": "2026-07-23",
    "endDate": "2026-07-23",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "metrics": {
    "wearingMinutes": 960,
    "barkDurationSeconds": 106,
    "barkEventCount": 2,
    "longestBarkEventDurationSeconds": 84,
    "baseline": {
      "baselineLower": 80,
      "baselineUpper": 160,
      "baselineSource": "personal"
    },
    "barkEvents": [
      {
        "startAt": "2026-07-23T18:42:10+08:00",
        "endAt": "2026-07-23T18:42:32+08:00",
        "durationSeconds": 22,
        "intensity": "medium",
        "locationType": "home"
      },
      {
        "startAt": "2026-07-23T20:03:30+08:00",
        "endAt": "2026-07-23T20:04:54+08:00",
        "durationSeconds": 84,
        "intensity": "high",
        "locationType": "home"
      }
    ]
  }
}
```

| 字段名 | 数据类型 | 必须 | 详细说明 |
|---|---|---:|---|
| `metrics.wearingMinutes` | integer | 是 | 唯一覆盖指标,范围 0-1440;少于 720 时只展示已识别事实。 |
| `metrics.barkDurationSeconds` | integer | 是 | 必须等于所有事件 `durationSeconds` 之和。 |
| `metrics.barkEventCount` | integer | 是 | 必须等于 `barkEvents` 长度。 |
| `metrics.longestBarkEventDurationSeconds` | integer | 是 | 必须等于事件最大时长;无事件时为 0。 |
| `metrics.baseline` | Baseline | 是 | 吠叫总时长基线,仅可使用 `personal`、`unavailable`。 |
| `metrics.barkEvents` | array<object> | 是 | 当天事件明细;无事件传空数组。 |
| `metrics.barkEvents[].startAt` / `endAt` | string(date-time) | 是 | 带时区、位于请求 Day 内,且结束晚于开始。 |
| `metrics.barkEvents[].durationSeconds` | integer | 是 | 必须与起止时间差一致。 |
| `metrics.barkEvents[].intensity` | enum | 是 | `low`、`medium`、`high`;由上游识别,Gateway 不按时长推断。 |
| `metrics.barkEvents[].locationType` | enum | 是 | `home`、`outdoor`、`unknown`;不传具体地址或坐标。 |

## Week

```json
{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "bark",
  "viewWindow": "week",
  "locale": "zh-CN",
  "petProfile": {
    "name": "Milo",
    "species": "dog"
  },
  "period": {
    "startDate": "2026-07-13",
    "endDate": "2026-07-19",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "metrics": {
    "wearingMinutes": 5940,
    "averageDailyBarkDurationSeconds": 139.0,
    "barkEventCount": 31,
    "anomalyDayCount": 2,
    "dailyBarkDurations": [
      {
        "date": "2026-07-13",
        "wearingMinutes": 840,
        "barkDurationSeconds": 80,
        "isAnomaly": false
      },
      {
        "date": "2026-07-14",
        "wearingMinutes": 900,
        "barkDurationSeconds": 260,
        "isAnomaly": true
      },
      {
        "date": "2026-07-15",
        "wearingMinutes": 840,
        "barkDurationSeconds": 120,
        "isAnomaly": true
      },
      {
        "date": "2026-07-16",
        "wearingMinutes": 840,
        "barkDurationSeconds": 130,
        "isAnomaly": false
      },
      {
        "date": "2026-07-17",
        "wearingMinutes": 840,
        "barkDurationSeconds": 127,
        "isAnomaly": false
      },
      {
        "date": "2026-07-18",
        "wearingMinutes": 840,
        "barkDurationSeconds": 128,
        "isAnomaly": false
      },
      {
        "date": "2026-07-19",
        "wearingMinutes": 840,
        "barkDurationSeconds": 128,
        "isAnomaly": false
      }
    ]
  },
  "previousPeriod": {
    "startDate": "2026-07-06",
    "endDate": "2026-07-12",
    "isCompleted": true,
    "averageDailyBarkDurationSeconds": 90,
    "barkEventCount": 22,
    "anomalyDayCount": 1
  }
}
```

| 字段名 | 数据类型 | 必须 | 详细说明 |
|---|---|---:|---|
| `metrics.wearingMinutes` | integer | 是 | 当前周总佩戴分钟,仅用于说明;周期判断由逐日佩戴决定。 |
| `metrics.averageDailyBarkDurationSeconds` | number | 是 | 可用逐日时长的日均值。 |
| `metrics.barkEventCount` | integer | 是 | 周期内识别事件总数。 |
| `metrics.anomalyDayCount` | integer | 是 | 必须等于 `isAnomaly=true` 的日期数。 |
| `metrics.dailyBarkDurations` | array<object> | 是 | 固定 7 项,按日期连续排列。元素含 `date`、`wearingMinutes`、`barkDurationSeconds`、`isAnomaly`。 |
| `metrics.dailyBarkDurations[].isAnomaly` | boolean/null | 是 | `true` 表示上游已在佩戴达标且个人基线可用时判为高于上限;`false` 为已判断未偏高;`null` 为不可判断。 |
| `previousPeriod` | object | 否 | 紧邻完整上一周;含日均时长、事件数、异常日数。 |

Week 少于 3 个佩戴至少 720 分钟的日期时返回数据不足。

## Month

请求结构与 Bark Week 相同;必须覆盖完整自然月,`dailyBarkDurations` 长度等于当月天数,`previousPeriod` 是紧邻上一完整月。Month 少于 10 个佩戴至少 720 分钟的日期时返回数据不足。

```json
{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "bark",
  "viewWindow": "month",
  "locale": "en-US",
  "petProfile": {
    "name": "Milo",
    "species": "dog"
  },
  "period": {
    "startDate": "2026-02-01",
    "endDate": "2026-02-28",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "metrics": {
    "wearingMinutes": 23520,
    "averageDailyBarkDurationSeconds": 100,
    "barkEventCount": 140,
    "anomalyDayCount": 0,
    "dailyBarkDurations": [
      {
        "date": "2026-02-01",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      },
      {
        "date": "2026-02-02",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      },
      {
        "date": "2026-02-03",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      },
      {
        "date": "2026-02-04",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      },
      {
        "date": "2026-02-05",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      },
      {
        "date": "2026-02-06",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      },
      {
        "date": "2026-02-07",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      },
      {
        "date": "2026-02-08",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      },
      {
        "date": "2026-02-09",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      },
      {
        "date": "2026-02-10",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      },
      {
        "date": "2026-02-11",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      },
      {
        "date": "2026-02-12",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      },
      {
        "date": "2026-02-13",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      },
      {
        "date": "2026-02-14",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      },
      {
        "date": "2026-02-15",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      },
      {
        "date": "2026-02-16",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      },
      {
        "date": "2026-02-17",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      },
      {
        "date": "2026-02-18",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      },
      {
        "date": "2026-02-19",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      },
      {
        "date": "2026-02-20",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      },
      {
        "date": "2026-02-21",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      },
      {
        "date": "2026-02-22",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      },
      {
        "date": "2026-02-23",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      },
      {
        "date": "2026-02-24",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      },
      {
        "date": "2026-02-25",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      },
      {
        "date": "2026-02-26",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      },
      {
        "date": "2026-02-27",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      },
      {
        "date": "2026-02-28",
        "wearingMinutes": 840,
        "barkDurationSeconds": 100,
        "isAnomaly": false
      }
    ]
  },
  "previousPeriod": {
    "startDate": "2026-01-01",
    "endDate": "2026-01-31",
    "isCompleted": true,
    "averageDailyBarkDurationSeconds": 96,
    "barkEventCount": 104,
    "anomalyDayCount": 1
  }
}
```

## 10. 主服务调用检查清单

1. 所有请求使用 `health-detail-v3`。
2. 主服务按 `period.timezone` 切分本地自然日、自然周和自然月。
3. 固定长度数组按日期升序补齐;文档中的请求 JSON 示例必须可直接通过本契约校验。
4. 统计值、计数和最长值必须从同一批事实聚合并满足文中相等关系。
5. 没有数据时按字段要求传 `null`,不能以 0 伪造缺失数据。
6. 基线不可用时使用 `unavailable` 和两个 `null` 边界。
7. `previousPeriod` 只能是根级、紧邻、同类型且已完成的上一周期;缺失时只跳过环比规则。
8. 收到 `422` 时按 `details[].loc` 修复调用方字段或聚合,不应对同一非法请求重试。
健康指标
时间窗口

Activity Day

接口简介

Activity day request and response contract.

请求示例 JSON

{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "activity",
  "viewWindow": "day",
  "locale": "zh-CN",
  "petProfile": {
    "name": "Pocky",
    "species": "dog",
    "healthRiskTags": []
  },
  "period": {
    "startDate": "2026-07-21",
    "endDate": "2026-07-21",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "metrics": {
    "wearingMinutes": 1440,
    "activityTime": {
      "activityMinutes": 60,
      "baseline": {
        "baselineLower": 40,
        "baselineUpper": 80,
        "baselineSource": "personal"
      },
      "hourlyActivityMinutes": [60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    }
  }
}

请求字段表

字段名数据类型是否必需详细说明
schemaVersionstringFixed to health-detail-v3.
userIdstringCaller user ID.
petIdstringCaller pet ID.
metricenumMetric selector.
viewWindowenumView window selector.
localeenumSummary locale.
petProfileobjectPet profile.
petProfile.namestringDisplay name.
petProfile.speciesenumPet species.
petProfile.activityToleranceenum|nullActivity tolerance.
petProfile.heatToleranceenum|nullHeat tolerance.
petProfile.coldToleranceenum|nullCold tolerance.
petProfile.humidHeatSensitivityenum|nullHumid heat sensitivity.
petProfile.healthRiskTagsarray<enum>Known risk tags.
periodobjectRequested period.
period.startDatestring(date)Day requires the same start and end date.
period.endDatestring(date)Day requires the same start and end date.
period.timezonestringIANA timezone, for example Asia/Shanghai.
period.isCompletedbooleanWhether the current period is complete.
period.elapsedNightsinteger|nullElapsed nights for aggregate sleep/vital windows.
period.validNightsinteger|nullValid nights for aggregate sleep/vital windows.
metricsobjectMetric facts for the selected surface.
metrics.wearingMinutesintegerDaily wearing minutes.
metrics.activityTimeobjectActivity summary.
metrics.activityTime.activityMinutesintegerDaily activity minutes.
metrics.activityTime.baselineobjectActivity baseline baseline.
metrics.activityTime.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.activityTime.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.activityTime.baseline.baselineSourceenumBaseline source.
metrics.activityTime.hourlyActivityMinutesarray<integer|null>24 hourly activity values.
metrics.stepsobjectOptional step summary.
metrics.steps.stepsintegerDaily steps.
metrics.steps.baselineobjectSteps baseline baseline.
metrics.steps.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.steps.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.steps.baseline.baselineSourceenumBaseline source.
metrics.outingsobjectOptional outing facts.
metrics.outings.countintegerOuting count.
metrics.outings.totalDurationMinutesintegerTotal outing duration.
metrics.outings.itemsarray<object>Outing items.
metrics.outings.items[].startAtstring(date-time)Outing start time.
metrics.outings.items[].endAtstring(date-time)Outing end time.
metrics.outings.items[].durationMinutesintegerOuting duration minutes.
metrics.contextobjectOptional environment context.
metrics.context.weatherenumWeather code.
metrics.context.tempMaxCnumberMax temperature in Celsius.
metrics.context.feelsLikeMaxCnumberMax feels-like temperature in Celsius.
metrics.context.temperatureCelsiusnumberObserved temperature in Celsius.
metrics.context.humidityPctnumberHumidity percentage.

请求字段规则

  • 不符合:Day window must use the same start and end date.修正:Match the published window definition.
  • 不符合:Numeric counts and durations must be non-negative.修正:Send zero or a positive number.
  • 不符合:hourlyActivityMinutes must sum to activityMinutes.修正:Adjust the hourly buckets so the total matches.
  • 不符合:Outing total duration must equal the sum of item durations.修正:Keep the total and items in sync.

返回示例 JSON

{
  "insightId": "health_detail_01J",
  "petId": "pet-1",
  "metric": "activity",
  "viewWindow": "day",
  "period": {
    "startDate": "2026-07-21",
    "endDate": "2026-07-21",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "status": "normal",
  "severity": "none",
  "summary": "Metric is stable.",
  "generation": {
    "ruleId": "DOCUMENTATION_EXAMPLE",
    "ruleVersion": "health-detail-v3",
    "generatedAt": "2026-07-23T10:00:00Z",
    "aiPolished": false
  }
}

返回字段描述

字段名数据类型是否必需详细说明
insightIdstringGateway insight ID.
petIdstringEchoed pet ID.
metricenumEchoed metric.
viewWindowenumEchoed window.
periodobjectNormalized request period.
statusenumPrimary status.
severityenumPrimary severity.
summarystringLocalized summary.
generationobjectGeneration metadata.

Activity Week

接口简介

Activity week request and response contract.

请求示例 JSON

{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "activity",
  "viewWindow": "week",
  "locale": "zh-CN",
  "petProfile": {
    "name": "Pocky",
    "species": "dog",
    "healthRiskTags": []
  },
  "period": {
    "startDate": "2026-07-13",
    "endDate": "2026-07-19",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "metrics": {
    "wearingMinutesByDay": [1440, 1440, 1440, 1440, 1440, 1440, 1440],
    "activityTime": {
      "averageDailyActivityMinutes": 60,
      "baseline": {
        "baselineLower": 40,
        "baselineUpper": 80,
        "baselineSource": "personal"
      },
      "dailyActivityMinutes": [60, 60, 60, 60, 60, 60, 60]
    }
  }
}

请求字段表

字段名数据类型是否必需详细说明
schemaVersionstringFixed to health-detail-v3.
userIdstringCaller user ID.
petIdstringCaller pet ID.
metricenumMetric selector.
viewWindowenumView window selector.
localeenumSummary locale.
petProfileobjectPet profile.
petProfile.namestringDisplay name.
petProfile.speciesenumPet species.
petProfile.activityToleranceenum|nullActivity tolerance.
petProfile.heatToleranceenum|nullHeat tolerance.
petProfile.coldToleranceenum|nullCold tolerance.
petProfile.humidHeatSensitivityenum|nullHumid heat sensitivity.
petProfile.healthRiskTagsarray<enum>Known risk tags.
periodobjectRequested period.
period.startDatestring(date)Week requires seven consecutive calendar days.
period.endDatestring(date)Week requires seven consecutive calendar days.
period.timezonestringIANA timezone, for example Asia/Shanghai.
period.isCompletedbooleanWhether the current period is complete.
period.elapsedNightsinteger|nullElapsed nights for aggregate sleep/vital windows.
period.validNightsinteger|nullValid nights for aggregate sleep/vital windows.
metricsobjectMetric facts for the selected surface.
previousPeriodobjectOptional adjacent previous period facts.
previousPeriod.startDatestring(date)Previous period start date.
previousPeriod.endDatestring(date)Previous period end date.
previousPeriod.isCompletedbooleanMust be true.
previousPeriod.averageDailyActivityMinutesnumberPrevious average daily activity minutes.
previousPeriod.averageDailyStepsnumberPrevious average daily steps.
metrics.wearingMinutesByDayarray<integer|null>Per-day wearing minutes.
metrics.activityTimeobjectAverage activity summary.
metrics.activityTime.averageDailyActivityMinutesnumberAverage daily activity minutes.
metrics.activityTime.baselineobjectActivity baseline baseline.
metrics.activityTime.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.activityTime.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.activityTime.baseline.baselineSourceenumBaseline source.
metrics.activityTime.dailyActivityMinutesarray<integer|null>Daily activity minutes aligned to calendar order.
metrics.stepsobjectOptional step summary.
metrics.steps.averageDailyStepsnumberAverage daily steps.
metrics.steps.baselineobjectSteps baseline baseline.
metrics.steps.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.steps.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.steps.baseline.baselineSourceenumBaseline source.
metrics.steps.dailyStepsarray<integer|null>Daily steps aligned to calendar order.
metrics.dailyOutingsarray<object>Optional daily outing rows.
metrics.dailyOutings[].datestring(date)Calendar date.
metrics.dailyOutings[].countintegerOuting count.
metrics.dailyOutings[].totalDurationMinutesintegerOuting duration.
metrics.dailyWeatherarray<object>Optional daily weather rows.
metrics.dailyWeather[].datestring(date)Calendar date.
metrics.dailyWeather[].weatherenumWeather code.
metrics.dailyWeather[].tempMaxCnumberMax temperature.
metrics.dailyWeather[].feelsLikeMaxCnumberMax feels-like temperature.
metrics.dailyWeather[].temperatureCelsiusnumberObserved temperature.
metrics.dailyWeather[].humidityPctnumberHumidity percentage.

请求字段规则

  • 不符合:Week window must cover seven consecutive days.修正:Match the published window definition.
  • 不符合:Numeric counts and durations must be non-negative.修正:Send zero or a positive number.
  • 不符合:Aggregate daily arrays must align to the requested calendar length.修正:Provide one row per calendar day in order.
  • 不符合:previousPeriod must be adjacent and complete.修正:Use the complete period immediately before the current one.

返回示例 JSON

{
  "insightId": "health_detail_01J",
  "petId": "pet-1",
  "metric": "activity",
  "viewWindow": "week",
  "period": {
    "startDate": "2026-07-13",
    "endDate": "2026-07-19",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "status": "normal",
  "severity": "none",
  "summary": "Metric is stable.",
  "generation": {
    "ruleId": "DOCUMENTATION_EXAMPLE",
    "ruleVersion": "health-detail-v3",
    "generatedAt": "2026-07-23T10:00:00Z",
    "aiPolished": false
  }
}

返回字段描述

字段名数据类型是否必需详细说明
insightIdstringGateway insight ID.
petIdstringEchoed pet ID.
metricenumEchoed metric.
viewWindowenumEchoed window.
periodobjectNormalized request period.
statusenumPrimary status.
severityenumPrimary severity.
summarystringLocalized summary.
generationobjectGeneration metadata.

Activity Month

接口简介

Activity month request and response contract.

请求示例 JSON

{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "activity",
  "viewWindow": "month",
  "locale": "zh-CN",
  "petProfile": {
    "name": "Pocky",
    "species": "dog",
    "healthRiskTags": []
  },
  "period": {
    "startDate": "2026-07-01",
    "endDate": "2026-07-31",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "metrics": {
    "wearingMinutesByDay": [1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440],
    "activityTime": {
      "averageDailyActivityMinutes": 60,
      "baseline": {
        "baselineLower": 40,
        "baselineUpper": 80,
        "baselineSource": "personal"
      },
      "dailyActivityMinutes": [60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60]
    }
  }
}

请求字段表

字段名数据类型是否必需详细说明
schemaVersionstringFixed to health-detail-v3.
userIdstringCaller user ID.
petIdstringCaller pet ID.
metricenumMetric selector.
viewWindowenumView window selector.
localeenumSummary locale.
petProfileobjectPet profile.
petProfile.namestringDisplay name.
petProfile.speciesenumPet species.
petProfile.activityToleranceenum|nullActivity tolerance.
petProfile.heatToleranceenum|nullHeat tolerance.
petProfile.coldToleranceenum|nullCold tolerance.
petProfile.humidHeatSensitivityenum|nullHumid heat sensitivity.
petProfile.healthRiskTagsarray<enum>Known risk tags.
periodobjectRequested period.
period.startDatestring(date)Month requires one complete natural month.
period.endDatestring(date)Month requires one complete natural month.
period.timezonestringIANA timezone, for example Asia/Shanghai.
period.isCompletedbooleanWhether the current period is complete.
period.elapsedNightsinteger|nullElapsed nights for aggregate sleep/vital windows.
period.validNightsinteger|nullValid nights for aggregate sleep/vital windows.
metricsobjectMetric facts for the selected surface.
previousPeriodobjectOptional adjacent previous period facts.
previousPeriod.startDatestring(date)Previous period start date.
previousPeriod.endDatestring(date)Previous period end date.
previousPeriod.isCompletedbooleanMust be true.
previousPeriod.averageDailyActivityMinutesnumberPrevious average daily activity minutes.
previousPeriod.averageDailyStepsnumberPrevious average daily steps.
metrics.wearingMinutesByDayarray<integer|null>Per-day wearing minutes.
metrics.activityTimeobjectAverage activity summary.
metrics.activityTime.averageDailyActivityMinutesnumberAverage daily activity minutes.
metrics.activityTime.baselineobjectActivity baseline baseline.
metrics.activityTime.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.activityTime.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.activityTime.baseline.baselineSourceenumBaseline source.
metrics.activityTime.dailyActivityMinutesarray<integer|null>Daily activity minutes aligned to calendar order.
metrics.stepsobjectOptional step summary.
metrics.steps.averageDailyStepsnumberAverage daily steps.
metrics.steps.baselineobjectSteps baseline baseline.
metrics.steps.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.steps.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.steps.baseline.baselineSourceenumBaseline source.
metrics.steps.dailyStepsarray<integer|null>Daily steps aligned to calendar order.
metrics.dailyOutingsarray<object>Optional daily outing rows.
metrics.dailyOutings[].datestring(date)Calendar date.
metrics.dailyOutings[].countintegerOuting count.
metrics.dailyOutings[].totalDurationMinutesintegerOuting duration.
metrics.dailyWeatherarray<object>Optional daily weather rows.
metrics.dailyWeather[].datestring(date)Calendar date.
metrics.dailyWeather[].weatherenumWeather code.
metrics.dailyWeather[].tempMaxCnumberMax temperature.
metrics.dailyWeather[].feelsLikeMaxCnumberMax feels-like temperature.
metrics.dailyWeather[].temperatureCelsiusnumberObserved temperature.
metrics.dailyWeather[].humidityPctnumberHumidity percentage.

请求字段规则

  • 不符合:Month window must cover one natural month.修正:Match the published window definition.
  • 不符合:Numeric counts and durations must be non-negative.修正:Send zero or a positive number.
  • 不符合:Aggregate daily arrays must align to the requested calendar length.修正:Provide one row per calendar day in order.
  • 不符合:previousPeriod must be adjacent and complete.修正:Use the complete period immediately before the current one.

返回示例 JSON

{
  "insightId": "health_detail_01J",
  "petId": "pet-1",
  "metric": "activity",
  "viewWindow": "month",
  "period": {
    "startDate": "2026-07-01",
    "endDate": "2026-07-31",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "status": "normal",
  "severity": "none",
  "summary": "Metric is stable.",
  "generation": {
    "ruleId": "DOCUMENTATION_EXAMPLE",
    "ruleVersion": "health-detail-v3",
    "generatedAt": "2026-07-23T10:00:00Z",
    "aiPolished": false
  }
}

返回字段描述

字段名数据类型是否必需详细说明
insightIdstringGateway insight ID.
petIdstringEchoed pet ID.
metricenumEchoed metric.
viewWindowenumEchoed window.
periodobjectNormalized request period.
statusenumPrimary status.
severityenumPrimary severity.
summarystringLocalized summary.
generationobjectGeneration metadata.

Rest Day

接口简介

Rest day request and response contract.

请求示例 JSON

{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "rest",
  "viewWindow": "day",
  "locale": "zh-CN",
  "petProfile": {
    "name": "Pocky",
    "species": "dog",
    "healthRiskTags": []
  },
  "period": {
    "startDate": "2026-07-21",
    "endDate": "2026-07-21",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "metrics": {
    "night": {
      "startAt": "2026-07-20T22:00:00+08:00",
      "endAt": "2026-07-21T08:00:00+08:00",
      "isCompleted": true,
      "wearingMinutes": 600,
      "nightRest": {
        "minutes": 500,
        "baseline": {
          "baselineLower": 420,
          "baselineUpper": 560,
          "baselineSource": "personal"
        }
      },
      "interruptions": {
        "count": 2,
        "baseline": {
          "baselineLower": 0,
          "baselineUpper": 3,
          "baselineSource": "personal"
        }
      },
      "longestRestBlockMinutes": 180,
      "nightActivity": {
        "minutes": 20,
        "baseline": {
          "baselineLower": 0,
          "baselineUpper": 30,
          "baselineSource": "personal"
        }
      },
      "restSegments": [
        {
          "startAt": "2026-07-20T22:00:00+08:00",
          "endAt": "2026-07-21T06:20:00+08:00",
          "durationMinutes": 500,
          "type": "deepRest"
        }
      ]
    },
    "day": {
      "wearingMinutes": 1440,
      "hourlyRestMinutes": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
      "dayRestBaseline": {
        "baselineLower": 0,
        "baselineUpper": 90,
        "baselineSource": "personal"
      }
    }
  }
}

请求字段表

字段名数据类型是否必需详细说明
schemaVersionstringFixed to health-detail-v3.
userIdstringCaller user ID.
petIdstringCaller pet ID.
metricenumMetric selector.
viewWindowenumView window selector.
localeenumSummary locale.
petProfileobjectPet profile.
petProfile.namestringDisplay name.
petProfile.speciesenumPet species.
petProfile.activityToleranceenum|nullActivity tolerance.
petProfile.heatToleranceenum|nullHeat tolerance.
petProfile.coldToleranceenum|nullCold tolerance.
petProfile.humidHeatSensitivityenum|nullHumid heat sensitivity.
petProfile.healthRiskTagsarray<enum>Known risk tags.
periodobjectRequested period.
period.startDatestring(date)Day requires the same start and end date.
period.endDatestring(date)Day requires the same start and end date.
period.timezonestringIANA timezone, for example Asia/Shanghai.
period.isCompletedbooleanWhether the current period is complete.
period.elapsedNightsinteger|nullElapsed nights for aggregate sleep/vital windows.
period.validNightsinteger|nullValid nights for aggregate sleep/vital windows.
metricsobjectMetric facts for the selected surface.
metrics.nightobjectNight segment.
metrics.night.startAtstring(date-time)Night start.
metrics.night.endAtstring(date-time)Night end.
metrics.night.isCompletedbooleanWhether night collection is complete.
metrics.night.wearingMinutesintegerNight wearing minutes.
metrics.night.nightRestobjectNight rest fact.
metrics.night.nightRest.minutesintegerNight rest minutes.
metrics.night.nightRest.baselineobjectNight rest baseline baseline.
metrics.night.nightRest.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.night.nightRest.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.night.nightRest.baseline.baselineSourceenumBaseline source.
metrics.night.interruptionsobjectNight interruptions.
metrics.night.interruptions.countintegerInterruption count.
metrics.night.interruptions.baselineobjectInterruption baseline baseline.
metrics.night.interruptions.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.night.interruptions.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.night.interruptions.baseline.baselineSourceenumBaseline source.
metrics.night.longestRestBlockMinutesintegerLongest rest block minutes.
metrics.night.nightActivityobjectNight activity.
metrics.night.nightActivity.minutesintegerNight activity minutes.
metrics.night.nightActivity.baselineobjectNight activity baseline baseline.
metrics.night.nightActivity.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.night.nightActivity.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.night.nightActivity.baseline.baselineSourceenumBaseline source.
metrics.night.restSegmentsarray<object>Night rest segments.
metrics.night.restSegments[].startAtstring(date-time)Segment start.
metrics.night.restSegments[].endAtstring(date-time)Segment end.
metrics.night.restSegments[].durationMinutesintegerSegment duration.
metrics.night.restSegments[].typeenumSegment type.
metrics.dayobjectDay segment.
metrics.day.wearingMinutesintegerDay wearing minutes.
metrics.day.hourlyRestMinutesarray<integer|null>24 hourly rest values.
metrics.day.dayRestBaselineobjectDay rest baseline baseline.
metrics.day.dayRestBaseline.baselineLowernumber|nullBaseline lower bound.
metrics.day.dayRestBaseline.baselineUppernumber|nullBaseline upper bound.
metrics.day.dayRestBaseline.baselineSourceenumBaseline source.

请求字段规则

  • 不符合:Day window must use the same start and end date.修正:Match the published window definition.
  • 不符合:Numeric counts and durations must be non-negative.修正:Send zero or a positive number.

返回示例 JSON

{
  "insightId": "health_detail_01J",
  "petId": "pet-1",
  "metric": "rest",
  "viewWindow": "day",
  "period": {
    "startDate": "2026-07-21",
    "endDate": "2026-07-21",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "status": "normal",
  "severity": "none",
  "summary": "Metric is stable.",
  "generation": {
    "ruleId": "DOCUMENTATION_EXAMPLE",
    "ruleVersion": "health-detail-v3",
    "generatedAt": "2026-07-23T10:00:00Z",
    "aiPolished": false
  }
}

返回字段描述

字段名数据类型是否必需详细说明
insightIdstringGateway insight ID.
petIdstringEchoed pet ID.
metricenumEchoed metric.
viewWindowenumEchoed window.
periodobjectNormalized request period.
statusenumPrimary status.
severityenumPrimary severity.
summarystringLocalized summary.
generationobjectGeneration metadata.

Rest Week

接口简介

Rest week request and response contract.

请求示例 JSON

{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "rest",
  "viewWindow": "week",
  "locale": "zh-CN",
  "petProfile": {
    "name": "Pocky",
    "species": "dog",
    "healthRiskTags": []
  },
  "period": {
    "startDate": "2026-07-13",
    "endDate": "2026-07-19",
    "timezone": "Asia/Shanghai",
    "isCompleted": true,
    "elapsedNights": 7,
    "validNights": 1
  },
  "metrics": {
    "nightRest": {
      "averageMinutes": 500,
      "baseline": {
        "baselineLower": 420,
        "baselineUpper": 560,
        "baselineSource": "personal"
      }
    },
    "interruptions": {
      "averageCount": 2,
      "baseline": {
        "baselineLower": 0,
        "baselineUpper": 3,
        "baselineSource": "personal"
      }
    },
    "nightActivity": {
      "averageMinutes": 20,
      "baseline": {
        "baselineLower": 0,
        "baselineUpper": 30,
        "baselineSource": "personal"
      }
    },
    "dayRest": {
      "averageMinutes": 30,
      "baseline": {
        "baselineLower": 0,
        "baselineUpper": 90,
        "baselineSource": "personal"
      }
    },
    "anomalyNights": {
      "lowNightRestCount": 0,
      "highInterruptionCount": 0,
      "highNightActivityCount": 0
    },
    "nightlyRestDurations": [
      {
        "nightDate": "2026-07-13",
        "lightMovementMinutes": 20,
        "deepRestMinutes": 480
      },
      {
        "nightDate": "2026-07-14",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-15",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-16",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-17",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-18",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-19",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      }
    ]
  }
}

请求字段表

字段名数据类型是否必需详细说明
schemaVersionstringFixed to health-detail-v3.
userIdstringCaller user ID.
petIdstringCaller pet ID.
metricenumMetric selector.
viewWindowenumView window selector.
localeenumSummary locale.
petProfileobjectPet profile.
petProfile.namestringDisplay name.
petProfile.speciesenumPet species.
petProfile.activityToleranceenum|nullActivity tolerance.
petProfile.heatToleranceenum|nullHeat tolerance.
petProfile.coldToleranceenum|nullCold tolerance.
petProfile.humidHeatSensitivityenum|nullHumid heat sensitivity.
petProfile.healthRiskTagsarray<enum>Known risk tags.
periodobjectRequested period.
period.startDatestring(date)Week requires seven consecutive calendar days.
period.endDatestring(date)Week requires seven consecutive calendar days.
period.timezonestringIANA timezone, for example Asia/Shanghai.
period.isCompletedbooleanWhether the current period is complete.
period.elapsedNightsintegerElapsed nights for aggregate sleep/vital windows.
period.validNightsintegerValid nights for aggregate sleep/vital windows.
metricsobjectMetric facts for the selected surface.
previousPeriodobjectOptional adjacent previous period facts.
previousPeriod.startDatestring(date)Previous period start date.
previousPeriod.endDatestring(date)Previous period end date.
previousPeriod.isCompletedbooleanMust be true.
previousPeriod.validNightsintegerPrevious valid nights.
previousPeriod.nightRestAverageMinutesnumberPrevious night-rest average minutes.
previousPeriod.interruptionsAverageCountnumberPrevious interruption average count.
previousPeriod.nightActivityAverageMinutesnumberPrevious night-activity average minutes.
previousPeriod.dayRestAverageMinutesnumberPrevious day-rest average minutes.
previousPeriod.lowNightRestCountintegerPrevious low-night-rest count.
previousPeriod.highInterruptionCountintegerPrevious high-interruption count.
previousPeriod.highNightActivityCountintegerPrevious high-night-activity count.
metrics.nightRestobjectNight rest average.
metrics.nightRest.averageMinutesnumberNight rest average value.
metrics.nightRest.baselineobjectNight rest baseline baseline.
metrics.nightRest.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.nightRest.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.nightRest.baseline.baselineSourceenumBaseline source.
metrics.interruptionsobjectInterruptions average.
metrics.interruptions.averageCountnumberInterruptions average value.
metrics.interruptions.baselineobjectInterruptions baseline baseline.
metrics.interruptions.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.interruptions.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.interruptions.baseline.baselineSourceenumBaseline source.
metrics.nightActivityobjectNight activity average.
metrics.nightActivity.averageMinutesnumberNight activity average value.
metrics.nightActivity.baselineobjectNight activity baseline baseline.
metrics.nightActivity.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.nightActivity.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.nightActivity.baseline.baselineSourceenumBaseline source.
metrics.dayRestobjectDay rest average.
metrics.dayRest.averageMinutesnumberDay rest average value.
metrics.dayRest.baselineobjectDay rest baseline baseline.
metrics.dayRest.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.dayRest.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.dayRest.baseline.baselineSourceenumBaseline source.
metrics.anomalyNightsobjectNight anomaly counters.
metrics.anomalyNights.lowNightRestCountintegerLow night-rest count.
metrics.anomalyNights.highInterruptionCountintegerHigh interruption count.
metrics.anomalyNights.highNightActivityCountintegerHigh night-activity count.
metrics.nightlyRestDurationsarray<object>Nightly rest rows.
metrics.nightlyRestDurations[].nightDatestring(date)Night date.
metrics.nightlyRestDurations[].lightMovementMinutesinteger|nullLight movement minutes.
metrics.nightlyRestDurations[].deepRestMinutesinteger|nullDeep rest minutes.

请求字段规则

  • 不符合:Week window must cover seven consecutive days.修正:Match the published window definition.
  • 不符合:Numeric counts and durations must be non-negative.修正:Send zero or a positive number.
  • 不符合:Aggregate daily arrays must align to the requested calendar length.修正:Provide one row per calendar day in order.
  • 不符合:previousPeriod must be adjacent and complete.修正:Use the complete period immediately before the current one.

返回示例 JSON

{
  "insightId": "health_detail_01J",
  "petId": "pet-1",
  "metric": "rest",
  "viewWindow": "week",
  "period": {
    "startDate": "2026-07-13",
    "endDate": "2026-07-19",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "status": "normal",
  "severity": "none",
  "summary": "Metric is stable.",
  "generation": {
    "ruleId": "DOCUMENTATION_EXAMPLE",
    "ruleVersion": "health-detail-v3",
    "generatedAt": "2026-07-23T10:00:00Z",
    "aiPolished": false
  }
}

返回字段描述

字段名数据类型是否必需详细说明
insightIdstringGateway insight ID.
petIdstringEchoed pet ID.
metricenumEchoed metric.
viewWindowenumEchoed window.
periodobjectNormalized request period.
statusenumPrimary status.
severityenumPrimary severity.
summarystringLocalized summary.
generationobjectGeneration metadata.

Rest Month

接口简介

Rest month request and response contract.

请求示例 JSON

{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "rest",
  "viewWindow": "month",
  "locale": "zh-CN",
  "petProfile": {
    "name": "Pocky",
    "species": "dog",
    "healthRiskTags": []
  },
  "period": {
    "startDate": "2026-07-01",
    "endDate": "2026-07-31",
    "timezone": "Asia/Shanghai",
    "isCompleted": true,
    "elapsedNights": 31,
    "validNights": 1
  },
  "metrics": {
    "nightRest": {
      "averageMinutes": 500,
      "baseline": {
        "baselineLower": 420,
        "baselineUpper": 560,
        "baselineSource": "personal"
      }
    },
    "interruptions": {
      "averageCount": 2,
      "baseline": {
        "baselineLower": 0,
        "baselineUpper": 3,
        "baselineSource": "personal"
      }
    },
    "nightActivity": {
      "averageMinutes": 20,
      "baseline": {
        "baselineLower": 0,
        "baselineUpper": 30,
        "baselineSource": "personal"
      }
    },
    "dayRest": {
      "averageMinutes": 30,
      "baseline": {
        "baselineLower": 0,
        "baselineUpper": 90,
        "baselineSource": "personal"
      }
    },
    "anomalyNights": {
      "lowNightRestCount": 0,
      "highInterruptionCount": 0,
      "highNightActivityCount": 0
    },
    "nightlyRestDurations": [
      {
        "nightDate": "2026-07-01",
        "lightMovementMinutes": 20,
        "deepRestMinutes": 480
      },
      {
        "nightDate": "2026-07-02",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-03",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-04",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-05",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-06",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-07",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-08",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-09",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-10",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-11",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-12",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-13",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-14",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-15",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-16",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-17",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-18",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-19",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-20",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-21",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-22",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-23",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-24",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-25",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-26",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-27",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-28",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-29",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-30",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      },
      {
        "nightDate": "2026-07-31",
        "lightMovementMinutes": null,
        "deepRestMinutes": null
      }
    ]
  }
}

请求字段表

字段名数据类型是否必需详细说明
schemaVersionstringFixed to health-detail-v3.
userIdstringCaller user ID.
petIdstringCaller pet ID.
metricenumMetric selector.
viewWindowenumView window selector.
localeenumSummary locale.
petProfileobjectPet profile.
petProfile.namestringDisplay name.
petProfile.speciesenumPet species.
petProfile.activityToleranceenum|nullActivity tolerance.
petProfile.heatToleranceenum|nullHeat tolerance.
petProfile.coldToleranceenum|nullCold tolerance.
petProfile.humidHeatSensitivityenum|nullHumid heat sensitivity.
petProfile.healthRiskTagsarray<enum>Known risk tags.
periodobjectRequested period.
period.startDatestring(date)Month requires one complete natural month.
period.endDatestring(date)Month requires one complete natural month.
period.timezonestringIANA timezone, for example Asia/Shanghai.
period.isCompletedbooleanWhether the current period is complete.
period.elapsedNightsintegerElapsed nights for aggregate sleep/vital windows.
period.validNightsintegerValid nights for aggregate sleep/vital windows.
metricsobjectMetric facts for the selected surface.
previousPeriodobjectOptional adjacent previous period facts.
previousPeriod.startDatestring(date)Previous period start date.
previousPeriod.endDatestring(date)Previous period end date.
previousPeriod.isCompletedbooleanMust be true.
previousPeriod.validNightsintegerPrevious valid nights.
previousPeriod.nightRestAverageMinutesnumberPrevious night-rest average minutes.
previousPeriod.interruptionsAverageCountnumberPrevious interruption average count.
previousPeriod.nightActivityAverageMinutesnumberPrevious night-activity average minutes.
previousPeriod.dayRestAverageMinutesnumberPrevious day-rest average minutes.
previousPeriod.lowNightRestCountintegerPrevious low-night-rest count.
previousPeriod.highInterruptionCountintegerPrevious high-interruption count.
previousPeriod.highNightActivityCountintegerPrevious high-night-activity count.
metrics.nightRestobjectNight rest average.
metrics.nightRest.averageMinutesnumberNight rest average value.
metrics.nightRest.baselineobjectNight rest baseline baseline.
metrics.nightRest.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.nightRest.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.nightRest.baseline.baselineSourceenumBaseline source.
metrics.interruptionsobjectInterruptions average.
metrics.interruptions.averageCountnumberInterruptions average value.
metrics.interruptions.baselineobjectInterruptions baseline baseline.
metrics.interruptions.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.interruptions.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.interruptions.baseline.baselineSourceenumBaseline source.
metrics.nightActivityobjectNight activity average.
metrics.nightActivity.averageMinutesnumberNight activity average value.
metrics.nightActivity.baselineobjectNight activity baseline baseline.
metrics.nightActivity.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.nightActivity.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.nightActivity.baseline.baselineSourceenumBaseline source.
metrics.dayRestobjectDay rest average.
metrics.dayRest.averageMinutesnumberDay rest average value.
metrics.dayRest.baselineobjectDay rest baseline baseline.
metrics.dayRest.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.dayRest.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.dayRest.baseline.baselineSourceenumBaseline source.
metrics.anomalyNightsobjectNight anomaly counters.
metrics.anomalyNights.lowNightRestCountintegerLow night-rest count.
metrics.anomalyNights.highInterruptionCountintegerHigh interruption count.
metrics.anomalyNights.highNightActivityCountintegerHigh night-activity count.
metrics.nightlyRestDurationsarray<object>Nightly rest rows.
metrics.nightlyRestDurations[].nightDatestring(date)Night date.
metrics.nightlyRestDurations[].lightMovementMinutesinteger|nullLight movement minutes.
metrics.nightlyRestDurations[].deepRestMinutesinteger|nullDeep rest minutes.

请求字段规则

  • 不符合:Month window must cover one natural month.修正:Match the published window definition.
  • 不符合:Numeric counts and durations must be non-negative.修正:Send zero or a positive number.
  • 不符合:Aggregate daily arrays must align to the requested calendar length.修正:Provide one row per calendar day in order.
  • 不符合:previousPeriod must be adjacent and complete.修正:Use the complete period immediately before the current one.

返回示例 JSON

{
  "insightId": "health_detail_01J",
  "petId": "pet-1",
  "metric": "rest",
  "viewWindow": "month",
  "period": {
    "startDate": "2026-07-01",
    "endDate": "2026-07-31",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "status": "normal",
  "severity": "none",
  "summary": "Metric is stable.",
  "generation": {
    "ruleId": "DOCUMENTATION_EXAMPLE",
    "ruleVersion": "health-detail-v3",
    "generatedAt": "2026-07-23T10:00:00Z",
    "aiPolished": false
  }
}

返回字段描述

字段名数据类型是否必需详细说明
insightIdstringGateway insight ID.
petIdstringEchoed pet ID.
metricenumEchoed metric.
viewWindowenumEchoed window.
periodobjectNormalized request period.
statusenumPrimary status.
severityenumPrimary severity.
summarystringLocalized summary.
generationobjectGeneration metadata.

HR Day

接口简介

HR day request and response contract.

请求示例 JSON

{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "hr",
  "viewWindow": "day",
  "locale": "zh-CN",
  "petProfile": {
    "name": "Pocky",
    "species": "dog",
    "healthRiskTags": []
  },
  "period": {
    "startDate": "2026-07-21",
    "endDate": "2026-07-21",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "metrics": {
    "night": {
      "startAt": "2026-07-20T22:00:00+08:00",
      "endAt": "2026-07-21T08:00:00+08:00",
      "isCompleted": true
    },
    "nightRestHrAverage": {
      "value": 82,
      "sampleCount": 8,
      "baseline": {
        "baselineLower": 72,
        "baselineUpper": 92,
        "baselineSource": "personal"
      }
    },
    "allDayRestHrAverage": {
      "value": 82,
      "sampleCount": 8,
      "baseline": {
        "baselineLower": 72,
        "baselineUpper": 92,
        "baselineSource": "personal"
      }
    },
    "hourlyPoints": [
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      []
    ]
  }
}

请求字段表

字段名数据类型是否必需详细说明
schemaVersionstringFixed to health-detail-v3.
userIdstringCaller user ID.
petIdstringCaller pet ID.
metricenumMetric selector.
viewWindowenumView window selector.
localeenumSummary locale.
petProfileobjectPet profile.
petProfile.namestringDisplay name.
petProfile.speciesenumPet species.
petProfile.activityToleranceenum|nullActivity tolerance.
petProfile.heatToleranceenum|nullHeat tolerance.
petProfile.coldToleranceenum|nullCold tolerance.
petProfile.humidHeatSensitivityenum|nullHumid heat sensitivity.
petProfile.healthRiskTagsarray<enum>Known risk tags.
periodobjectRequested period.
period.startDatestring(date)Day requires the same start and end date.
period.endDatestring(date)Day requires the same start and end date.
period.timezonestringIANA timezone, for example Asia/Shanghai.
period.isCompletedbooleanWhether the current period is complete.
period.elapsedNightsinteger|nullElapsed nights for aggregate sleep/vital windows.
period.validNightsinteger|nullValid nights for aggregate sleep/vital windows.
metricsobjectMetric facts for the selected surface.
metrics.nightobjectNight segment.
metrics.night.startAtstring(date-time)Night start.
metrics.night.endAtstring(date-time)Night end.
metrics.night.isCompletedbooleanWhether night collection is complete.
metrics.nightRestHrAverageobjectNight-rest HR average.
metrics.nightRestHrAverage.valuenumber|nullAverage value.
metrics.nightRestHrAverage.sampleCountintegerSample count.
metrics.nightRestHrAverage.baselineobjectNight-rest HR baseline baseline.
metrics.nightRestHrAverage.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.nightRestHrAverage.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.nightRestHrAverage.baseline.baselineSourceenumBaseline source.
metrics.allDayRestHrAverageobjectAll-day rest HR average.
metrics.allDayRestHrAverage.valuenumber|nullAverage value.
metrics.allDayRestHrAverage.sampleCountintegerSample count.
metrics.allDayRestHrAverage.baselineobjectAll-day rest HR baseline baseline.
metrics.allDayRestHrAverage.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.allDayRestHrAverage.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.allDayRestHrAverage.baseline.baselineSourceenumBaseline source.
metrics.hourlyPointsarray<array<number>>24 buckets of sampled points.
metrics.contextobjectOptional environment context.
metrics.context.weatherenumWeather code.
metrics.context.tempMaxCnumberMax temperature in Celsius.
metrics.context.feelsLikeMaxCnumberMax feels-like temperature in Celsius.
metrics.context.temperatureCelsiusnumberObserved temperature in Celsius.
metrics.context.humidityPctnumberHumidity percentage.

请求字段规则

  • 不符合:Day window must use the same start and end date.修正:Match the published window definition.
  • 不符合:Numeric counts and durations must be non-negative.修正:Send zero or a positive number.
  • 不符合:Null vital values must carry sampleCount 0; present values must carry sampleCount >= 1.修正:Keep value/sampleCount pairs consistent.

返回示例 JSON

{
  "insightId": "health_detail_01J",
  "petId": "pet-1",
  "metric": "hr",
  "viewWindow": "day",
  "period": {
    "startDate": "2026-07-21",
    "endDate": "2026-07-21",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "status": "normal",
  "severity": "none",
  "summary": "Metric is stable.",
  "generation": {
    "ruleId": "DOCUMENTATION_EXAMPLE",
    "ruleVersion": "health-detail-v3",
    "generatedAt": "2026-07-23T10:00:00Z",
    "aiPolished": false
  }
}

返回字段描述

字段名数据类型是否必需详细说明
insightIdstringGateway insight ID.
petIdstringEchoed pet ID.
metricenumEchoed metric.
viewWindowenumEchoed window.
periodobjectNormalized request period.
statusenumPrimary status.
severityenumPrimary severity.
summarystringLocalized summary.
generationobjectGeneration metadata.

HR Week

接口简介

HR week request and response contract.

请求示例 JSON

{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "hr",
  "viewWindow": "week",
  "locale": "zh-CN",
  "petProfile": {
    "name": "Pocky",
    "species": "dog",
    "healthRiskTags": []
  },
  "period": {
    "startDate": "2026-07-13",
    "endDate": "2026-07-19",
    "timezone": "Asia/Shanghai",
    "isCompleted": true,
    "elapsedNights": 7,
    "validNights": 1
  },
  "metrics": {
    "nightRestHrAverage": {
      "value": 82,
      "sampleCount": 8,
      "baseline": {
        "baselineLower": 72,
        "baselineUpper": 92,
        "baselineSource": "personal"
      }
    },
    "allDayRestHrAverage": {
      "value": 82,
      "sampleCount": 8,
      "baseline": {
        "baselineLower": 72,
        "baselineUpper": 92,
        "baselineSource": "personal"
      }
    },
    "dailyNightRestHr": [
      {
        "date": "2026-07-13",
        "nightRestHrAverage": 82,
        "sampleCount": 8
      },
      {
        "date": "2026-07-14",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-15",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-16",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-17",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-18",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-19",
        "nightRestHrAverage": null,
        "sampleCount": 0
      }
    ]
  }
}

请求字段表

字段名数据类型是否必需详细说明
schemaVersionstringFixed to health-detail-v3.
userIdstringCaller user ID.
petIdstringCaller pet ID.
metricenumMetric selector.
viewWindowenumView window selector.
localeenumSummary locale.
petProfileobjectPet profile.
petProfile.namestringDisplay name.
petProfile.speciesenumPet species.
petProfile.activityToleranceenum|nullActivity tolerance.
petProfile.heatToleranceenum|nullHeat tolerance.
petProfile.coldToleranceenum|nullCold tolerance.
petProfile.humidHeatSensitivityenum|nullHumid heat sensitivity.
petProfile.healthRiskTagsarray<enum>Known risk tags.
periodobjectRequested period.
period.startDatestring(date)Week requires seven consecutive calendar days.
period.endDatestring(date)Week requires seven consecutive calendar days.
period.timezonestringIANA timezone, for example Asia/Shanghai.
period.isCompletedbooleanWhether the current period is complete.
period.elapsedNightsintegerElapsed nights for aggregate sleep/vital windows.
period.validNightsintegerValid nights for aggregate sleep/vital windows.
metricsobjectMetric facts for the selected surface.
previousPeriodobjectOptional adjacent previous period facts.
previousPeriod.startDatestring(date)Previous period start date.
previousPeriod.endDatestring(date)Previous period end date.
previousPeriod.isCompletedbooleanMust be true.
previousPeriod.validNightsintegerPrevious valid nights.
previousPeriod.nightRestHrAveragenumberPrevious night-rest HR average.
previousPeriod.allDayRestHrAveragenumber|nullPrevious all-day rest HR average.
previousPeriod.highNightRestHrCountintegerPrevious high night-rest HR count.
previousPeriod.lowNightRestHrCountintegerPrevious low night-rest HR count.
metrics.nightRestHrAverageobjectNight-rest HR average.
metrics.nightRestHrAverage.valuenumber|nullAverage value.
metrics.nightRestHrAverage.sampleCountintegerSample count.
metrics.nightRestHrAverage.baselineobjectNight-rest HR baseline baseline.
metrics.nightRestHrAverage.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.nightRestHrAverage.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.nightRestHrAverage.baseline.baselineSourceenumBaseline source.
metrics.allDayRestHrAverageobjectAll-day rest HR average.
metrics.allDayRestHrAverage.valuenumber|nullAverage value.
metrics.allDayRestHrAverage.sampleCountintegerSample count.
metrics.allDayRestHrAverage.baselineobjectAll-day rest HR baseline baseline.
metrics.allDayRestHrAverage.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.allDayRestHrAverage.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.allDayRestHrAverage.baseline.baselineSourceenumBaseline source.
metrics.dailyNightRestHrarray<object>Daily vital rows.
metrics.dailyNightRestHr[].datestring(date)Calendar date.
metrics.dailyNightRestHr[].nightRestHrAveragenumber|nullDaily night-rest value.
metrics.dailyNightRestHr[].sampleCountintegerDaily sample count.
metrics.contextobjectOptional environment context.
metrics.context.weatherenumWeather code.
metrics.context.tempMaxCnumberMax temperature in Celsius.
metrics.context.feelsLikeMaxCnumberMax feels-like temperature in Celsius.
metrics.context.temperatureCelsiusnumberObserved temperature in Celsius.
metrics.context.humidityPctnumberHumidity percentage.

请求字段规则

  • 不符合:Week window must cover seven consecutive days.修正:Match the published window definition.
  • 不符合:Numeric counts and durations must be non-negative.修正:Send zero or a positive number.
  • 不符合:Aggregate daily arrays must align to the requested calendar length.修正:Provide one row per calendar day in order.
  • 不符合:previousPeriod must be adjacent and complete.修正:Use the complete period immediately before the current one.
  • 不符合:Null vital values must carry sampleCount 0; present values must carry sampleCount >= 1.修正:Keep value/sampleCount pairs consistent.

返回示例 JSON

{
  "insightId": "health_detail_01J",
  "petId": "pet-1",
  "metric": "hr",
  "viewWindow": "week",
  "period": {
    "startDate": "2026-07-13",
    "endDate": "2026-07-19",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "status": "normal",
  "severity": "none",
  "summary": "Metric is stable.",
  "generation": {
    "ruleId": "DOCUMENTATION_EXAMPLE",
    "ruleVersion": "health-detail-v3",
    "generatedAt": "2026-07-23T10:00:00Z",
    "aiPolished": false
  }
}

返回字段描述

字段名数据类型是否必需详细说明
insightIdstringGateway insight ID.
petIdstringEchoed pet ID.
metricenumEchoed metric.
viewWindowenumEchoed window.
periodobjectNormalized request period.
statusenumPrimary status.
severityenumPrimary severity.
summarystringLocalized summary.
generationobjectGeneration metadata.

HR Month

接口简介

HR month request and response contract.

请求示例 JSON

{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "hr",
  "viewWindow": "month",
  "locale": "zh-CN",
  "petProfile": {
    "name": "Pocky",
    "species": "dog",
    "healthRiskTags": []
  },
  "period": {
    "startDate": "2026-07-01",
    "endDate": "2026-07-31",
    "timezone": "Asia/Shanghai",
    "isCompleted": true,
    "elapsedNights": 31,
    "validNights": 1
  },
  "metrics": {
    "nightRestHrAverage": {
      "value": 82,
      "sampleCount": 8,
      "baseline": {
        "baselineLower": 72,
        "baselineUpper": 92,
        "baselineSource": "personal"
      }
    },
    "allDayRestHrAverage": {
      "value": 82,
      "sampleCount": 8,
      "baseline": {
        "baselineLower": 72,
        "baselineUpper": 92,
        "baselineSource": "personal"
      }
    },
    "dailyNightRestHr": [
      {
        "date": "2026-07-01",
        "nightRestHrAverage": 82,
        "sampleCount": 8
      },
      {
        "date": "2026-07-02",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-03",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-04",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-05",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-06",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-07",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-08",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-09",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-10",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-11",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-12",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-13",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-14",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-15",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-16",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-17",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-18",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-19",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-20",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-21",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-22",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-23",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-24",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-25",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-26",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-27",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-28",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-29",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-30",
        "nightRestHrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-31",
        "nightRestHrAverage": null,
        "sampleCount": 0
      }
    ]
  }
}

请求字段表

字段名数据类型是否必需详细说明
schemaVersionstringFixed to health-detail-v3.
userIdstringCaller user ID.
petIdstringCaller pet ID.
metricenumMetric selector.
viewWindowenumView window selector.
localeenumSummary locale.
petProfileobjectPet profile.
petProfile.namestringDisplay name.
petProfile.speciesenumPet species.
petProfile.activityToleranceenum|nullActivity tolerance.
petProfile.heatToleranceenum|nullHeat tolerance.
petProfile.coldToleranceenum|nullCold tolerance.
petProfile.humidHeatSensitivityenum|nullHumid heat sensitivity.
petProfile.healthRiskTagsarray<enum>Known risk tags.
periodobjectRequested period.
period.startDatestring(date)Month requires one complete natural month.
period.endDatestring(date)Month requires one complete natural month.
period.timezonestringIANA timezone, for example Asia/Shanghai.
period.isCompletedbooleanWhether the current period is complete.
period.elapsedNightsintegerElapsed nights for aggregate sleep/vital windows.
period.validNightsintegerValid nights for aggregate sleep/vital windows.
metricsobjectMetric facts for the selected surface.
previousPeriodobjectOptional adjacent previous period facts.
previousPeriod.startDatestring(date)Previous period start date.
previousPeriod.endDatestring(date)Previous period end date.
previousPeriod.isCompletedbooleanMust be true.
previousPeriod.validNightsintegerPrevious valid nights.
previousPeriod.nightRestHrAveragenumberPrevious night-rest HR average.
previousPeriod.allDayRestHrAveragenumber|nullPrevious all-day rest HR average.
previousPeriod.highNightRestHrCountintegerPrevious high night-rest HR count.
previousPeriod.lowNightRestHrCountintegerPrevious low night-rest HR count.
metrics.nightRestHrAverageobjectNight-rest HR average.
metrics.nightRestHrAverage.valuenumber|nullAverage value.
metrics.nightRestHrAverage.sampleCountintegerSample count.
metrics.nightRestHrAverage.baselineobjectNight-rest HR baseline baseline.
metrics.nightRestHrAverage.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.nightRestHrAverage.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.nightRestHrAverage.baseline.baselineSourceenumBaseline source.
metrics.allDayRestHrAverageobjectAll-day rest HR average.
metrics.allDayRestHrAverage.valuenumber|nullAverage value.
metrics.allDayRestHrAverage.sampleCountintegerSample count.
metrics.allDayRestHrAverage.baselineobjectAll-day rest HR baseline baseline.
metrics.allDayRestHrAverage.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.allDayRestHrAverage.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.allDayRestHrAverage.baseline.baselineSourceenumBaseline source.
metrics.dailyNightRestHrarray<object>Daily vital rows.
metrics.dailyNightRestHr[].datestring(date)Calendar date.
metrics.dailyNightRestHr[].nightRestHrAveragenumber|nullDaily night-rest value.
metrics.dailyNightRestHr[].sampleCountintegerDaily sample count.
metrics.contextobjectOptional environment context.
metrics.context.weatherenumWeather code.
metrics.context.tempMaxCnumberMax temperature in Celsius.
metrics.context.feelsLikeMaxCnumberMax feels-like temperature in Celsius.
metrics.context.temperatureCelsiusnumberObserved temperature in Celsius.
metrics.context.humidityPctnumberHumidity percentage.

请求字段规则

  • 不符合:Month window must cover one natural month.修正:Match the published window definition.
  • 不符合:Numeric counts and durations must be non-negative.修正:Send zero or a positive number.
  • 不符合:Aggregate daily arrays must align to the requested calendar length.修正:Provide one row per calendar day in order.
  • 不符合:previousPeriod must be adjacent and complete.修正:Use the complete period immediately before the current one.
  • 不符合:Null vital values must carry sampleCount 0; present values must carry sampleCount >= 1.修正:Keep value/sampleCount pairs consistent.

返回示例 JSON

{
  "insightId": "health_detail_01J",
  "petId": "pet-1",
  "metric": "hr",
  "viewWindow": "month",
  "period": {
    "startDate": "2026-07-01",
    "endDate": "2026-07-31",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "status": "normal",
  "severity": "none",
  "summary": "Metric is stable.",
  "generation": {
    "ruleId": "DOCUMENTATION_EXAMPLE",
    "ruleVersion": "health-detail-v3",
    "generatedAt": "2026-07-23T10:00:00Z",
    "aiPolished": false
  }
}

返回字段描述

字段名数据类型是否必需详细说明
insightIdstringGateway insight ID.
petIdstringEchoed pet ID.
metricenumEchoed metric.
viewWindowenumEchoed window.
periodobjectNormalized request period.
statusenumPrimary status.
severityenumPrimary severity.
summarystringLocalized summary.
generationobjectGeneration metadata.

HRV Day

接口简介

HRV day request and response contract.

请求示例 JSON

{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "hrv",
  "viewWindow": "day",
  "locale": "zh-CN",
  "petProfile": {
    "name": "Pocky",
    "species": "dog",
    "healthRiskTags": []
  },
  "period": {
    "startDate": "2026-07-21",
    "endDate": "2026-07-21",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "metrics": {
    "night": {
      "startAt": "2026-07-20T22:00:00+08:00",
      "endAt": "2026-07-21T08:00:00+08:00",
      "isCompleted": true
    },
    "nightRestRmssdAverage": {
      "value": 48,
      "sampleCount": 8,
      "baseline": {
        "baselineLower": 38,
        "baselineUpper": 58,
        "baselineSource": "personal"
      }
    },
    "allDayRestRmssdAverage": {
      "value": 48,
      "sampleCount": 8,
      "baseline": {
        "baselineLower": 38,
        "baselineUpper": 58,
        "baselineSource": "personal"
      }
    },
    "hourlyRmssdPoints": [
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      []
    ]
  }
}

请求字段表

字段名数据类型是否必需详细说明
schemaVersionstringFixed to health-detail-v3.
userIdstringCaller user ID.
petIdstringCaller pet ID.
metricenumMetric selector.
viewWindowenumView window selector.
localeenumSummary locale.
petProfileobjectPet profile.
petProfile.namestringDisplay name.
petProfile.speciesenumPet species.
petProfile.activityToleranceenum|nullActivity tolerance.
petProfile.heatToleranceenum|nullHeat tolerance.
petProfile.coldToleranceenum|nullCold tolerance.
petProfile.humidHeatSensitivityenum|nullHumid heat sensitivity.
petProfile.healthRiskTagsarray<enum>Known risk tags.
periodobjectRequested period.
period.startDatestring(date)Day requires the same start and end date.
period.endDatestring(date)Day requires the same start and end date.
period.timezonestringIANA timezone, for example Asia/Shanghai.
period.isCompletedbooleanWhether the current period is complete.
period.elapsedNightsinteger|nullElapsed nights for aggregate sleep/vital windows.
period.validNightsinteger|nullValid nights for aggregate sleep/vital windows.
metricsobjectMetric facts for the selected surface.
metrics.nightobjectNight segment.
metrics.night.startAtstring(date-time)Night start.
metrics.night.endAtstring(date-time)Night end.
metrics.night.isCompletedbooleanWhether night collection is complete.
metrics.nightRestRmssdAverageobjectNight-rest HRV average.
metrics.nightRestRmssdAverage.valuenumber|nullAverage value.
metrics.nightRestRmssdAverage.sampleCountintegerSample count.
metrics.nightRestRmssdAverage.baselineobjectNight-rest HRV baseline baseline.
metrics.nightRestRmssdAverage.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.nightRestRmssdAverage.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.nightRestRmssdAverage.baseline.baselineSourceenumBaseline source.
metrics.allDayRestRmssdAverageobjectAll-day rest HRV average.
metrics.allDayRestRmssdAverage.valuenumber|nullAverage value.
metrics.allDayRestRmssdAverage.sampleCountintegerSample count.
metrics.allDayRestRmssdAverage.baselineobjectAll-day rest HRV baseline baseline.
metrics.allDayRestRmssdAverage.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.allDayRestRmssdAverage.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.allDayRestRmssdAverage.baseline.baselineSourceenumBaseline source.
metrics.hourlyRmssdPointsarray<array<number>>24 buckets of sampled points.
metrics.contextobjectOptional environment context.
metrics.context.weatherenumWeather code.
metrics.context.tempMaxCnumberMax temperature in Celsius.
metrics.context.feelsLikeMaxCnumberMax feels-like temperature in Celsius.
metrics.context.temperatureCelsiusnumberObserved temperature in Celsius.
metrics.context.humidityPctnumberHumidity percentage.

请求字段规则

  • 不符合:Day window must use the same start and end date.修正:Match the published window definition.
  • 不符合:Numeric counts and durations must be non-negative.修正:Send zero or a positive number.
  • 不符合:Null vital values must carry sampleCount 0; present values must carry sampleCount >= 1.修正:Keep value/sampleCount pairs consistent.

返回示例 JSON

{
  "insightId": "health_detail_01J",
  "petId": "pet-1",
  "metric": "hrv",
  "viewWindow": "day",
  "period": {
    "startDate": "2026-07-21",
    "endDate": "2026-07-21",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "status": "normal",
  "severity": "none",
  "summary": "Metric is stable.",
  "generation": {
    "ruleId": "DOCUMENTATION_EXAMPLE",
    "ruleVersion": "health-detail-v3",
    "generatedAt": "2026-07-23T10:00:00Z",
    "aiPolished": false
  }
}

返回字段描述

字段名数据类型是否必需详细说明
insightIdstringGateway insight ID.
petIdstringEchoed pet ID.
metricenumEchoed metric.
viewWindowenumEchoed window.
periodobjectNormalized request period.
statusenumPrimary status.
severityenumPrimary severity.
summarystringLocalized summary.
generationobjectGeneration metadata.

HRV Week

接口简介

HRV week request and response contract.

请求示例 JSON

{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "hrv",
  "viewWindow": "week",
  "locale": "zh-CN",
  "petProfile": {
    "name": "Pocky",
    "species": "dog",
    "healthRiskTags": []
  },
  "period": {
    "startDate": "2026-07-13",
    "endDate": "2026-07-19",
    "timezone": "Asia/Shanghai",
    "isCompleted": true,
    "elapsedNights": 7,
    "validNights": 1
  },
  "metrics": {
    "nightRestRmssdAverage": {
      "value": 48,
      "sampleCount": 8,
      "baseline": {
        "baselineLower": 38,
        "baselineUpper": 58,
        "baselineSource": "personal"
      }
    },
    "allDayRestRmssdAverage": {
      "value": 48,
      "sampleCount": 8,
      "baseline": {
        "baselineLower": 38,
        "baselineUpper": 58,
        "baselineSource": "personal"
      }
    },
    "dailyNightRestRmssd": [
      {
        "date": "2026-07-13",
        "nightRestRmssdAverage": 48,
        "sampleCount": 8
      },
      {
        "date": "2026-07-14",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-15",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-16",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-17",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-18",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-19",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      }
    ]
  }
}

请求字段表

字段名数据类型是否必需详细说明
schemaVersionstringFixed to health-detail-v3.
userIdstringCaller user ID.
petIdstringCaller pet ID.
metricenumMetric selector.
viewWindowenumView window selector.
localeenumSummary locale.
petProfileobjectPet profile.
petProfile.namestringDisplay name.
petProfile.speciesenumPet species.
petProfile.activityToleranceenum|nullActivity tolerance.
petProfile.heatToleranceenum|nullHeat tolerance.
petProfile.coldToleranceenum|nullCold tolerance.
petProfile.humidHeatSensitivityenum|nullHumid heat sensitivity.
petProfile.healthRiskTagsarray<enum>Known risk tags.
periodobjectRequested period.
period.startDatestring(date)Week requires seven consecutive calendar days.
period.endDatestring(date)Week requires seven consecutive calendar days.
period.timezonestringIANA timezone, for example Asia/Shanghai.
period.isCompletedbooleanWhether the current period is complete.
period.elapsedNightsintegerElapsed nights for aggregate sleep/vital windows.
period.validNightsintegerValid nights for aggregate sleep/vital windows.
metricsobjectMetric facts for the selected surface.
previousPeriodobjectOptional adjacent previous period facts.
previousPeriod.startDatestring(date)Previous period start date.
previousPeriod.endDatestring(date)Previous period end date.
previousPeriod.isCompletedbooleanMust be true.
previousPeriod.validNightsintegerPrevious valid nights.
previousPeriod.nightRestRmssdAveragenumberPrevious night-rest RMSSD average.
previousPeriod.allDayRestRmssdAveragenumber|nullPrevious all-day rest RMSSD average.
previousPeriod.lowNightRestRmssdCountintegerPrevious low night-rest RMSSD count.
metrics.nightRestRmssdAverageobjectNight-rest HRV average.
metrics.nightRestRmssdAverage.valuenumber|nullAverage value.
metrics.nightRestRmssdAverage.sampleCountintegerSample count.
metrics.nightRestRmssdAverage.baselineobjectNight-rest HRV baseline baseline.
metrics.nightRestRmssdAverage.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.nightRestRmssdAverage.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.nightRestRmssdAverage.baseline.baselineSourceenumBaseline source.
metrics.allDayRestRmssdAverageobjectAll-day rest HRV average.
metrics.allDayRestRmssdAverage.valuenumber|nullAverage value.
metrics.allDayRestRmssdAverage.sampleCountintegerSample count.
metrics.allDayRestRmssdAverage.baselineobjectAll-day rest HRV baseline baseline.
metrics.allDayRestRmssdAverage.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.allDayRestRmssdAverage.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.allDayRestRmssdAverage.baseline.baselineSourceenumBaseline source.
metrics.dailyNightRestRmssdarray<object>Daily vital rows.
metrics.dailyNightRestRmssd[].datestring(date)Calendar date.
metrics.dailyNightRestRmssd[].nightRestRmssdAveragenumber|nullDaily night-rest value.
metrics.dailyNightRestRmssd[].sampleCountintegerDaily sample count.
metrics.contextobjectOptional environment context.
metrics.context.weatherenumWeather code.
metrics.context.tempMaxCnumberMax temperature in Celsius.
metrics.context.feelsLikeMaxCnumberMax feels-like temperature in Celsius.
metrics.context.temperatureCelsiusnumberObserved temperature in Celsius.
metrics.context.humidityPctnumberHumidity percentage.

请求字段规则

  • 不符合:Week window must cover seven consecutive days.修正:Match the published window definition.
  • 不符合:Numeric counts and durations must be non-negative.修正:Send zero or a positive number.
  • 不符合:Aggregate daily arrays must align to the requested calendar length.修正:Provide one row per calendar day in order.
  • 不符合:previousPeriod must be adjacent and complete.修正:Use the complete period immediately before the current one.
  • 不符合:Null vital values must carry sampleCount 0; present values must carry sampleCount >= 1.修正:Keep value/sampleCount pairs consistent.

返回示例 JSON

{
  "insightId": "health_detail_01J",
  "petId": "pet-1",
  "metric": "hrv",
  "viewWindow": "week",
  "period": {
    "startDate": "2026-07-13",
    "endDate": "2026-07-19",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "status": "normal",
  "severity": "none",
  "summary": "Metric is stable.",
  "generation": {
    "ruleId": "DOCUMENTATION_EXAMPLE",
    "ruleVersion": "health-detail-v3",
    "generatedAt": "2026-07-23T10:00:00Z",
    "aiPolished": false
  }
}

返回字段描述

字段名数据类型是否必需详细说明
insightIdstringGateway insight ID.
petIdstringEchoed pet ID.
metricenumEchoed metric.
viewWindowenumEchoed window.
periodobjectNormalized request period.
statusenumPrimary status.
severityenumPrimary severity.
summarystringLocalized summary.
generationobjectGeneration metadata.

HRV Month

接口简介

HRV month request and response contract.

请求示例 JSON

{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "hrv",
  "viewWindow": "month",
  "locale": "zh-CN",
  "petProfile": {
    "name": "Pocky",
    "species": "dog",
    "healthRiskTags": []
  },
  "period": {
    "startDate": "2026-07-01",
    "endDate": "2026-07-31",
    "timezone": "Asia/Shanghai",
    "isCompleted": true,
    "elapsedNights": 31,
    "validNights": 1
  },
  "metrics": {
    "nightRestRmssdAverage": {
      "value": 48,
      "sampleCount": 8,
      "baseline": {
        "baselineLower": 38,
        "baselineUpper": 58,
        "baselineSource": "personal"
      }
    },
    "allDayRestRmssdAverage": {
      "value": 48,
      "sampleCount": 8,
      "baseline": {
        "baselineLower": 38,
        "baselineUpper": 58,
        "baselineSource": "personal"
      }
    },
    "dailyNightRestRmssd": [
      {
        "date": "2026-07-01",
        "nightRestRmssdAverage": 48,
        "sampleCount": 8
      },
      {
        "date": "2026-07-02",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-03",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-04",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-05",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-06",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-07",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-08",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-09",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-10",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-11",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-12",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-13",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-14",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-15",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-16",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-17",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-18",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-19",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-20",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-21",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-22",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-23",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-24",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-25",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-26",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-27",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-28",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-29",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-30",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-31",
        "nightRestRmssdAverage": null,
        "sampleCount": 0
      }
    ]
  }
}

请求字段表

字段名数据类型是否必需详细说明
schemaVersionstringFixed to health-detail-v3.
userIdstringCaller user ID.
petIdstringCaller pet ID.
metricenumMetric selector.
viewWindowenumView window selector.
localeenumSummary locale.
petProfileobjectPet profile.
petProfile.namestringDisplay name.
petProfile.speciesenumPet species.
petProfile.activityToleranceenum|nullActivity tolerance.
petProfile.heatToleranceenum|nullHeat tolerance.
petProfile.coldToleranceenum|nullCold tolerance.
petProfile.humidHeatSensitivityenum|nullHumid heat sensitivity.
petProfile.healthRiskTagsarray<enum>Known risk tags.
periodobjectRequested period.
period.startDatestring(date)Month requires one complete natural month.
period.endDatestring(date)Month requires one complete natural month.
period.timezonestringIANA timezone, for example Asia/Shanghai.
period.isCompletedbooleanWhether the current period is complete.
period.elapsedNightsintegerElapsed nights for aggregate sleep/vital windows.
period.validNightsintegerValid nights for aggregate sleep/vital windows.
metricsobjectMetric facts for the selected surface.
previousPeriodobjectOptional adjacent previous period facts.
previousPeriod.startDatestring(date)Previous period start date.
previousPeriod.endDatestring(date)Previous period end date.
previousPeriod.isCompletedbooleanMust be true.
previousPeriod.validNightsintegerPrevious valid nights.
previousPeriod.nightRestRmssdAveragenumberPrevious night-rest RMSSD average.
previousPeriod.allDayRestRmssdAveragenumber|nullPrevious all-day rest RMSSD average.
previousPeriod.lowNightRestRmssdCountintegerPrevious low night-rest RMSSD count.
metrics.nightRestRmssdAverageobjectNight-rest HRV average.
metrics.nightRestRmssdAverage.valuenumber|nullAverage value.
metrics.nightRestRmssdAverage.sampleCountintegerSample count.
metrics.nightRestRmssdAverage.baselineobjectNight-rest HRV baseline baseline.
metrics.nightRestRmssdAverage.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.nightRestRmssdAverage.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.nightRestRmssdAverage.baseline.baselineSourceenumBaseline source.
metrics.allDayRestRmssdAverageobjectAll-day rest HRV average.
metrics.allDayRestRmssdAverage.valuenumber|nullAverage value.
metrics.allDayRestRmssdAverage.sampleCountintegerSample count.
metrics.allDayRestRmssdAverage.baselineobjectAll-day rest HRV baseline baseline.
metrics.allDayRestRmssdAverage.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.allDayRestRmssdAverage.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.allDayRestRmssdAverage.baseline.baselineSourceenumBaseline source.
metrics.dailyNightRestRmssdarray<object>Daily vital rows.
metrics.dailyNightRestRmssd[].datestring(date)Calendar date.
metrics.dailyNightRestRmssd[].nightRestRmssdAveragenumber|nullDaily night-rest value.
metrics.dailyNightRestRmssd[].sampleCountintegerDaily sample count.
metrics.contextobjectOptional environment context.
metrics.context.weatherenumWeather code.
metrics.context.tempMaxCnumberMax temperature in Celsius.
metrics.context.feelsLikeMaxCnumberMax feels-like temperature in Celsius.
metrics.context.temperatureCelsiusnumberObserved temperature in Celsius.
metrics.context.humidityPctnumberHumidity percentage.

请求字段规则

  • 不符合:Month window must cover one natural month.修正:Match the published window definition.
  • 不符合:Numeric counts and durations must be non-negative.修正:Send zero or a positive number.
  • 不符合:Aggregate daily arrays must align to the requested calendar length.修正:Provide one row per calendar day in order.
  • 不符合:previousPeriod must be adjacent and complete.修正:Use the complete period immediately before the current one.
  • 不符合:Null vital values must carry sampleCount 0; present values must carry sampleCount >= 1.修正:Keep value/sampleCount pairs consistent.

返回示例 JSON

{
  "insightId": "health_detail_01J",
  "petId": "pet-1",
  "metric": "hrv",
  "viewWindow": "month",
  "period": {
    "startDate": "2026-07-01",
    "endDate": "2026-07-31",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "status": "normal",
  "severity": "none",
  "summary": "Metric is stable.",
  "generation": {
    "ruleId": "DOCUMENTATION_EXAMPLE",
    "ruleVersion": "health-detail-v3",
    "generatedAt": "2026-07-23T10:00:00Z",
    "aiPolished": false
  }
}

返回字段描述

字段名数据类型是否必需详细说明
insightIdstringGateway insight ID.
petIdstringEchoed pet ID.
metricenumEchoed metric.
viewWindowenumEchoed window.
periodobjectNormalized request period.
statusenumPrimary status.
severityenumPrimary severity.
summarystringLocalized summary.
generationobjectGeneration metadata.

RR Day

接口简介

RR day request and response contract.

请求示例 JSON

{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "rr",
  "viewWindow": "day",
  "locale": "zh-CN",
  "petProfile": {
    "name": "Pocky",
    "species": "dog",
    "healthRiskTags": []
  },
  "period": {
    "startDate": "2026-07-21",
    "endDate": "2026-07-21",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "metrics": {
    "night": {
      "startAt": "2026-07-20T22:00:00+08:00",
      "endAt": "2026-07-21T08:00:00+08:00",
      "isCompleted": true
    },
    "nightRestRrAverage": {
      "value": 22,
      "sampleCount": 8,
      "baseline": {
        "baselineLower": 12,
        "baselineUpper": 32,
        "baselineSource": "personal"
      }
    },
    "allDayRestRrAverage": {
      "value": 22,
      "sampleCount": 8,
      "baseline": {
        "baselineLower": 12,
        "baselineUpper": 32,
        "baselineSource": "personal"
      }
    },
    "hourlyPoints": [
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      [],
      []
    ]
  }
}

请求字段表

字段名数据类型是否必需详细说明
schemaVersionstringFixed to health-detail-v3.
userIdstringCaller user ID.
petIdstringCaller pet ID.
metricenumMetric selector.
viewWindowenumView window selector.
localeenumSummary locale.
petProfileobjectPet profile.
petProfile.namestringDisplay name.
petProfile.speciesenumPet species.
petProfile.activityToleranceenum|nullActivity tolerance.
petProfile.heatToleranceenum|nullHeat tolerance.
petProfile.coldToleranceenum|nullCold tolerance.
petProfile.humidHeatSensitivityenum|nullHumid heat sensitivity.
petProfile.healthRiskTagsarray<enum>Known risk tags.
periodobjectRequested period.
period.startDatestring(date)Day requires the same start and end date.
period.endDatestring(date)Day requires the same start and end date.
period.timezonestringIANA timezone, for example Asia/Shanghai.
period.isCompletedbooleanWhether the current period is complete.
period.elapsedNightsinteger|nullElapsed nights for aggregate sleep/vital windows.
period.validNightsinteger|nullValid nights for aggregate sleep/vital windows.
metricsobjectMetric facts for the selected surface.
metrics.nightobjectNight segment.
metrics.night.startAtstring(date-time)Night start.
metrics.night.endAtstring(date-time)Night end.
metrics.night.isCompletedbooleanWhether night collection is complete.
metrics.nightRestRrAverageobjectNight-rest RR average.
metrics.nightRestRrAverage.valuenumber|nullAverage value.
metrics.nightRestRrAverage.sampleCountintegerSample count.
metrics.nightRestRrAverage.baselineobjectNight-rest RR baseline baseline.
metrics.nightRestRrAverage.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.nightRestRrAverage.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.nightRestRrAverage.baseline.baselineSourceenumBaseline source.
metrics.allDayRestRrAverageobjectAll-day rest RR average.
metrics.allDayRestRrAverage.valuenumber|nullAverage value.
metrics.allDayRestRrAverage.sampleCountintegerSample count.
metrics.allDayRestRrAverage.baselineobjectAll-day rest RR baseline baseline.
metrics.allDayRestRrAverage.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.allDayRestRrAverage.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.allDayRestRrAverage.baseline.baselineSourceenumBaseline source.
metrics.hourlyPointsarray<array<number>>24 buckets of sampled points.
metrics.contextobjectOptional environment context.
metrics.context.weatherenumWeather code.
metrics.context.tempMaxCnumberMax temperature in Celsius.
metrics.context.feelsLikeMaxCnumberMax feels-like temperature in Celsius.
metrics.context.temperatureCelsiusnumberObserved temperature in Celsius.
metrics.context.humidityPctnumberHumidity percentage.

请求字段规则

  • 不符合:Day window must use the same start and end date.修正:Match the published window definition.
  • 不符合:Numeric counts and durations must be non-negative.修正:Send zero or a positive number.
  • 不符合:Null vital values must carry sampleCount 0; present values must carry sampleCount >= 1.修正:Keep value/sampleCount pairs consistent.

返回示例 JSON

{
  "insightId": "health_detail_01J",
  "petId": "pet-1",
  "metric": "rr",
  "viewWindow": "day",
  "period": {
    "startDate": "2026-07-21",
    "endDate": "2026-07-21",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "status": "normal",
  "severity": "none",
  "summary": "Metric is stable.",
  "generation": {
    "ruleId": "DOCUMENTATION_EXAMPLE",
    "ruleVersion": "health-detail-v3",
    "generatedAt": "2026-07-23T10:00:00Z",
    "aiPolished": false
  }
}

返回字段描述

字段名数据类型是否必需详细说明
insightIdstringGateway insight ID.
petIdstringEchoed pet ID.
metricenumEchoed metric.
viewWindowenumEchoed window.
periodobjectNormalized request period.
statusenumPrimary status.
severityenumPrimary severity.
summarystringLocalized summary.
generationobjectGeneration metadata.

RR Week

接口简介

RR week request and response contract.

请求示例 JSON

{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "rr",
  "viewWindow": "week",
  "locale": "zh-CN",
  "petProfile": {
    "name": "Pocky",
    "species": "dog",
    "healthRiskTags": []
  },
  "period": {
    "startDate": "2026-07-13",
    "endDate": "2026-07-19",
    "timezone": "Asia/Shanghai",
    "isCompleted": true,
    "elapsedNights": 7,
    "validNights": 1
  },
  "metrics": {
    "nightRestRrAverage": {
      "value": 22,
      "sampleCount": 8,
      "baseline": {
        "baselineLower": 12,
        "baselineUpper": 32,
        "baselineSource": "personal"
      }
    },
    "allDayRestRrAverage": {
      "value": 22,
      "sampleCount": 8,
      "baseline": {
        "baselineLower": 12,
        "baselineUpper": 32,
        "baselineSource": "personal"
      }
    },
    "dailyNightRestRr": [
      {
        "date": "2026-07-13",
        "nightRestRrAverage": 22,
        "sampleCount": 8
      },
      {
        "date": "2026-07-14",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-15",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-16",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-17",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-18",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-19",
        "nightRestRrAverage": null,
        "sampleCount": 0
      }
    ]
  }
}

请求字段表

字段名数据类型是否必需详细说明
schemaVersionstringFixed to health-detail-v3.
userIdstringCaller user ID.
petIdstringCaller pet ID.
metricenumMetric selector.
viewWindowenumView window selector.
localeenumSummary locale.
petProfileobjectPet profile.
petProfile.namestringDisplay name.
petProfile.speciesenumPet species.
petProfile.activityToleranceenum|nullActivity tolerance.
petProfile.heatToleranceenum|nullHeat tolerance.
petProfile.coldToleranceenum|nullCold tolerance.
petProfile.humidHeatSensitivityenum|nullHumid heat sensitivity.
petProfile.healthRiskTagsarray<enum>Known risk tags.
periodobjectRequested period.
period.startDatestring(date)Week requires seven consecutive calendar days.
period.endDatestring(date)Week requires seven consecutive calendar days.
period.timezonestringIANA timezone, for example Asia/Shanghai.
period.isCompletedbooleanWhether the current period is complete.
period.elapsedNightsintegerElapsed nights for aggregate sleep/vital windows.
period.validNightsintegerValid nights for aggregate sleep/vital windows.
metricsobjectMetric facts for the selected surface.
previousPeriodobjectOptional adjacent previous period facts.
previousPeriod.startDatestring(date)Previous period start date.
previousPeriod.endDatestring(date)Previous period end date.
previousPeriod.isCompletedbooleanMust be true.
previousPeriod.validNightsintegerPrevious valid nights.
previousPeriod.nightRestRrAveragenumberPrevious night-rest RR average.
previousPeriod.allDayRestRrAveragenumber|nullPrevious all-day rest RR average.
previousPeriod.highNightRestRrCountintegerPrevious high night-rest RR count.
metrics.nightRestRrAverageobjectNight-rest RR average.
metrics.nightRestRrAverage.valuenumber|nullAverage value.
metrics.nightRestRrAverage.sampleCountintegerSample count.
metrics.nightRestRrAverage.baselineobjectNight-rest RR baseline baseline.
metrics.nightRestRrAverage.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.nightRestRrAverage.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.nightRestRrAverage.baseline.baselineSourceenumBaseline source.
metrics.allDayRestRrAverageobjectAll-day rest RR average.
metrics.allDayRestRrAverage.valuenumber|nullAverage value.
metrics.allDayRestRrAverage.sampleCountintegerSample count.
metrics.allDayRestRrAverage.baselineobjectAll-day rest RR baseline baseline.
metrics.allDayRestRrAverage.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.allDayRestRrAverage.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.allDayRestRrAverage.baseline.baselineSourceenumBaseline source.
metrics.dailyNightRestRrarray<object>Daily vital rows.
metrics.dailyNightRestRr[].datestring(date)Calendar date.
metrics.dailyNightRestRr[].nightRestRrAveragenumber|nullDaily night-rest value.
metrics.dailyNightRestRr[].sampleCountintegerDaily sample count.
metrics.contextobjectOptional environment context.
metrics.context.weatherenumWeather code.
metrics.context.tempMaxCnumberMax temperature in Celsius.
metrics.context.feelsLikeMaxCnumberMax feels-like temperature in Celsius.
metrics.context.temperatureCelsiusnumberObserved temperature in Celsius.
metrics.context.humidityPctnumberHumidity percentage.

请求字段规则

  • 不符合:Week window must cover seven consecutive days.修正:Match the published window definition.
  • 不符合:Numeric counts and durations must be non-negative.修正:Send zero or a positive number.
  • 不符合:Aggregate daily arrays must align to the requested calendar length.修正:Provide one row per calendar day in order.
  • 不符合:previousPeriod must be adjacent and complete.修正:Use the complete period immediately before the current one.
  • 不符合:Null vital values must carry sampleCount 0; present values must carry sampleCount >= 1.修正:Keep value/sampleCount pairs consistent.

返回示例 JSON

{
  "insightId": "health_detail_01J",
  "petId": "pet-1",
  "metric": "rr",
  "viewWindow": "week",
  "period": {
    "startDate": "2026-07-13",
    "endDate": "2026-07-19",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "status": "normal",
  "severity": "none",
  "summary": "Metric is stable.",
  "generation": {
    "ruleId": "DOCUMENTATION_EXAMPLE",
    "ruleVersion": "health-detail-v3",
    "generatedAt": "2026-07-23T10:00:00Z",
    "aiPolished": false
  }
}

返回字段描述

字段名数据类型是否必需详细说明
insightIdstringGateway insight ID.
petIdstringEchoed pet ID.
metricenumEchoed metric.
viewWindowenumEchoed window.
periodobjectNormalized request period.
statusenumPrimary status.
severityenumPrimary severity.
summarystringLocalized summary.
generationobjectGeneration metadata.

RR Month

接口简介

RR month request and response contract.

请求示例 JSON

{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "rr",
  "viewWindow": "month",
  "locale": "zh-CN",
  "petProfile": {
    "name": "Pocky",
    "species": "dog",
    "healthRiskTags": []
  },
  "period": {
    "startDate": "2026-07-01",
    "endDate": "2026-07-31",
    "timezone": "Asia/Shanghai",
    "isCompleted": true,
    "elapsedNights": 31,
    "validNights": 1
  },
  "metrics": {
    "nightRestRrAverage": {
      "value": 22,
      "sampleCount": 8,
      "baseline": {
        "baselineLower": 12,
        "baselineUpper": 32,
        "baselineSource": "personal"
      }
    },
    "allDayRestRrAverage": {
      "value": 22,
      "sampleCount": 8,
      "baseline": {
        "baselineLower": 12,
        "baselineUpper": 32,
        "baselineSource": "personal"
      }
    },
    "dailyNightRestRr": [
      {
        "date": "2026-07-01",
        "nightRestRrAverage": 22,
        "sampleCount": 8
      },
      {
        "date": "2026-07-02",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-03",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-04",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-05",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-06",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-07",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-08",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-09",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-10",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-11",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-12",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-13",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-14",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-15",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-16",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-17",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-18",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-19",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-20",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-21",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-22",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-23",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-24",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-25",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-26",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-27",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-28",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-29",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-30",
        "nightRestRrAverage": null,
        "sampleCount": 0
      },
      {
        "date": "2026-07-31",
        "nightRestRrAverage": null,
        "sampleCount": 0
      }
    ]
  }
}

请求字段表

字段名数据类型是否必需详细说明
schemaVersionstringFixed to health-detail-v3.
userIdstringCaller user ID.
petIdstringCaller pet ID.
metricenumMetric selector.
viewWindowenumView window selector.
localeenumSummary locale.
petProfileobjectPet profile.
petProfile.namestringDisplay name.
petProfile.speciesenumPet species.
petProfile.activityToleranceenum|nullActivity tolerance.
petProfile.heatToleranceenum|nullHeat tolerance.
petProfile.coldToleranceenum|nullCold tolerance.
petProfile.humidHeatSensitivityenum|nullHumid heat sensitivity.
petProfile.healthRiskTagsarray<enum>Known risk tags.
periodobjectRequested period.
period.startDatestring(date)Month requires one complete natural month.
period.endDatestring(date)Month requires one complete natural month.
period.timezonestringIANA timezone, for example Asia/Shanghai.
period.isCompletedbooleanWhether the current period is complete.
period.elapsedNightsintegerElapsed nights for aggregate sleep/vital windows.
period.validNightsintegerValid nights for aggregate sleep/vital windows.
metricsobjectMetric facts for the selected surface.
previousPeriodobjectOptional adjacent previous period facts.
previousPeriod.startDatestring(date)Previous period start date.
previousPeriod.endDatestring(date)Previous period end date.
previousPeriod.isCompletedbooleanMust be true.
previousPeriod.validNightsintegerPrevious valid nights.
previousPeriod.nightRestRrAveragenumberPrevious night-rest RR average.
previousPeriod.allDayRestRrAveragenumber|nullPrevious all-day rest RR average.
previousPeriod.highNightRestRrCountintegerPrevious high night-rest RR count.
metrics.nightRestRrAverageobjectNight-rest RR average.
metrics.nightRestRrAverage.valuenumber|nullAverage value.
metrics.nightRestRrAverage.sampleCountintegerSample count.
metrics.nightRestRrAverage.baselineobjectNight-rest RR baseline baseline.
metrics.nightRestRrAverage.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.nightRestRrAverage.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.nightRestRrAverage.baseline.baselineSourceenumBaseline source.
metrics.allDayRestRrAverageobjectAll-day rest RR average.
metrics.allDayRestRrAverage.valuenumber|nullAverage value.
metrics.allDayRestRrAverage.sampleCountintegerSample count.
metrics.allDayRestRrAverage.baselineobjectAll-day rest RR baseline baseline.
metrics.allDayRestRrAverage.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.allDayRestRrAverage.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.allDayRestRrAverage.baseline.baselineSourceenumBaseline source.
metrics.dailyNightRestRrarray<object>Daily vital rows.
metrics.dailyNightRestRr[].datestring(date)Calendar date.
metrics.dailyNightRestRr[].nightRestRrAveragenumber|nullDaily night-rest value.
metrics.dailyNightRestRr[].sampleCountintegerDaily sample count.
metrics.contextobjectOptional environment context.
metrics.context.weatherenumWeather code.
metrics.context.tempMaxCnumberMax temperature in Celsius.
metrics.context.feelsLikeMaxCnumberMax feels-like temperature in Celsius.
metrics.context.temperatureCelsiusnumberObserved temperature in Celsius.
metrics.context.humidityPctnumberHumidity percentage.

请求字段规则

  • 不符合:Month window must cover one natural month.修正:Match the published window definition.
  • 不符合:Numeric counts and durations must be non-negative.修正:Send zero or a positive number.
  • 不符合:Aggregate daily arrays must align to the requested calendar length.修正:Provide one row per calendar day in order.
  • 不符合:previousPeriod must be adjacent and complete.修正:Use the complete period immediately before the current one.
  • 不符合:Null vital values must carry sampleCount 0; present values must carry sampleCount >= 1.修正:Keep value/sampleCount pairs consistent.

返回示例 JSON

{
  "insightId": "health_detail_01J",
  "petId": "pet-1",
  "metric": "rr",
  "viewWindow": "month",
  "period": {
    "startDate": "2026-07-01",
    "endDate": "2026-07-31",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "status": "normal",
  "severity": "none",
  "summary": "Metric is stable.",
  "generation": {
    "ruleId": "DOCUMENTATION_EXAMPLE",
    "ruleVersion": "health-detail-v3",
    "generatedAt": "2026-07-23T10:00:00Z",
    "aiPolished": false
  }
}

返回字段描述

字段名数据类型是否必需详细说明
insightIdstringGateway insight ID.
petIdstringEchoed pet ID.
metricenumEchoed metric.
viewWindowenumEchoed window.
periodobjectNormalized request period.
statusenumPrimary status.
severityenumPrimary severity.
summarystringLocalized summary.
generationobjectGeneration metadata.

Bark Day

接口简介

Bark day request and response contract.

请求示例 JSON

{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "bark",
  "viewWindow": "day",
  "locale": "zh-CN",
  "petProfile": {
    "name": "Pocky",
    "species": "dog",
    "healthRiskTags": []
  },
  "period": {
    "startDate": "2026-07-21",
    "endDate": "2026-07-21",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "metrics": {
    "wearingMinutes": 1440,
    "barkDurationSeconds": 120,
    "barkEventCount": 2,
    "longestBarkEventDurationSeconds": 70,
    "baseline": {
      "baselineLower": 20,
      "baselineUpper": 150,
      "baselineSource": "personal"
    },
    "barkEvents": [
      {
        "startAt": "2026-07-21T09:00:00+08:00",
        "endAt": "2026-07-21T09:01:10+08:00",
        "durationSeconds": 70,
        "intensity": "high",
        "locationType": "home"
      },
      {
        "startAt": "2026-07-21T18:00:00+08:00",
        "endAt": "2026-07-21T18:00:50+08:00",
        "durationSeconds": 50,
        "intensity": "medium",
        "locationType": "outdoor"
      }
    ]
  }
}

请求字段表

字段名数据类型是否必需详细说明
schemaVersionstringFixed to health-detail-v3.
userIdstringCaller user ID.
petIdstringCaller pet ID.
metricenumMetric selector.
viewWindowenumView window selector.
localeenumSummary locale.
petProfileobjectPet profile.
petProfile.namestringDisplay name.
petProfile.speciesenumPet species.
petProfile.activityToleranceenum|nullActivity tolerance.
petProfile.heatToleranceenum|nullHeat tolerance.
petProfile.coldToleranceenum|nullCold tolerance.
petProfile.humidHeatSensitivityenum|nullHumid heat sensitivity.
petProfile.healthRiskTagsarray<enum>Known risk tags.
periodobjectRequested period.
period.startDatestring(date)Day requires the same start and end date.
period.endDatestring(date)Day requires the same start and end date.
period.timezonestringIANA timezone, for example Asia/Shanghai.
period.isCompletedbooleanWhether the current period is complete.
period.elapsedNightsinteger|nullElapsed nights for aggregate sleep/vital windows.
period.validNightsinteger|nullValid nights for aggregate sleep/vital windows.
metricsobjectMetric facts for the selected surface.
metrics.wearingMinutesintegerDaily wearing minutes.
metrics.barkDurationSecondsintegerTotal bark duration seconds.
metrics.barkEventCountintegerBark event count.
metrics.longestBarkEventDurationSecondsintegerLongest bark event duration seconds.
metrics.baselineobjectBark baseline baseline.
metrics.baseline.baselineLowernumber|nullBaseline lower bound.
metrics.baseline.baselineUppernumber|nullBaseline upper bound.
metrics.baseline.baselineSourceenumBaseline source.
metrics.barkEventsarray<object>Bark event list.
metrics.barkEvents[].startAtstring(date-time)Bark event start.
metrics.barkEvents[].endAtstring(date-time)Bark event end.
metrics.barkEvents[].durationSecondsintegerBark event duration seconds.
metrics.barkEvents[].intensityenumBark event intensity.
metrics.barkEvents[].locationTypeenumBark event location type.

请求字段规则

  • 不符合:Day window must use the same start and end date.修正:Match the published window definition.
  • 不符合:Numeric counts and durations must be non-negative.修正:Send zero or a positive number.

返回示例 JSON

{
  "insightId": "health_detail_01J",
  "petId": "pet-1",
  "metric": "bark",
  "viewWindow": "day",
  "period": {
    "startDate": "2026-07-21",
    "endDate": "2026-07-21",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "status": "normal",
  "severity": "none",
  "summary": "Metric is stable.",
  "generation": {
    "ruleId": "DOCUMENTATION_EXAMPLE",
    "ruleVersion": "health-detail-v3",
    "generatedAt": "2026-07-23T10:00:00Z",
    "aiPolished": false
  }
}

返回字段描述

字段名数据类型是否必需详细说明
insightIdstringGateway insight ID.
petIdstringEchoed pet ID.
metricenumEchoed metric.
viewWindowenumEchoed window.
periodobjectNormalized request period.
statusenumPrimary status.
severityenumPrimary severity.
summarystringLocalized summary.
generationobjectGeneration metadata.

Bark Week

接口简介

Bark week request and response contract.

请求示例 JSON

{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "bark",
  "viewWindow": "week",
  "locale": "zh-CN",
  "petProfile": {
    "name": "Pocky",
    "species": "dog",
    "healthRiskTags": []
  },
  "period": {
    "startDate": "2026-07-13",
    "endDate": "2026-07-19",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "metrics": {
    "wearingMinutes": 10080,
    "averageDailyBarkDurationSeconds": 120,
    "barkEventCount": 14,
    "anomalyDayCount": 0,
    "dailyBarkDurations": [
      {
        "date": "2026-07-13",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-14",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-15",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-16",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-17",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-18",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-19",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      }
    ]
  }
}

请求字段表

字段名数据类型是否必需详细说明
schemaVersionstringFixed to health-detail-v3.
userIdstringCaller user ID.
petIdstringCaller pet ID.
metricenumMetric selector.
viewWindowenumView window selector.
localeenumSummary locale.
petProfileobjectPet profile.
petProfile.namestringDisplay name.
petProfile.speciesenumPet species.
petProfile.activityToleranceenum|nullActivity tolerance.
petProfile.heatToleranceenum|nullHeat tolerance.
petProfile.coldToleranceenum|nullCold tolerance.
petProfile.humidHeatSensitivityenum|nullHumid heat sensitivity.
petProfile.healthRiskTagsarray<enum>Known risk tags.
periodobjectRequested period.
period.startDatestring(date)Week requires seven consecutive calendar days.
period.endDatestring(date)Week requires seven consecutive calendar days.
period.timezonestringIANA timezone, for example Asia/Shanghai.
period.isCompletedbooleanWhether the current period is complete.
period.elapsedNightsinteger|nullElapsed nights for aggregate sleep/vital windows.
period.validNightsinteger|nullValid nights for aggregate sleep/vital windows.
metricsobjectMetric facts for the selected surface.
previousPeriodobjectOptional adjacent previous period facts.
previousPeriod.startDatestring(date)Previous period start date.
previousPeriod.endDatestring(date)Previous period end date.
previousPeriod.isCompletedbooleanMust be true.
previousPeriod.averageDailyBarkDurationSecondsnumberPrevious average daily bark duration.
previousPeriod.barkEventCountintegerPrevious bark event count.
previousPeriod.anomalyDayCountintegerPrevious anomaly day count.
metrics.wearingMinutesintegerAggregate wearing minutes.
metrics.averageDailyBarkDurationSecondsnumberAverage daily bark duration seconds.
metrics.barkEventCountintegerAggregate bark event count.
metrics.anomalyDayCountintegerAnomaly day count.
metrics.dailyBarkDurationsarray<object>Daily bark rows.
metrics.dailyBarkDurations[].datestring(date)Calendar date.
metrics.dailyBarkDurations[].wearingMinutesinteger|nullDaily wearing minutes.
metrics.dailyBarkDurations[].barkDurationSecondsinteger|nullDaily bark duration seconds.
metrics.dailyBarkDurations[].isAnomalyboolean|nullWhether the day is anomalous.

请求字段规则

  • 不符合:Week window must cover seven consecutive days.修正:Match the published window definition.
  • 不符合:Numeric counts and durations must be non-negative.修正:Send zero or a positive number.
  • 不符合:Aggregate daily arrays must align to the requested calendar length.修正:Provide one row per calendar day in order.
  • 不符合:previousPeriod must be adjacent and complete.修正:Use the complete period immediately before the current one.

返回示例 JSON

{
  "insightId": "health_detail_01J",
  "petId": "pet-1",
  "metric": "bark",
  "viewWindow": "week",
  "period": {
    "startDate": "2026-07-13",
    "endDate": "2026-07-19",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "status": "normal",
  "severity": "none",
  "summary": "Metric is stable.",
  "generation": {
    "ruleId": "DOCUMENTATION_EXAMPLE",
    "ruleVersion": "health-detail-v3",
    "generatedAt": "2026-07-23T10:00:00Z",
    "aiPolished": false
  }
}

返回字段描述

字段名数据类型是否必需详细说明
insightIdstringGateway insight ID.
petIdstringEchoed pet ID.
metricenumEchoed metric.
viewWindowenumEchoed window.
periodobjectNormalized request period.
statusenumPrimary status.
severityenumPrimary severity.
summarystringLocalized summary.
generationobjectGeneration metadata.

Bark Month

接口简介

Bark month request and response contract.

请求示例 JSON

{
  "schemaVersion": "health-detail-v3",
  "userId": "user-1",
  "petId": "pet-1",
  "metric": "bark",
  "viewWindow": "month",
  "locale": "zh-CN",
  "petProfile": {
    "name": "Pocky",
    "species": "dog",
    "healthRiskTags": []
  },
  "period": {
    "startDate": "2026-07-01",
    "endDate": "2026-07-31",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "metrics": {
    "wearingMinutes": 44640,
    "averageDailyBarkDurationSeconds": 120,
    "barkEventCount": 62,
    "anomalyDayCount": 0,
    "dailyBarkDurations": [
      {
        "date": "2026-07-01",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-02",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-03",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-04",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-05",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-06",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-07",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-08",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-09",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-10",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-11",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-12",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-13",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-14",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-15",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-16",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-17",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-18",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-19",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-20",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-21",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-22",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-23",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-24",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-25",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-26",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-27",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-28",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-29",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-30",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      },
      {
        "date": "2026-07-31",
        "wearingMinutes": 1440,
        "barkDurationSeconds": 120,
        "isAnomaly": false
      }
    ]
  }
}

请求字段表

字段名数据类型是否必需详细说明
schemaVersionstringFixed to health-detail-v3.
userIdstringCaller user ID.
petIdstringCaller pet ID.
metricenumMetric selector.
viewWindowenumView window selector.
localeenumSummary locale.
petProfileobjectPet profile.
petProfile.namestringDisplay name.
petProfile.speciesenumPet species.
petProfile.activityToleranceenum|nullActivity tolerance.
petProfile.heatToleranceenum|nullHeat tolerance.
petProfile.coldToleranceenum|nullCold tolerance.
petProfile.humidHeatSensitivityenum|nullHumid heat sensitivity.
petProfile.healthRiskTagsarray<enum>Known risk tags.
periodobjectRequested period.
period.startDatestring(date)Month requires one complete natural month.
period.endDatestring(date)Month requires one complete natural month.
period.timezonestringIANA timezone, for example Asia/Shanghai.
period.isCompletedbooleanWhether the current period is complete.
period.elapsedNightsinteger|nullElapsed nights for aggregate sleep/vital windows.
period.validNightsinteger|nullValid nights for aggregate sleep/vital windows.
metricsobjectMetric facts for the selected surface.
previousPeriodobjectOptional adjacent previous period facts.
previousPeriod.startDatestring(date)Previous period start date.
previousPeriod.endDatestring(date)Previous period end date.
previousPeriod.isCompletedbooleanMust be true.
previousPeriod.averageDailyBarkDurationSecondsnumberPrevious average daily bark duration.
previousPeriod.barkEventCountintegerPrevious bark event count.
previousPeriod.anomalyDayCountintegerPrevious anomaly day count.
metrics.wearingMinutesintegerAggregate wearing minutes.
metrics.averageDailyBarkDurationSecondsnumberAverage daily bark duration seconds.
metrics.barkEventCountintegerAggregate bark event count.
metrics.anomalyDayCountintegerAnomaly day count.
metrics.dailyBarkDurationsarray<object>Daily bark rows.
metrics.dailyBarkDurations[].datestring(date)Calendar date.
metrics.dailyBarkDurations[].wearingMinutesinteger|nullDaily wearing minutes.
metrics.dailyBarkDurations[].barkDurationSecondsinteger|nullDaily bark duration seconds.
metrics.dailyBarkDurations[].isAnomalyboolean|nullWhether the day is anomalous.

请求字段规则

  • 不符合:Month window must cover one natural month.修正:Match the published window definition.
  • 不符合:Numeric counts and durations must be non-negative.修正:Send zero or a positive number.
  • 不符合:Aggregate daily arrays must align to the requested calendar length.修正:Provide one row per calendar day in order.
  • 不符合:previousPeriod must be adjacent and complete.修正:Use the complete period immediately before the current one.

返回示例 JSON

{
  "insightId": "health_detail_01J",
  "petId": "pet-1",
  "metric": "bark",
  "viewWindow": "month",
  "period": {
    "startDate": "2026-07-01",
    "endDate": "2026-07-31",
    "timezone": "Asia/Shanghai",
    "isCompleted": true
  },
  "status": "normal",
  "severity": "none",
  "summary": "Metric is stable.",
  "generation": {
    "ruleId": "DOCUMENTATION_EXAMPLE",
    "ruleVersion": "health-detail-v3",
    "generatedAt": "2026-07-23T10:00:00Z",
    "aiPolished": false
  }
}

返回字段描述

字段名数据类型是否必需详细说明
insightIdstringGateway insight ID.
petIdstringEchoed pet ID.
metricenumEchoed metric.
viewWindowenumEchoed window.
periodobjectNormalized request period.
statusenumPrimary status.
severityenumPrimary severity.
summarystringLocalized summary.
generationobjectGeneration metadata.

AI日记生成

/v1/pet-diaries/generate 使用 V2 请求结构。主服务传 user_id、可选 locale,以及完整 dailyDiarySnapshotpet_iddailyDiarySnapshot.petProfile.petId 派生,不再作为顶层字段传入。

POST /v1/pet-diaries/generate

根据当天事实快照生成宠物日记。默认响应只返回主服务展示、落库和配图选择需要的字段;include_debug=true 时才返回调试字段。

调用语义:同一 user_iddailyDiarySnapshot.petProfile.petId 与日期的成功日记会直接返回已保存结果,不会重复调用模型;hasActiveP0=true 时保留可信正文,但推送候选文案和宠物一句话均为空。

AI日记生成请求字段

字段位置类型必填枚举/范围说明
AuthorizationHeaderstringBearer API Key需要允许访问 /v1/pet-diaries/generate 且允许模型 uah-diary
X-Request-IDHeaderstring1-128调用方链路追踪 ID。
request_idBodystring|null1-128请求链路 ID。
user_idBodystring1-128用户 ID;未传时使用默认临时 ID。
localeBodystring|nullzh-CN / en-US / null不传或传 null 时返回中英双语。
dailyDiarySnapshotBodyobjectDailyDiarySnapshotV2当天事实快照根对象。
dailyDiarySnapshot.petProfile.petIdBodystring1-128宠物 ID;必须与 dailyDiarySnapshot.diaryTimeline.petId 一致。
dailyDiarySnapshot.petProfile.petNameBodystring1-128宠物昵称。
dailyDiarySnapshot.petProfile.speciesBodystringdog / cat宠物类型。
dailyDiarySnapshot.petProfile.breedBodystring|null0-128品种名称。
dailyDiarySnapshot.petProfile.breedTags[]Bodystring[]-品种标签。
dailyDiarySnapshot.petProfile.bodySizeBodystring|nulltoy / small / medium / large / giant体型枚举,对齐品种基线 body_size_class
dailyDiarySnapshot.petProfile.ageMonthsBodyinteger|null>= 0宠物月龄。
dailyDiarySnapshot.petProfile.ageStageBodystring|nullpuppy / adult / senior生命阶段;猫幼年也使用 puppy
dailyDiarySnapshot.environmentContext.dateBodydateYYYY-MM-DD日记日期;必须与 dailyDiarySnapshot.diaryTimeline.date 一致。
dailyDiarySnapshot.environmentContext.timezoneBodystring1-64日记时区。
dailyDiarySnapshot.environmentContext.weekdayBodystring|null-规范英文星期名;日期行的星期由 date 按 locale 渲染。
dailyDiarySnapshot.environmentContext.weatherBodystring|null-天气文本。
dailyDiarySnapshot.environmentContext.temperatureBodyobject|nullcurrentC / minC / maxC 均为 number|null温度对象;不接受数值或字符串简写。
dailyDiarySnapshot.environmentContext.seasonBodystring|nullspring / summer / autumn / winter季节。
dailyDiarySnapshot.environmentContext.specialDayBodystring|null0-128生日、节日、纪念日等重要日期。
dailyDiarySnapshot.previousNightSleep.totalMinutesBodyinteger0-1440昨晚总睡眠分钟数;对象存在时必填。
dailyDiarySnapshot.previousNightSleep.wakeCountBodyinteger|null>= 0昨晚醒动次数。
dailyDiarySnapshot.eveningRestStart.startedAtBodystringHH:mm当晚开始安静的本地时刻;对象存在时必填。
dailyDiarySnapshot.dailyActivity.activeMinutesBodyinteger|null>= 0当天累计活动分钟数。
dailyDiarySnapshot.dailyActivity.stepsBodyinteger|null>= 0当天累计步数。
dailyDiarySnapshot.dailyActivity.outdoorMinutesBodyinteger|null>= 0当天累计户外分钟数。
dailyDiarySnapshot.diaryTimeline.schemaVersionBodystring1-32时间线 schema 版本。
dailyDiarySnapshot.diaryTimeline.mainSceneSegments[]BodyarrayMainSceneSegment[]当天主场景分段。
dailyDiarySnapshot.diaryTimeline.mainSceneSegments[].sceneTypeBodystringhome / away主场景类型;不接受 unknown
dailyDiarySnapshot.diaryTimeline.mainSceneSegments[].startTimeBodystring|null0-64开始时间文本。
dailyDiarySnapshot.diaryTimeline.mainSceneSegments[].endTimeBodystring|null0-64结束时间文本。
dailyDiarySnapshot.diaryTimeline.mainSceneSegments[].placeSummary.placeNameBodystring|null0-128地点名称。
dailyDiarySnapshot.diaryTimeline.mainSceneSegments[].placeSummary.placeTypeBodystring|null0-64地点类型,如 homeparkclinic
dailyDiarySnapshot.diaryTimeline.mainSceneSegments[].outingActivityTypeBodystring|nullwalk / other外出活动类型;仅 away 时可传。
dailyDiarySnapshot.diaryTimeline.mainSceneSegments[].walkMetrics.durationMinBodyinteger|null>= 0步行时长分钟数;仅 away + walk 时传。
dailyDiarySnapshot.diaryTimeline.mainSceneSegments[].walkMetrics.distanceKmBodynumber|null>= 0步行距离公里数。
dailyDiarySnapshot.diaryTimeline.mainSceneSegments[].walkMetrics.stepsBodyinteger|null>= 0步行步数。
dailyDiarySnapshot.diaryTimeline.mainSceneSegments[].companionNameBodystring|null0-128陪同人姓名;仅高可信时传。
dailyDiarySnapshot.diaryTimeline.outingTimeline[]BodyarrayOutingTimelineEvent[]外出过程事件列表,用于表达从出门、到达地点、离开地点到回家的顺序。
dailyDiarySnapshot.diaryTimeline.outingTimeline[].typeBodystringdepart / arrive_place / leave_place / return_home / enter_zone / leave_zone外出时间线事件类型;区域事件必须携带 place.zoneRole
dailyDiarySnapshot.diaryTimeline.outingTimeline[].occurredTimeBodystring|null0-64事件发生时间文本,建议传本地时间,如 14:05
dailyDiarySnapshot.diaryTimeline.outingTimeline[].place.placeNameBodystring|null0-128事件关联地点名称。
dailyDiarySnapshot.diaryTimeline.outingTimeline[].place.placeTypeBodystring|null0-64事件关联地点类型。
dailyDiarySnapshot.diaryTimeline.healthTimeline[]BodyarrayHealthTimelineEvent[]健康指标事实列表,只表达 HR / HRV / RR 的可信数值事实,不承载诊断、原因解释或展示文案。
dailyDiarySnapshot.diaryTimeline.healthTimeline[].typeBodystringheart_rate / hrv / respiration_rate健康指标类型。
dailyDiarySnapshot.diaryTimeline.healthTimeline[].occurredTimeBodystring|null0-64指标发生时间文本,建议传本地时间或时间段,如 20:10night
dailyDiarySnapshot.diaryTimeline.healthTimeline[].heartRateBpmBodynumber|null> 0心率,单位 bpm;仅 type=heart_rate 时使用。
dailyDiarySnapshot.diaryTimeline.healthTimeline[].hrvMsBodynumber|null> 0HRV,单位 ms;仅 type=hrv 时使用。
dailyDiarySnapshot.diaryTimeline.healthTimeline[].respirationRateRpmBodynumber|null> 0呼吸率,单位 rpm;仅 type=respiration_rate 时使用。
dailyDiarySnapshot.diaryTimeline.healthTimeline[].baselineValueBodynumber|null> 0对应指标的个体基线值,单位与当前指标一致。
dailyDiarySnapshot.diaryTimeline.healthTimeline[].baselineDiffPercentBodynumber|null-当前值相对个体基线的变化百分比;正数表示高于基线,负数表示低于基线。
dailyDiarySnapshot.diaryTimeline.behaviorTimeline[]BodyarrayBehaviorTimelineEvent[]行为时间线事件列表,用于表达叫声、进食、喝水、抓挠、转圈、甩头、舔舐等行为。
dailyDiarySnapshot.diaryTimeline.behaviorTimeline[].typeBodystringbark / drink / eat / scratch / circle / head_shake / lick行为时间线事件类型。
dailyDiarySnapshot.diaryTimeline.behaviorTimeline[].occurredTimeBodystring|null0-64行为发生时间文本,建议传本地时间或时间段,如 16:20afternoon
dailyDiarySnapshot.diaryTimeline.behaviorTimeline[].durationMinBodyinteger|null>= 0行为持续分钟数。
dailyDiarySnapshot.imageHistory.recentImages[]Bodyarray由近到远已实际展示给该宠物的配图历史;缺省等价于空数组。
dailyDiarySnapshot.imageHistory.recentImages[].sceneIdBodystring|null1-128已展示配图所属的图库场景 ID;配图冷却按它计算。
dailyDiarySnapshot.imageHistory.recentImages[].imageIdBodystring|null1-128图库图片 ID;只传 imageId 时由网关反查场景。与 sceneId 至少提供一个。
dailyDiarySnapshot.imageHistory.recentImages[].usedDateBodydateYYYY-MM-DD该配图实际展示的本地日期。
template_idBodystring|null1-128模板 ID,仅用于测试或追踪。
template_versionBodystring|null1-64模板版本,仅用于测试或追踪。

dailyDiarySnapshot.imageHistory 与配图冷却

响应里的 image_scene_id 从当前物种的全部图库场景中选出(狗 54 个、猫 50 个):带 date_rule 的节日和季节场景只在该日期规则成立时参选;再按季节、天气、在家/外出、活动匹配打分;最后对冷却窗口(默认 14 天)内已用过的场景降权,实现轮换。

冷却历史来自三处并集:本次请求的 imageHistory.recentImages、网关已保存日记的历史配图、网关自身的每日选图记录。因此主服务即使暂时不回传历史,同一场景也不会连日重复。

{
  "imageHistory": {
    "recentImages": [
      { "sceneId": "outdoor_walk_autumn", "usedDate": "2026-06-28" },
      { "sceneId": "indoor_curl_sleep", "usedDate": "2026-06-26" }
    ]
  }
}

时间线片段示例

三个时间线都按时间顺序传入。外出和行为事件使用固定枚举;健康时间线只保留 HR / HRV / RR 指标事实。

{
  "outingTimeline": [
    {
      "type": "depart",
      "occurredTime": "14:05",
      "place": {
        "placeName": "Home",
        "placeType": "home"
      }
    },
    {
      "type": "arrive_place",
      "occurredTime": "14:22",
      "place": {
        "placeName": "Central Park",
        "placeType": "park"
      }
    },
    {
      "type": "leave_place",
      "occurredTime": "15:35",
      "place": {
        "placeName": "Central Park",
        "placeType": "park"
      }
    },
    {
      "type": "return_home",
      "occurredTime": "15:52",
      "place": {
        "placeName": "Home",
        "placeType": "home"
      }
    }
  ],
  "healthTimeline": [
    {
      "type": "heart_rate",
      "occurredTime": "20:10",
      "heartRateBpm": 110,
      "baselineValue": 73,
      "baselineDiffPercent": 50.7
    },
    {
      "type": "hrv",
      "occurredTime": "night",
      "hrvMs": 42,
      "baselineValue": 50,
      "baselineDiffPercent": -16
    },
    {
      "type": "respiration_rate",
      "occurredTime": "21:00",
      "respirationRateRpm": 28,
      "baselineValue": 22,
      "baselineDiffPercent": 27.3
    }
  ],
  "behaviorTimeline": [
    {
      "type": "bark",
      "occurredTime": "16:20",
      "durationMin": 4
    },
    {
      "type": "eat",
      "occurredTime": "18:10",
      "durationMin": 8
    }
  ]
}

请求示例

{
  "request_id": "req_diary_001",
  "user_id": "temporary",
  "locale": null,
  "dailyDiarySnapshot": {
    "petProfile": {
      "petId": "temporary",
      "petName": "Milo",
      "species": "dog",
      "breed": "Labrador",
      "breedTags": ["retriever"],
      "bodySize": "large",
      "ageStage": "adult",
      "ageMonths": 48
    },
    "environmentContext": {
      "date": "2026-07-01",
      "timezone": "Asia/Shanghai",
      "weekday": "Wednesday",
      "weather": "sunny",
      "temperature": {
        "currentC": 26
      },
      "season": "summer",
      "specialDay": "birthday"
    },
    "previousNightSleep": {
      "totalMinutes": 540,
      "wakeCount": 2
    },
    "eveningRestStart": {
      "startedAt": "21:30"
    },
    "dailyActivity": {
      "activeMinutes": 70,
      "steps": 5200,
      "outdoorMinutes": 60
    },
    "diaryTimeline": {
      "schemaVersion": "1.0",
      "mainSceneSegments": [
        {
          "sceneType": "away",
          "startTime": "14:05",
          "endTime": "15:52",
          "placeSummary": {
            "placeName": "Central Park",
            "placeType": "park"
          },
          "outingActivityType": "walk",
          "walkMetrics": {
            "durationMin": 107,
            "distanceKm": 1.3,
            "steps": 1900
          }
        }
      ],
      "outingTimeline": [
        {
          "type": "depart",
          "occurredTime": "14:05",
          "place": {
            "placeName": "Home",
            "placeType": "home"
          }
        },
        {
          "type": "arrive_place",
          "occurredTime": "14:22",
          "place": {
            "placeName": "Central Park",
            "placeType": "park"
          }
        },
        {
          "type": "return_home",
          "occurredTime": "15:52",
          "place": {
            "placeName": "Home",
            "placeType": "home"
          }
        }
      ],
      "healthTimeline": [
        {
          "type": "heart_rate",
          "occurredTime": "20:10",
          "heartRateBpm": 110,
          "baselineValue": 73,
          "baselineDiffPercent": 50.7
        }
      ],
      "behaviorTimeline": [
        {
          "type": "bark",
          "occurredTime": "16:20",
          "durationMin": 4
        }
      ]
    },
    "imageHistory": {
      "recentImages": [
        { "sceneId": "outdoor_walk_summer", "usedDate": "2026-06-30" },
        { "sceneId": "indoor_curl_sleep", "usedDate": "2026-06-28" }
      ]
    }
  },
  "template_id": "park_day",
  "template_version": "v2"
}

AI Diary generation response fields

diary_idstringyesdia_*Diary record ID.
request_idstringyes1-128Request trace ID.
datedateyesYYYY-MM-DDDiary date.
image_scene_idstring|nullnoscene ID or nullRecommended diary image scene ID.
contentsobjectyeszh-CN / en-USLocalized diary contents. Default bilingual requests return both keys; explicit locale requests return the requested key only.
contents.zh-CN.date_linestringconditional-Chinese display date line.
contents.zh-CN.paragraphs[]string[]conditional-Chinese diary paragraphs.
contents.zh-CN.pet_one_linerstringconditional-Chinese pet one-liner.
contents.zh-CN.push_titlestring|nullconditional-Chinese recommended push title.
contents.zh-CN.push_bodystring|nullconditional-Chinese recommended push body.
contents.en-US.date_linestringconditional-English display date line.
contents.en-US.paragraphs[]string[]conditional-English diary paragraphs.
contents.en-US.pet_one_linerstringconditional-English pet one-liner.
contents.en-US.push_titlestring|nullconditional-English recommended push title.
contents.en-US.push_bodystring|nullconditional-English recommended push body.
generation_statusstringyesGENERATED / GENERATED_PUSH_SUPPRESSED_BY_SAFETY / DATA_INSUFFICIENT / FAILED_GENERATION / FAILED_SAFE_CHECKGeneration status.
failure_reasonstring|nullnoreason code or nullFailure reason.

Response example

{
  "diary_id": "dia_xxx",
  "request_id": "req_diary_001",
  "date": "2026-07-01",
  "image_scene_id": "birthday_outdoor",
  "contents": {
    "zh-CN": {
      "date_line": "2026-07-01 Wednesday",
      "paragraphs": [
        "Milo had a birthday walk at Central Park today.",
        "Milo barked briefly around 16:20, like a small report about the day."
      ],
      "pet_one_liner": "I remember the park.",
      "push_title": "Milo had a birthday walk today",
      "push_body": "Milo spent a little over an hour at the park."
    },
    "en-US": {
      "date_line": "Wednesday, July 1, 2026",
      "paragraphs": [
        "Today was Milo's birthday. In the afternoon, Milo went to Central Park and walked for a little over an hour.",
        "Around 16:20, Milo barked briefly, almost like reporting the day's discoveries."
      ],
      "pet_one_liner": "Birthday grass. I remember.",
      "push_title": "Milo had a birthday walk today",
      "push_body": "Milo spent a little over an hour at the park and gave a small report afterward."
    }
  },
  "generation_status": "GENERATED",
  "failure_reason": null
}

GET /v1/pet-diaries

AI Diary list request fields

user_idQuerystring|nullno1-128Filter by user ID.

AI Diary list response fields

items[].diary_idstringyesdia_*Diary record ID.
items[].contents.zh-CN.paragraphs[]string[]conditional-Chinese diary paragraphs.
items[].contents.en-US.paragraphs[]string[]conditional-English diary paragraphs.

Response example

{
  "items": [
    {
      "diary_id": "dia_xxx",
      "contents": {
        "zh-CN": {
          "paragraphs": ["Milo spent a little over an hour at the park today."]
        },
        "en-US": {
          "paragraphs": ["Milo spent a little over an hour at the park today."]
        }
      }
    }
  ]
}

GET /v1/pet-diaries/{diary_id}

AI Diary detail request fields

diary_idPathstringyesdia_*Diary record ID.

AI Diary detail response fields

diary_idstringyesdia_*Diary record ID.
contents.zh-CN.paragraphs[]string[]conditional-Chinese diary paragraphs.
contents.en-US.paragraphs[]string[]conditional-English diary paragraphs.

Response example

{
  "diary_id": "dia_xxx",
  "contents": {
    "zh-CN": {
      "paragraphs": ["Milo spent a little over an hour at the park today."]
    },
    "en-US": {
      "paragraphs": ["Milo spent a little over an hour at the park today."]
    }
  }
}

POST /v1/pet-diaries/feedback

Submit feedback for an AI diary. Re-submitting a diary ID replaces its latest feedback.

Request example

{
  "diary_id": "dia_123456",
  "liked": true,
  "shared": false
}
diary_idstringrequiredAI diary ID; the diary must already exist.
likedbooleanone requiredWhether the user likes the diary.
sharedbooleanone requiredWhether the user shared the diary.

Provide liked, shared, or both. An omitted value does not overwrite an existing annotation.

Response example

{
  "result": {
    "code": 200,
    "message": "success",
    "request_id": "req_xxx"
  }
}

元数据与 Admin

GET /v1/app-metadata/diary-image-library-scenes

查询日记配图库场景目录。默认返回当前 V4.3;可传短写或完整版本号切换,例如 version=V4.2version=feishu-v4.2-2026-07-03/v1/pet-diary-images/generatescene_ids 必须来自所选版本的这个接口。

请求参数

字段位置类型必填说明
profileQuerystring|null可选 dogcat;不传则返回两类。
versionQuerystring|null提示词目录版本。可传完整版本号或短写 V3.0/V4.0/V4.1/V4.2/V4.3;不传使用当前默认 V4.3。

返回字段

version 为当前返回目录版本;available_versions 为可切换版本列表;counts 包含 dog/cat 场景数量;groups[]profilecategory 分组;groups[].scenes[] 包含 scene_idtitle_zhcategorydate_ruletranslation_zhprompt_preview

GET /v1/app-metadata/diary-image-scenes

查询日记配图场景目录。

请求参数

字段位置类型必填说明
speciesQuerystring按宠物物种过滤场景目录;支持 dogcat,不传则返回全部。

元数据场景枚举取值

字段枚举值说明
speciesdog / cat请求过滤物种。
scenes[].speciesdog / cat该日记配图场景支持的宠物物种。
scenes[].categorycommon / federal_holiday / personal / species_day日记配图场景分类。
scenes[].recommended_poselying / sitting / walking / running推荐使用的身份姿态图。

返回字段

scenes[] 包含 scene_idtitle_zhtitle_encategoryspeciesseasonweatherlocationactivityrecommended_poseprompt_zhprompt_en

GET /v1/app-metadata/insight-fields

查询首页洞察字段目录。

返回字段

version 是目录版本;groups 是字段分组;fields 是字段定义列表。

GET /v1/app-metadata/insight-scenarios

查询 AI 洞察测试场景模板。

返回字段

templates[] 包含 template_idtitle_zhsnapshot

POST /v1/app-metadata/insight-scenarios/{template_id}/generate

按模板生成洞察测试快照。/v1/app-metadata/insight-random 生成随机洞察快照。

请求参数

字段位置类型必填说明
template_idPathstring模板 ID。
seedBodyinteger|null随机种子,便于复现。
dateBodydate|null洞察随机接口不使用;日记随机接口可使用。

GET /v1/app-metadata/diary-scenarios

查询宠物日记测试场景模板。

POST /v1/app-metadata/diary-scenarios/{template_id}/generate 按模板生成日记快照;POST /v1/app-metadata/diary-random 生成随机日记快照。请求 Body 支持 seeddate

GET /v1/admin/usage/summary

查询用量汇总。需要 admin Key。

请求参数

字段位置类型必填说明
start_dateQuerydate|null开始日期。
end_dateQuerydate|null结束日期,不能早于 start_date
api_key_nameQuerystring|null按 Key 名筛选。
business_typeQuerystring|null按业务类型筛选。
endpointQuerystring|null按接口路径筛选。
statusQuerystring|nullsuccessfailed
group_byQuerystring|nullbusiness_typemodelendpointapi_key

Admin 请求/响应枚举取值

字段枚举值说明
statussuccess / failed请求筛选和用量明细返回状态。
group_bybusiness_type / model / endpoint / api_key汇总分组维度。可选值:business_type / model / endpoint / api_key。
business_typegeneral / app-avatar / animation / app-diary-image-library / app-health常见业务类型;实际值来自 API Key 配置和用量记录。

返回 JSON

{
  "total_requests": 12,
  "success_requests": 10,
  "failed_requests": 2,
  "total_input_tokens": 1800,
  "total_output_tokens": 900,
  "estimated_cost": 1.23,
  "unpriced_requests": 0,
  "by_business_type": [
    {
      "value": "app-avatar",
      "business_type": "app-avatar",
      "model": null,
      "model_alias": null,
      "endpoint": null,
      "api_key": null,
      "api_key_name": null,
      "requests": 4,
      "success_requests": 4,
      "failed_requests": 0,
      "total_input_tokens": 0,
      "total_output_tokens": 0,
      "estimated_cost": 0.8,
      "unpriced_requests": 0
    }
  ],
  "by_model": [],
  "by_endpoint": [],
  "by_api_key": []
}

返回字段

字段类型说明
total_requestsinteger总请求数。
success_requestsinteger成功请求数。
failed_requestsinteger失败请求数。
total_input_tokensinteger输入 token 总数。
total_output_tokensinteger输出 token 总数。
estimated_costnumber|null估算费用;为空表示无法完整定价。
unpriced_requestsinteger未定价请求数。
by_business_typearray按业务类型分组的用量汇总。
by_modelarray按模型分组的用量汇总。
by_endpointarray按接口路径分组的用量汇总。
by_api_keyarray按 API Key 分组的用量汇总。
*.requestsinteger该分组内的总请求数。
*.success_requestsinteger该分组内的成功请求数。
*.failed_requestsinteger该分组内的失败请求数。
*.estimated_costnumber|null该分组内的估算费用。
*.unpriced_requestsinteger该分组内无法定价的请求数。

GET /v1/admin/usage/logs

查询用量明细。需要 admin Key。

请求参数

支持 summary 的全部筛选参数,另有 page 默认 1、page_size 默认 20 且范围 1-100。

返回 JSON

{
  "page": 1,
  "page_size": 20,
  "total": 1,
  "items": [
    {
      "request_id": "req_xxx",
      "api_key_name": "app-avatar",
      "business_type": "app-avatar",
      "user_id": "temporary",
      "pet_id": "temporary",
      "endpoint": "/v1/pet-animation/generate",
      "provider": "openrouter",
      "model_alias": "uah-animation",
      "provider_model": "bytedance/seedance-2.0-fast",
      "provider_request_id": "provider_req_xxx",
      "billing_type": "video",
      "input_tokens": null,
      "output_tokens": null,
      "unit_count": 4,
      "unit_price": 0.2,
      "estimated_cost": 0.8,
      "currency": "CNY",
      "latency_ms": 1200,
      "http_status": 200,
      "status": "success",
      "error_code": null,
      "retry_count": 0,
      "is_stream": false,
      "prompt_version": "v1",
      "used_fallback": false,
      "created_at": "2026-07-02T10:00:00Z"
    }
  ]
}

返回字段

字段类型说明
pageinteger当前页码。
page_sizeinteger每页数量。
totalinteger总记录数。
items[].request_idstring请求 ID。
items[].api_key_namestring|nullAPI Key 名称。
items[].business_typestring|null业务类型。
items[].endpointstring接口路径。
items[].providerstring|null上游供应商。
items[].model_aliasstring|null网关模型别名。
items[].provider_modelstring|null上游模型名称。
items[].billing_typestring|null计费类型,如 token、image、video、request 等,实际值来自记录。
items[].input_tokensinteger|null本次请求输入 token 数。
items[].output_tokensinteger|null本次请求输出 token 数。
items[].unit_countinteger|null非 token 计费单位数量,例如图片张数、视频秒数或请求次数。
items[].unit_pricenumber|null单价;为空表示该条记录无法完整定价。
items[].estimated_costnumber|null估算费用。
items[].currencystring|null费用币种,例如 CNY。
items[].http_statusinteger|nullHTTP 状态码。
items[].statusstring|null请求结果状态,通常为 success 或 failed。
items[].error_codestring|null错误码;成功时为空。
items[].retry_countinteger重试次数。
items[].is_streamboolean是否为流式请求。
items[].used_fallbackbooleanWhether fallback model was used.
items[].prompt_versionstring|null本次请求使用的提示词版本。
items[].created_atdatetimeCreation timestamp.