POST /bazi/calculate
Core EndpointCalculates complete Four Pillars of Destiny chart from birth date, time, gender, and timezone.
REST API Reference
Accepts YYYY-MM-DD birthDate, HH:mm birthTime, male/female gender, timezone, and language in the request body. Returns complete natal chart, four pillars, element analysis, gods, and luck pillars.
Installation
Bash
POST https://api.baziapi.pro/api/v1/bazi/calculateQuick Start
Example Request Body (JSON)
JSON
{
"birthDate": "1998-08-12",
"birthTime": "10:30",
"gender": "male",
"timezone": "Asia/Shanghai",
"language": "en"
}API Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
birthDate | string | Required | — | Birth date in YYYY-MM-DD format (e.g. 1998-08-12). |
birthTime | string | Required | — | Birth time in 24-hour HH:mm format (e.g. 10:30). |
gender | 'male' | 'female' | Required | — | Gender for Luck Pillar direction calculation. |
timezone | string | Optional | Asia/Shanghai | IANA Timezone string (e.g. Asia/Dhaka or Asia/Shanghai). |
language | 'en' | 'zh' | Optional | en | Output language for names and terms ("en" or "zh"). |
More Examples
Example 200 OK Response Payload (JSON)
Example 200 OK Response Payload (JSON)
JSON
{
"success": true,
"message": "BaZi calculated successfully.",
"data": {
"input": {
"birthDate": "1998-08-12",
"birthTime": "10:30",
"gender": "male",
"timezone": "Asia/Shanghai",
"language": "en"
},
"solar": {
"year": 1998,
"month": 8,
"day": 12,
"hour": 10,
"minute": 30,
"weekDay": "Wednesday",
"solarDateTime": "1998-08-12 10:30"
},
"pillars": {
"year": { "stem": "戊", "branch": "寅", "stemEn": "Wu", "branchEn": "Yin" },
"month": { "stem": "庚", "branch": "申", "stemEn": "Geng", "branchEn": "Shen" },
"day": { "stem": "丙", "branch": "午", "stemEn": "Bing", "branchEn": "Wu" },
"hour": { "stem": "癸", "branch": "巳", "stemEn": "Gui", "branchEn": "Si" }
},
"heavenlyStems": {
"yearStem": "Wu",
"monthStem": "Geng",
"dayStem": "Bing",
"hourStem": "Gui"
},
"earthlyBranches": {
"yearBranch": "Yin",
"monthBranch": "Shen",
"dayBranch": "Wu",
"hourBranch": "Si"
},
"fiveElements": {
"year": "Earth",
"month": "Metal",
"day": "Fire",
"hour": "Water",
"totals": { "Wood": 1, "Fire": 3, "Earth": 2, "Metal": 1, "Water": 1 }
},
"analysis": {
"strongestElement": "Fire",
"weakestElement": "Wood"
},
"zodiac": { "animal": "Tiger", "chinese": "虎" }
}
}cURL Example Command
cURL Example Command
Bash
curl -X POST https://api.baziapi.pro/api/v1/bazi/calculate \
-H "x-api-key: bazi_live_xxxx" \
-H "Content-Type: application/json" \
-d '{
"birthDate": "1998-08-12",
"birthTime": "10:30",
"gender": "male",
"timezone": "Asia/Shanghai",
"language": "en"
}'Something unclear? Contact developer support.