Four Pillars API — Precise
BaZi Chart Calculation Engine
Compute Year, Month, Day, and Hour pillars with solar-term boundaries, Day Master polarity, and Ten Gods relationships through a high-performance REST microservice.
Year Pillar (年柱)
Calculated based on Li Chun (立春) solar term onset. Governs macro generational cycles and childhood root energies.
Month Pillar (月柱)
Determined strictly by the 24 Solar Terms (节气). Sets the seasonal climate and element strength balance.
Day Pillar (日柱)
The Heavenly Stem represents the Day Master (Self). The Earthly Branch contains marital & spouse palace roots.
Hour Pillar (时柱)
Computed using local True Solar Time double hours (12 Shichen). Reflects later life aspirations and creation.
Why True Solar Time Calculation Matters
Most simple calendar scripts rely on standard clock time, causing incorrect hour and day pillars for births near timezone edges or double-hour boundaries. BaZi API solves this programmatically.
✕ Common Pitfalls in Naive Implementations
- • Ignores longitudinal differences within wide timezones (e.g. UTC+8 across 5 solar hours)
- • Uses Gregorian calendar months instead of solar terms (节气)
- • Fails to account for equation of time (±16 minutes solar variance)
- • Generates hallucinations when prompt-engineering raw LLMs
✓ BaZi API Astronomical Standard
- • Verified astronomical solar longitude tables down to the second
- • Exact 24 Solar Terms solar transition timestamps
- • Accurate Ten Gods mapping for all 10 Heavenly Stems and 12 Branches
- • Fast JSON payloads engineered for instant database storage or LLM ingestion
What You Can Build with Four Pillars API
AI Cultural & Chronological Agents
Feed clean, validated BaZi JSON to OpenAI, Claude, or Gemini to produce contextual cultural and temporal analyses without math errors.
Daily Calendar & Almanac Apps
Display daily and hourly Heavenly Stem and Earthly Branch shifts, solar terms, and auspicious timing indicators in mobile apps.
Compatibility & Matchmaking Services
Evaluate elemental harmonies, clashes (六冲), combinations (六合), and relationship synastry across multiple charts automatically.
Frequently Asked Questions
Technical details regarding Four Pillars calculation precision.
What are the Four Pillars calculated by this API?
The Four Pillars (八字 or BaZi) consist of the Year Pillar (年柱), Month Pillar (月柱), Day Pillar (日柱), and Hour Pillar (时柱). Each pillar contains one Heavenly Stem (天干) and one Earthly Branch (地支), forming eight Chinese characters representing the chronological coordinates at the exact moment of birth.
How is the Month Pillar calculated in relation to Solar Terms?
In classical Ziping calendrical calculation, month boundaries are strictly determined by the 24 Solar Terms (节气), not the standard lunar calendar or Gregorian calendar. The API calculates precise astronomical solar terms (such as Li Chun 立春 and Jing Zhe 惊蛰) to determine exact month transitions down to the minute.
What is the Day Master (日主) and why is it important?
The Heavenly Stem of the Day Pillar is known as the Day Master (日元 or 日主). It represents the core self of the subject. All Ten Gods (十神), elemental interactions (clashes, combinations, harmonies), and life luck cycles are calculated relative to the Day Master.
Does the API handle timezone offsets and early/late rat hour (早子时/夜子时)?
Yes. The calculation engine accounts for local coordinates, standard timezone offsets, daylight saving time historical tables, and True Solar Time. Hour pillar boundaries accurately align with the 12 two-hour double hours (辰时, 巳时, etc.).
Integrate Four Pillars Calculation into Your App
Get started with 100% free sandbox requests. No credit card required.