Skip to content
POST/api/astro/chinese/four-pillars/1 credit

Chinese Four Pillars (BaZi)

The four pillars of a birth: year, month, day and hour. Each pillar is a heavenly stem over an earthly branch, and the sixty combinations of the two make the sexagenary cycle. The day's stem is the DAY MASTER — the single most important element in the chart, since everything else is read as its relationship to that. The Chinese year begins at LICHUN — the moment the Sun reaches 315 degrees of tropical longitude, around 4 February. Not 1 January, and not Chinese New Year, which is a lunar date drifting between 21 January and 20 February and governs the festival rather than the chart. Someone born on 20 January 2024 has 2023's pillar: a Water Rabbit, not a Wood Dragon. This is the single thing cheap implementations get wrong, and it misassigns the year for everyone born in January. Month pillars are bounded the same way, by the twelve major solar terms, so a month boundary is an astronomical instant and can fall at any hour of any day rather than on the first of a calendar month. Two conventions are exposed because practitioners genuinely differ and both change the answer. `day_boundary` decides whether the day turns at 23:00 (traditional) or midnight. `true_solar_time` corrects the clock for the birthplace's distance from its timezone meridian — about fourteen minutes for Beijing — which can move the hour pillar by one place.

https://yogataraapi.prahlad.app/api/astro/chinese/four-pillars/
Test Request

Authentication

Send your key in the X-API-Key header. Keys are server-side credentials — never put one in browser JavaScript or a mobile app.

X-API-Key: yt_live_a1b2c3d4_…
Content-Type: application/json

Request fields

FieldTypeRequiredNotes
date_timestring (date-time)required

The moment to calculate for, ISO 8601. ALWAYS include an offset or a trailing Z - a value with no zone is read as Asia/Kolkata (UTC+05:30), not UTC, and can return the previous day's result with a 200. '2026-09-01T06:00:00Z' and '2026-09-01 06:00:00' are different instants and give different answers.

day_boundarystringoptional

When the day pillar changes. 'zi_hour' is 23:00, the traditional rule; 'midnight' is what most software uses. They disagree for births between 23:00 and 24:00.

zi_hourmidnight
keysarrayoptional

Which calculations to return, as a list of names. See the key table for this endpoint; an unrecognised name rejects the whole request. One call costs one credit however many keys you ask for, so request everything you need at once rather than making several calls.

latitudenumber (double)optional

Latitude of the place, in decimal degrees. Positive is north, negative is south. Example: 26.9124 for Jaipur, 40.7128 for New York. Minutes and seconds are not accepted - convert first.

longitudenumber (double)optional

Longitude of the place, in decimal degrees. Positive is east, negative is west. Example: 75.7873 for Jaipur, -74.0060 for New York. Note the sign: a missing minus puts New York in China.

orb_factornumber (double)optional

Scale every aspect orb. 0.5 halves them, 2 doubles them.

min 0.1 · max 2

timezone_as_floatnumber (double)optional

UTC offset of the place, in hours, as a decimal. Example: 5.5 for India (UTC+05:30), -5 for New York in winter, 5.75 for Nepal. This is NOT validated against date_time - if the two disagree you get a successful response for the wrong moment, so derive both from the same source. Use the offset in force on that date, not today's: a summer birth in a country with daylight saving needs the summer offset.

min -12 · max 14

true_solar_timebooleanoptional

Correct the hour by the longitude's offset from the timezone meridian. Traditional practice uses true local solar time and it can move the hour pillar by one place.

Example request

curl -X POST https://yogataraapi.prahlad.app/api/astro/chinese/four-pillars/ \
  -H "X-API-Key: $OCCULT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"date_time":"1984-06-15T14:30:00+08:00","latitude":39.9042,"longitude":116.4074,"timezone_as_float":8}'

Response

{
  "data": {
    "system": "Chinese Four Pillars (BaZi)",
    "local_time": "1984-06-15T14:30:00+08:00",
    "true_solar_correction_minutes": 0,
    "chinese_year": 1984,
    "year_begins_at_lichun": "1984-02-04T15:18:45+00:00",
    "solar_month": {
      "number": 5,
      "term": "Mangzhong (grain in ear)",
      "began_at": "1984-06-05T12:08:37+00:00",
      "ends_at": "1984-07-06T22:29:07+00:00"
    },
    "day_master": {
      "index": 7,
      "name": "Geng",
      "pinyin": "geng",
      "element": "metal",
      "polarity": "yang"
    },
    "pillars": [
      {
        "pillar": "year",
        "stem": {
          "index": 1,
          "name": "Jia",
          "pinyin": "jia",
          "element": "wood",
          "polarity": "yang"
        },
        "branch": {
          "index": 1,
          "name": "Zi",
          "animal": "Rat",
          "element": "water",
          "polarity": "yang"
        },
        "name": "Jia-Zi",
        "animal": "Rat",
        "hidden_stems": [
          {
            "index": 10,
            "name": "Gui",
            "pinyin": "gui",
            "element": "water",
            "polarity": "yin"
          }
        ]
      },
      {
        "pillar": "month",
        "stem": {
          "index": 7,
          "name": "Geng",
          "pinyin": "geng",
          "element": "metal",
          "polarity": "yang"
        },
        "branch": {
          "index": 7,
          "name": "Wu",
          "animal": "Horse",
          "element": "fire",
          "polarity": "yang"
        },
        "name": "Geng-Wu",
        "animal": "Horse",
        "hidden_stems": [
          {
            "index": 4,
            "name": "Ding",
            "pinyin": "ding",
            "element": "fire",
            "polarity": "yin"
          },
          {
            "index": 6,
            "name": "Ji",
            "pinyin": "ji",
            "element": "earth",
            "polarity": "yin"
          }
        ]
      },
      {
        "pillar": "day",
        "stem": {
          "index": 7,
          "name": "Geng",
          "pinyin": "geng",
          "element": "metal",
          "polarity": "yang"
        },
        "branch": {
          "index": 5,
          "name": "Chen",
          "animal": "Dragon",
          "element": "earth",
          "polarity": "yang"
        },
        "name": "Geng-Chen",
        "animal": "Dragon",
        "hidden_stems": [
          {
            "index": 5,
            "name": "Wu",
            "pinyin": "wu",
            "element": "earth",
            "polarity": "yang"
          },
          {
            "index": 2,
            "name": "Yi",
            "pinyin": "yi",
            "element": "wood",
            "polarity": "yin"
          },
          {
            "index": 10,
            "name": "Gui",
            "pinyin": "gui",
            "element": "water",
            "polarity": "yin"
          }
        ]
      },
      {
        "pillar": "hour",
        "stem": {
          "index": 10,
          "name": "Gui",
          "pinyin": "gui",
          "element": "water",
          "polarity": "yin"
        },
        "branch": {
          "index": 8,
          "name": "Wei",
          "animal": "Goat",
          "element": "earth",
          "polarity": "yin"
        },
        "name": "Gui-Wei",
        "animal": "Goat",
        "hidden_stems": [
          {
            "index": 6,
            "name": "Ji",
            "pinyin": "ji",
            "element": "earth",
            "polarity": "yin"
          },
          {
            "index": 4,
            "name": "Ding",
            "pinyin": "ding",
            "element": "fire",
            "polarity": "yin"
          },
          {
            "index": 2,
            "name": "Yi",
            "pinyin": "yi",
            "element": "wood",
            "polarity": "yin"
          }
        ]
      }
    ],
    "note": "The year pillar turns at Lichun (Sun at 315 degrees, about 4 February), not on 1 January and not at Chinese New Year, which is a lunar date and governs the festival rather than the chart."
  },
  "status": 200,
  "is_error": false,
  "message": "successful"
}

Captured from a real call using the exact request above. Results sit under data.

Errors

Metering errors return { "error": "…", "message": "<code>", "is_error": true }. Show error to people and branch on message. See the error reference.