返回中文文档

BaZi 字典 API

BaZi 字典 API

GET/api/v1/chinese/bazi/dictionary

该接口返回 BaZi Flow 等接口使用的 ID 映射表。你可以在应用启动时缓存它,再把 Flow 响应里的整数 ID 解析成可读的作用关系、神煞和中文术语。

完整 URL

https://api.freeastroapi.com/api/v1/chinese/bazi/dictionary

推荐用法

  1. 应用启动时请求一次字典 API。
  2. 把结果缓存到 localStorage、内存、数据库或服务端缓存。
  3. 调用 /flow 时使用默认的 dictionary_response: false
  4. 在前端或服务端用缓存字典解析整数 ID。

ID 范围

ID 范围类型示例
1000-1999Stem Combinations甲-己合, 乙-庚合, etc.
2000-2999Branch Clashes子午冲, 丑未冲, etc.
3000-3099Six Harmonies子丑合, 寅亥合, etc.
3100-3199Three Harmonies寅午戌, 申子辰, etc.
3200-3299Harms (Hai)子未害, 丑午害, etc.
3300-3399Breaks (Po)子酉破, 丑辰破, etc.
3400-3499Punishments (Xing)寅巳申刑, etc.
4000-4999Stars (Shen Sha)天乙贵人, 桃花, etc.

请求参数

这是一个没有参数的 GET 请求。只需要在 header 中提供 API key。

调用示例

curl -X GET "https://api.freeastroapi.com/api/v1/chinese/bazi/dictionary" \
 -H "x-api-key: YOUR_API_KEY"

响应示例

{
  "1000": {
    "type": "Stem Combination",
    "name": "甲-己 Combination",
    "name_zh": "甲己合",
    "stems": ["甲", "己"],
    "transform_to": "Earth",
    "description": "Wood and Earth combine, can transform to Earth element"
  },
  "2000": {
    "type": "Branch Clash",
    "name": "子-午 Clash",
    "name_zh": "子午冲",
    "branches": ["子", "午"],
    "elements": ["Water", "Fire"],
    "description": "Rat-Horse opposition, Water-Fire conflict"
  },
  "3000": {
    "type": "Branch Six Harmony",
    "name": "子-丑 Harmony",
    "name_zh": "子丑合",
    "branches": ["子", "丑"],
    "transform_to": "Earth"
  },
  "4000": {
    "name": "Tian Yi Nobleman",
    "name_zh": "天乙贵人",
    "id": "star_nobleman",
    "category": "Beneficial",
    "description": "The greatest protective star, brings help from influential people"
  }
}

相关接口