返回中文文档
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推荐用法
- 应用启动时请求一次字典 API。
- 把结果缓存到 localStorage、内存、数据库或服务端缓存。
- 调用
/flow时使用默认的dictionary_response: false。 - 在前端或服务端用缓存字典解析整数 ID。
ID 范围
| ID 范围 | 类型 | 示例 |
|---|---|---|
| 1000-1999 | Stem Combinations | 甲-己合, 乙-庚合, etc. |
| 2000-2999 | Branch Clashes | 子午冲, 丑未冲, etc. |
| 3000-3099 | Six Harmonies | 子丑合, 寅亥合, etc. |
| 3100-3199 | Three Harmonies | 寅午戌, 申子辰, etc. |
| 3200-3299 | Harms (Hai) | 子未害, 丑午害, etc. |
| 3300-3399 | Breaks (Po) | 子酉破, 丑辰破, etc. |
| 3400-3499 | Punishments (Xing) | 寅巳申刑, etc. |
| 4000-4999 | Stars (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"
}
}