返回中文文档
四柱八字 API
四柱八字 API
POST
/api/v1/chinese/bazi该接口根据出生日期、时间和地点计算完整的 Four Pillars of Destiny(八字)结构,包含 Day Master 分析、Ten Gods、Life Stages、五行平衡,以及可选的专业功能。
完整 URL
https://api.freeastroapi.com/api/v1/chinese/bazi可用功能
四柱
Year、Month、Day、Hour 及 Stems & Branches。
十神
每个 stem 与 Day Master 的关系。
藏干
每个 branch 内部的能量。
十二长生
每柱的 12 Di Shi(成长阶段)。
大运
返回从出生开始推算的 10 年 Da Yun periods。
五行平衡
五行点数分布。
Pinyin
中文字符的罗马化。
神煞
天乙、桃花等。
作用关系
合、冲、害、刑等。
专业分析
日主强弱、格局、用神分析。
time_standard 选择
civil
直接使用标准钟表时间。最适合现代出生。
true_solar
基于经度将钟表时间转换为 Local Mean Time (LMT)。
true_solar_absolute
使用带均时差修正的天文学 true solar time。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| year | integer | Yes | 出生年份。 |
| month | integer | Yes | 出生月份,范围 1-12。 |
| day | integer | Yes | 出生日期,范围 1-31。 |
| hour | integer | Yes | 出生小时,范围 0-23。 |
| minute | integer | Yes | 出生分钟,范围 0-59。 |
| city | string | Yes | 城市名称,用于地点搜索和坐标解析。 |
| lat | float | No | 纬度。提供 lat/lng 时可直接使用坐标。 |
| lng | float | No | 经度。提供 lat/lng 时可直接使用坐标。 |
| sex | string | Yes | 'M' 或 'F',用于大运方向等规则。 |
| time_standard | string | No | 'civil'、'true_solar' 或 'true_solar_absolute'。 |
| include_pinyin | boolean | No | 是否返回拼音字段。默认 false。 |
| include_stars | boolean | No | 是否返回神煞 / Symbolic Stars。默认 false。 |
| include_interactions | boolean | No | 是否返回合、冲、害、刑、破等作用关系。默认 false。 |
| include_professional | boolean | No | 是否返回日主强弱、格局、用神等专业分析。默认 false。 |
调用示例
curl -X POST "https://api.freeastroapi.com/api/v1/chinese/bazi" \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"year": 1990,
"month": 5,
"day": 15,
"hour": 10,
"minute": 30,
"lat": 28.6139,
"lng": 77.2090,
"city": "New Delhi",
"sex": "M",
"time_standard": "civil",
"include_pinyin": true,
"include_stars": true,
"include_interactions": true,
"include_professional": true
}'响应数据
{
"day_master": {
"stem": "丙",
"pinyin": "bǐng",
"info": {
"name": "Bing Fire",
"element": "Fire",
"polarity": "Yang"
}
},
"pillars": [
{
"label": "year",
"gan": "庚",
"gan_pinyin": "gēng",
"zhi": "午",
"zhi_pinyin": "wǔ",
"gan_zhi": "庚午",
"ten_gods": {
"stem": "Direct Wealth",
"hidden": ["Indirect Resource", "Rob Wealth"]
},
"life_stage": {
"name": "Bathing",
"name_zh": "沐浴",
"score": 5
},
"nayin": "路旁土",
"hidden_stems": ["丁", "己"]
}
],
"stars": [
{
"name": "Tian Yi Nobleman",
"name_zh": "天乙贵人",
"pillar": "day",
"description": "The greatest protective star"
}
],
"professional": {
"dm_strength": "Strong",
"dm_strength_score": 0.64,
"structure": "Direct Resource Structure",
"yong_shen_candidates": ["Fire", "Wood"]
}
}相关接口
展示示例
查看你可以用 BaZi API 构建什么。我们的官方开源计算器展示了如何使用这个 endpoint 可视化四柱、大运周期和五行平衡。
View BaZi Calculator on GitHub