开发者 API

Base URL 为当前域名。示例:

curl https://oil.fansys.top/api/prices?province=上海
curl https://oil.fansys.top/api/prices?oil=95
curl https://oil.fansys.top/api/history
curl https://oil.fansys.top/api/trend?province=上海&oil=95
curl https://oil.fansys.top/api/meta
curl https://oil.fansys.top/api/forecast
curl https://oil.fansys.top/api/export.csv

Webhook:订阅调价变更可轮询 /api/meta 的 last_change_at(价格变化时才更新),或订阅 /rss.xml。last_checked_at 为上次抓取检查时间,fetched_at 与 last_change_at 同值(兼容保留)。暂不提供推送服务。

在线 Playground

点“请求”查看返回

接口一览

  • GET /api/prices[?province=&oil=] — 全部 / 按省 / 按油号
  • GET /api/history — 历史快照
  • GET /api/trend?province=&oil= — 单省单油号走势
  • GET /api/meta — 更新时间、下次调整、数据质量
  • GET /api/forecast — 国际油价预测(含各省预测价 + 每升变动)
  • GET /api/ai-interpretation?province= — AI 解读(Workers AI,只用已验证数据,失败回退规则解读,缓存 1 小时)
  • GET /api/global — 全球对比(已接入:欧盟 27 国 + 美国 + 中国)
  • GET /api/cities — 城市级(已接入:124 个城市)
  • GET /api/export.csv — CSV 导出