{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/openephemeris-com/json-schema/openephemeris-com-zi-wei-request-schema.json",
  "title": "ZiWeiRequest",
  "description": "A Zi Wei Dou Shu (Purple Star) natal chart for a birth. The date and time are the LOCAL wall clock of the birth place, already resolved (zone, daylight saving and any true-solar-time correction are yours to apply); this endpoint reads them as stated. The birth hour and the gender are required because the chart cannot be cast without them: nothing defaults to noon or to a gender. The leap-month rule, day boundary, year boundary, brightness table and four-transformation table are conventions the schools disagree on; every one is echoed in `conventions`.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/openephemeris-com-chinese-api-openapi.yml#/components/schemas/ZiWeiRequest",
  "additionalProperties": false,
  "properties": {
    "day": {
      "description": "Gregorian birth day.",
      "maximum": 31,
      "minimum": 1,
      "type": "integer"
    },
    "day_boundary": {
      "$ref": "#/$defs/BaZiDayBoundaryEnum",
      "default": "zi_hour",
      "description": "zi_hour (default): a birth at 23:00-23:59 belongs to the NEXT day, and the whole lunar date (year, month, day, leap flag) is taken from it. midnight: the day changes at 00:00 and 23:00-23:59 is the Zi hour of the same day."
    },
    "format": {
      "default": "json",
      "description": "Response format: json | llm. llm moves the palace objects into metadata as fixed-width rows.",
      "type": "string"
    },
    "gender": {
      "description": "Required. male or female: it sets the direction of the ten-year cycles.",
      "type": "string"
    },
    "hour": {
      "description": "Required. Birth hour on the local wall clock, 0 to 23. 23:00-23:59 is the late Zi hour (see day_boundary).",
      "maximum": 23,
      "minimum": 0,
      "type": "integer"
    },
    "leap_month_rule": {
      "default": "split_mid",
      "description": "Which month number a birth inside a leap month uses. split_mid (default): days 1-15 keep the leap month's own number n, days 16 and later use n+1. previous: always n. next: always n+1.",
      "enum": [
        "split_mid",
        "previous",
        "next"
      ],
      "type": "string"
    },
    "minute": {
      "default": 0,
      "description": "Birth minute (0 to 59). It is read only when year_boundary is lichun, where the wall clock is compared with the Lichun instant; for the default calendar the hour decides the chart.",
      "maximum": 59,
      "minimum": 0,
      "type": "integer"
    },
    "month": {
      "description": "Gregorian birth month.",
      "maximum": 12,
      "minimum": 1,
      "type": "integer"
    },
    "transformation_overrides": {
      "additionalProperties": {
        "items": {
          "type": "string"
        },
        "maxItems": 4,
        "minItems": 4,
        "type": "array"
      },
      "description": "Replace the four transformations (lu, quan, ke, ji) of a year stem: {\"geng\": [\"tai_yang\", \"wu_qu\", \"tai_yin\", \"tian_tong\"]}. Keys are stem ids (jia yi bing ding wu ji geng xin ren gui); values are four distinct star ids (the 14 major stars, zuo_fu, you_bi, wen_chang, wen_qu). The stems schools disagree on are geng, wu and ren.",
      "type": "object"
    },
    "year": {
      "description": "Gregorian birth year, 1551 to 2648 (the lunisolar calendar is computed from the ephemeris, and a date in December 2649 would need a solstice past its end).",
      "maximum": 2648,
      "minimum": 1551,
      "type": "integer"
    },
    "year_boundary": {
      "$ref": "#/$defs/BaZiYearBoundaryEnum",
      "default": "cny",
      "description": "cny (default for Zi Wei): the lunar year changes at Chinese New Year. lichun: it changes at the Lichun solar term; the wall clock is then read as Beijing time (UTC+8) and the response says so."
    }
  },
  "required": [
    "year",
    "month",
    "day"
  ],
  "type": "object",
  "$defs": {
    "BaZiDayBoundaryEnum": {
      "description": "Day-pillar boundary convention. zi_hour rolls the day pillar at 23:00 (start of the Zi hour); midnight rolls it at 00:00.",
      "enum": [
        "zi_hour",
        "midnight"
      ],
      "title": "BaZiDayBoundaryEnum",
      "type": "string"
    },
    "BaZiYearBoundaryEnum": {
      "description": "Year-pillar boundary convention. lichun rolls the year pillar at the Lichun (立春) solar term, around 4 February; cny rolls it at Chinese New Year.",
      "enum": [
        "lichun",
        "cny"
      ],
      "title": "BaZiYearBoundaryEnum",
      "type": "string"
    }
  }
}