FreeAstroAPI LogoFreeAstroAPI
Astro LogoChinese Metaphysics Engine

BaZi (Four Pillars) APIProfessional Destiny Analysis

Build easier, high-precision BaZi applications. Identify Day Masters, calculate 12 Life Stages, and detect Shen Sha stars instantly.

Read Synastry Guide

Deep Technical Capabilities

More than just converting dates. We handle the complex logic of Chinese Astrology.

True Solar Time

Don't rely on clock time. We automatically adjust for Equation of Time and Longitude to get the precise True Solar Time for accurate pillar calculation.
Read Guide

Interaction Logic

Automated detection of Pillar interactions: Combinations (He), Clashes (Chong), Harms (Hai), Punishments (Xing), and Destructions (Po).

Symbolic Stars

Calculate dozens of Shen Sha including Nobleman, Peach Blossom, Traveling Horse, Academic Star, and more based on Day or Year stems/branches.

Live Demo

Built with our API

See what's possible. Check out this fully functional BaZi Calculator built using our endpoints.

Clean JSON Responses

Get a structured response with all 4 pillars, hidden stems, and calculated strengths. Ready to render in your UI.

Standardized Pinyin

Consistent naming for Stems (Jia, Yi...) and Branches (Zi, Chou...).

Element Counting

Pre-calculated counts of Wood, Fire, Earth, Metal, and Water across the chart.

Documentation & Guides

Comprehensive API references and detailed synastry guides.

POST /api/v1/chinese/bazi
{
  "chart": {
    "year": {
      "stem": "Jia",
      "branch": "Chen",
      "element": "Wood"
    },
    "month": {
      "stem": "Bing",
      "branch": "Yin",
      "element": "Fire"
    },
    "day": {
      "stem": "Geng",
      "branch": "Shen",
      "element": "Metal",
      "master_strength": "Strong"
    }
  },
  "shen_sha": [
    "Tian Yi Nobleman",
    "Yi Ma (Horse)"
  ]
}

BaZi API FAQ

Do you support Solar vs Lunar calendar?

BaZi is traditionally based on the Solar Terms (Jie Qi). Our API calculates the exact transition of solar terms to determine the Month Pillar, which is more accurate than simple Lunar calendar conversion.

How accurate is the hour pillar?

Typically, hour pillars are based on local clock time. We offer an option to use True Solar Time (taking longitude and equation of time into account), which can shift the hour pillar if the location is far from the timezone meridian.

Can I calculate compatibility (Synastry)?

Yes. We provide dedicated endpoints for compatibility between two charts, including mutual interactions and element balance.

Ready to decode Destiny?

Start building your professional BaZi application today with our robust and documented API.