API Guide

/api/v1/candidates 标准增量调用

这页只解释标准调用流程,不会在浏览器里自动发送带 token 的请求。增量场景推荐直接用 since;服务端也兼容 updated_after

文档分工

如果你在给 ERP、AI 服务或内部脚本接入,请先看主文档,再回这页复制 curl 示例。

标准规则

标准 endpoint 形态:/api/v1/candidates?platform=facebook&since=2026-04-01T00:00:00.000Z&sort=updated_time_asc&page_size=50

标准续拉终止条件:meta.next_cursor == null

第一次增量请求

curl -H "Authorization: Bearer $CUSTOMER_API_TOKEN" \
  "https://productsdev.com/api/v1/candidates?platform=facebook&since=2026-04-01T00:00:00.000Z&sort=updated_time_asc&page_size=50"

继续下一页

curl -H "Authorization: Bearer $CUSTOMER_API_TOKEN" \
  "https://productsdev.com/api/v1/candidates?platform=facebook&since=2026-04-01T00:00:00.000Z&sort=updated_time_asc&page_size=50&cursor=<meta.next_cursor>"

互动字段与筛选

curl -H "Authorization: Bearer $CUSTOMER_API_TOKEN" \
  "https://productsdev.com/api/v1/candidates?platform=facebook&engagement_primary_min=100&engagement_primary_max=500&engagement_secondary_min=20&sort=engagement_primary_desc&page_size=50"

Facebook 重复素材聚合

如果 ERP 列表页想先合并重复 Facebook 素材,再让操作员点进 detail 看代表卡片,可以显式带 view=creative_groups

curl -H "Authorization: Bearer $CUSTOMER_API_TOKEN" \
  "https://productsdev.com/api/v1/candidates?platform=facebook&view=creative_groups&page=1&page_size=50"

列表返回字段(/api/v1/candidates)

总量解释字段(/api/v1/meta)

什么时候再读 detail

列表只负责增量发现;如果要做 AI 深度分析,再按候选 ID 读取 detail。Facebook 的 candidate_id 常含完整 URL 和 ?,不要把原值直接拼进路径。推荐使用 https://productsdev.com/api/v1/candidates/detail?candidate_id=<urlencoded candidate_id>。如果只是要写 keyword feedback,不需要先读 detail,直接复用列表里的 keyword_feedback_key 即可。

curl -H "Authorization: Bearer $CUSTOMER_API_TOKEN" \
  "https://productsdev.com/api/v1/candidates/detail?candidate_id=<urlencoded candidate_id>&include=raw_html"