Skip to content
AstroWay/api v2.173.1 · chinese
all systems operational

Zi Wei Dou Shu: star placement

紫微斗數 builds a chart not from planets but from twelve palaces and well over a hundred stars, placed by rule from the lunar date and the double-hour of birth. POST /v1/ziwei/chart computes all of it.

EndpointCreditsWhat it returns
POST /v1/ziwei/chart20The whole chart: palaces, stars, stages, limits, 四化. Needs time and gender
POST /v1/ziwei/four-transformations10四化 by year stem, across four schools
POST /v1/ziwei/twelve-palaces5Reference glossary of the twelve palaces
POST /v1/ziwei/main-stars5Reference glossary of the fourteen main stars
POST /v1/ziwei/palace-*5One palace, nine paths

The reference routes carry a computed: false field and cost half the standard rate. They return the same table for any birth date, which is a perfectly good thing to sell as long as it is labelled.

Terminal window
curl -X POST "https://api.astroway.info/v1/ziwei/chart?lang=en" \
-H "X-Api-Key: $ASTROWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"date":"2000-08-16","time":"04:00:00","gender":"male","age":25}'
{
"fiveElementClass": { "key": "wood3", "chinese": "木三局", "name": "Wood 3", "value": 3 },
"soulPalace": { "index": 4, "branch": "Wu" },
"bodyPalace": { "index": 8, "branch": "Xu" },
"ziwei": { "index": 4, "branch": "Wu" },
"annualLimit": { "age": 25, "index": 8, "branch": "Xu" },
"palaces": [
{
"branch": "Wu",
"pillar": "Ren-Wu",
"palace": "destiny",
"isSoul": true,
"majorStars": [{ "chinese": "紫微", "name": "Purple Star", "pinyin": "Zi Wei", "kind": "major" }],
"lifeStage": { "chinese": "", "name": "Death", "localised": "Death" },
"boshi": "伏兵",
"decade": { "index": 0, "fromAge": 3, "toAge": 12 }
}
]
}

The palaces array carries all twelve in that same shape, from 寅 round to 丑.

StepRule
命宮 and 身宮From the month palace, back by the double-hour for the soul, forward for the body
Palace stems五虎遁 from the year stem
五行局From the soul palace pillar; agrees with the na yin reading on all sixty pairs
紫微The day divided by the class number with a borrow: an even borrow steps forward, an odd one back
紫微系 (6)Offsets of −1, −3, −4, −5, −8 from 紫微
天府系 (8)天府 mirrors 紫微 across the 寅-申 axis, then +1..+6 and +10 for 破軍
Six lucky, six maleficFrom the month, the double-hour and the year stem, each with its own rule
Thirty-one minor starsFrom the year branch, the year stem, the month, the day and the hour
長生十二神From the five-element class, forward for a yang man or yin woman, back otherwise
博士十二神From 祿存, same direction
將前 and 歲前 十二神From the year-branch trine and from the branch itself, both always forward
大限From 命宮, opening at the class number, ten years per palace
小限Reads sex and not polarity, unlike the decades
四化By year stem, marked on the stars themselves

They live in the request body rather than in our code, because each one moves the whole chart for the births it touches.

ParameterDefaultAlternative
yearDividelunar: the year opens on day one of the first lunar monthlichun: the BaZi boundary
fixLeaptrue: a leap month is split at day 15false: the whole leap month counts as the one it follows
dayDivideforward: 23:00 belongs to the next daycurrent: the date stays and the hour is marked 晚子時
tianmaSchoolyear: 天馬 from the year branch (中州派)month: 天馬 from the lunar month
schoolzhongzhou: 四化 per the 王亭之 corpusquanji, quanshu, beipai

Pinned to three published charts rather than to one library, deliberately. Nearly the whole open-source Zi Wei ecosystem descends from a single project: two ports, plus at least one project advertising a different lineage that calls it internally and parses the output. So agreeing with several projects is agreeing with one.

  • Two charts reproduce exactly: all fourteen main stars, the five-element class, the soul and body palaces.
  • The twelve stages are checked on a third fixture from the same source, where the expected twelve are published, rather than on those two charts. The decade openings are asserted against the five-element class number, which is the rule they come from rather than an outside publication.
  • A further chart comes from a Chinese teaching text with no connection to that ecosystem, and pins the star offsets and the palace order on its own.
  • The 安紫微星 mnemonic 「六五四三二/酉午亥辰丑」 and the published 火六局 run for days 1 to 15 are asserted directly: those are constants of the tradition, not somebody’s implementation.

火星 and 鈴星 are placed forward from the year-branch trine and take no account of sex in every transmission consulted. The 陽男陰女順 / 陰男陽女逆 rule sometimes attached to them belongs to the twelve life stages and to the decade limits. Both topics sit on the same page in the most-copied source, which is the likely origin of the confusion.

The palace names and the twelve life stages are translated into 21 languages: add ?lang= and each palace gains palaceLocalised and each stage a localised field. Star names stay as characters with an English gloss beside them, because they have no settled names.

Was this helpful?
Suggest an edit

Last updated: