FreeAstroAPI
Chinese 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.

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/bazi/calculate
{
  "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 have dedicated endpoints for analyzing the relationship between two charts, checking for mutual interactions, balance of elements, and more. Check our Synastry Guide for details.

Available Endpoints

POST/api/v1/bazi/calculate

Full BaZi chart with Pillars, Day Master, and Strength

POST/api/v1/bazi/synastry

Compatibility analysis between two charts

POST/api/v1/bazi/solar-time

Convert clock time to True Solar Time

Rate Limits

  • Free Tier

    80 requests per day

    Perfect for development and testing

  • Pro Tier

    50,000 requests per month

    Production-ready performance

Ready to decode Destiny?

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