Skip to main content

BaZi API — Four Pillars Calculations for Developers

High-precision Chinese calendrical and Four Pillars computational REST API. Generate structured, deterministic JSON data from solar/lunar dates and astronomical coordinates for AI applications, developer workflows, n8n & Zapier.

Developer-first infrastructure · REST API & Webhooks · Sub-500ms latency

Seamless integrations with modern stacks

n8nZapierOpenAIMake.comBubbleWebflow
Developer Guide & Technical Overview

BaZi API at a Glance — Popular Four Pillars Options & Capabilities

A comprehensive reference for developers, AI agent creators, and calendar software architects comparing Chinese Four Pillars calculation engines.

What is BaZi API and What Does It Return?

BaZi API (baziapi.pro) is a high-precision, developer-first REST microservice and Model Context Protocol (MCP) compatible engine. It computes complete Four Pillars (BaZi / 八字) charts from birth date, time, and coordinates.

Four Pillars: Year, Month, Day, and Hour Heavenly Stems & Earthly Branches with dual Chinese/English output.
Ten Gods (十神): Complete Ziping relationship mappings for all four pillars relative to Day Master.
Astronomical True Solar Time: Automatic longitude and equation-of-time correction (真太阳时).
Luck Pillars (大运): 10-year major life cycles with precise starting age transitions and direction.
Elemental Breakdown: Quantitative Five Elements (Wood, Fire, Earth, Metal, Water) balance and percentages.
AI & MCP Integration: Zero-hallucination JSON designed for OpenAI Function Calling, Claude MCP, and Cursor.

Popular BaZi API Comparison for Developers

Feature / MetricBaZi API (baziapi.pro)Standard Lunisolar APIsManual / Library Calculation
Calculation Latency< 500ms (Redis Cached)800ms – 2500msVaries (High CPU load)
True Solar Time (真太阳时)Automatic by CoordinatesManual or UnavailableRequires Solar Math Engine
Ten Gods (十神) & Luck PillarsFull Classical BreakdownPartial or BasicComplex Rule Engineering
AI / MCP Agent CompatibilityNative MCP & OpenAI ToolsUnstructured or Prose TextCustom Wrapper Required
Outbound WebhooksYes (Midnight Shift & Solar Terms)No (Polling only)Custom Cron Architecture
Developer Free TierFree Forever (No Card Required)Trial with Card or Paid OnlyN/A
Ready to test calculations? Start instantly with our sandbox or view the interactive API reference.
Why developers choose BaZi API

Everything you need to build
Four Pillars-powered applications

From raw calendrical calculations to structured JSON ready for AI applications and developer workflows — one API, infinite possibilities.

Four Pillars & Relational Classifications

Deterministic calendrical chart calculation with Year, Month, Day & Hour pillars. Computes Day Master, Heavenly Stems, Earthly Branches, Hidden Stems, Ten Gods relational mapping, Na Yin, and Da Yun cycle transitions in a single call.

Sub-500ms True Solar Time

Astronomical accuracy with automatic True Solar Time (真太阳时) and timezone adjustments. Intelligent Redis caching keeps average calculation latency under 500ms.

API Key Auth & Rate Limiting

Secure API key authentication with enterprise-grade encryption. Generate, revoke, and manage multiple keys per account directly from your dashboard.

Real-Time Request Analytics

Every API call is tracked with endpoint, status, and latency. Monitor your live usage, quota consumption, error rates, and request logs in real-time.

Multi-Language Localization

Full localization in 5 languages: English (en), Chinese (zh), Hindi (hi), Bengali (bn), and Spanish (es). Stems, branches, Five Elements, Ten Gods, zodiac animals, and solar terms localized automatically.

Developer Workflows & Automation Ready

Clean structured JSON output designed for backend services and modern LLM integrations. Plug directly into OpenAI Function Calling, LangChain, Vercel AI SDK, n8n nodes, and Zapier webhooks.

5 Localized Output Languages Available

Interactive API Localization Playground

Click any language below to see how passing the "language" parameter instantly returns fully localized BaZi pillars, Ten Gods, elements, and calendar data in the JSON response.

POST /api/v2/bazi/calculate
curl -X POST https://api.baziapi.pro/api/v2/bazi/calculate \
  -H "x-api-key: bazi_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "birthDate": "1998-08-12",
    "birthTime": "10:30",
    "gender": "male",
    "timezone": "Asia/Kolkata",
    "language": "hi"
  }'
Selected Language: Hindi (hi)Output terms: वू-यिन (यांग पृथ्वी बाघ) · बुधवार
Real-Time Outbound Webhooks

Stop Polling. Stream Calendar Events Directly to Your Apps.

Eliminate server polling overhead and wasted API quotas. Our event-driven BullMQ engine pushes live BaZi shifts, Solar Terms, and quota thresholds with sub-second latency and HMAC-SHA256 signature verification.

Step 1•Trigger

Day Pillar Transition

Midnight arrives or sun crosses solar term marker.

Step 2•BullMQ Engine

HMAC Sign & Dispatch

Signed with HMAC-SHA256 secret. 3x auto-retries.

Step 3•Destination

Instant 200 OK Delivery

Pushed directly to your server, Zapier, n8n, or bot.

Built for Mobile Apps, SaaS & Content Creators (Zero-Maintenance Automation)

Automated Daily Push

Stream daily Four Pillars calendar shifts and solar term transitions to your mobile apps at midnight without manual crons.

No Cron Servers Needed

Save hours of DevOps engineering. No complex cron jobs, scheduling libraries, or polling servers to maintain 24/7.

Included in Basic ($19/mo)

Start with 1 active live endpoint on the Basic plan, 3 on Pro, and up to 10 on Premium for agencies and enterprises.

Live Testing & Logs

Send 1-click test events from your dashboard and inspect delivery times, status codes, and automatic retries in real-time.

Mobile Apps & Developer Automationevent: daily.bazi_shift

Automated Midnight Calendar Sync

Deliver daily Four Pillars calendar shifts precisely at 00:00 without running expensive polling crons overnight.

Zero Server Polling

Saves 86,400 daily polling checks per server. We push only when the Day Pillar changes.

Instant Mobile Retention

Trigger automated updates when calendar transitions occur.

Complete Pillar Delta

Includes previous vs current pillar, stem-branch identifiers, and solar term transitions.

Seamless Delivery Destinations:

iOS / Android APNsZapiern8nFirebase Cloud Messaging
HMAC-SHA256 Signed
POSThttps://api.yourapp.com/webhooks/daily-shift
200 OK
{
  "event": "daily.bazi_shift",
  "timestamp": "2026-09-05T00:00:00.000Z",
  "data": {
    "previousPillar": {
      "stem": "Jia",
      "branch": "Chen",
      "element": "Wood Dragon"
    },
    "currentPillar": {
      "stem": "Yi",
      "branch": "Si",
      "element": "Wood Snake"
    },
    "dailyPillar": "Yi Si (Wood Snake)",
    "wuXing": {
      "element": "Wood",
      "polarity": "Yin"
    },
    "solarTerm": "Bailu"
  }
}
BullMQ worker ready
3x exponential retries enabled

Webhooks are included across all paid tiers

Register endpoints, test pings in real-time, and monitor delivery logs right from your dashboard.

BASIC ($19/mo)1 Endpoint
PRO ($49/mo)3 Endpoints
PREMIUM ($149/mo)10 Endpoints

Up and running in 3 steps

From sign-up to first BaZi chart in under 5 minutes.

1

Sign Up Free

Create your account in seconds with no credit card required. Get instant access to the free forever, no credit card required plan and start testing right away.

Create Free Account
2

Get Your API Key

Generate an API key with one click from your dashboard. Copy your secret key to start authenticating your requests.

Authentication Guide
3

Call the API

Send a simple POST request with birth date, time, gender, and timezone. Receive a complete, structured BaZi chart in milliseconds.

API Reference

Simple, transparent pricing

Start free. Scale as you grow. No hidden fees.

FREEDeveloper / Test
$0/month

Free Forever · No Credit Card Required

  • 1,000 requests / month
  • 30 requests / minute
  • 1 active API Key
  • Core Four Pillars calculation
  • Heavenly Stems & Earthly Branches
  • Five Elements distribution
  • Bilingual output (EN & CN)
  • Community support
  • High-volume throughput
  • Dedicated support & SLA
BASICIndie Dev
$19/month

Billed monthly

  • 300 requests / minute
  • 3 active API Keys
  • 1 Active Outbound Webhook
  • Full BaZi calculation engine
  • Branch Components & Ten Gods Mapping
  • Da Yun Cycle Calculations
  • Bilingual output (EN & CN)
  • Email support (24h response)
  • 99.9% Uptime SLA
Most Popular
PROStartup
$49/month

Billed monthly

  • 500 requests / minute
  • 10 active API Keys
  • 3 Active Outbound Webhooks
  • Everything in Basic
  • Traditional Symbolic Markers (Shen Sha)
  • Sub-500ms fast response
  • n8n, Zapier & AI Agent ready
  • Priority email support
PREMIUMEnterprise
$149/month

Billed monthly

  • 1000 requests / minute
  • 30 active API Keys
  • 10 Active Outbound Webhooks
  • Everything in Pro
  • 99.9% Uptime SLA guarantee
  • 24/7 Priority support
  • Custom integration assistance
  • Dedicated account manager

FAQ

Everything you need to know about BaZi API.

Start building with BaZi API today

Build Four Pillars calculations into your apps, AI agents, and automation workflows with BaZi API.

No credit card required · Free tier forever · Optional upgrade