Calculator API Reference

External systems can call the same production calculator endpoints used by the site. The OpenAPI spec is available at /v1/openapi and the public shorthand is /v1/openapi.

Input rules

`name-analysis` and `baby-name` expect Chinese characters for surname, given name, and generation character fields.

Location-aware requests should send resolved `latitude`, `longitude`, and `timezone`. This API does not geocode or guess ambiguous city names.

Discovery endpoint

GET /v1
POST/v1/bazi-reading

BaZi Reading

Calculates the Four Pillars of Destiny from birth date, birth time, and optionally a resolved birth location. The response includes the four pillars, day master information, five-element balance, ten gods, and a simple day-master strength summary.

Important notes

  • Birth time is required.
  • If you send `birthLocation`, it must already contain resolved `latitude`, `longitude`, and `timezone`.
  • This endpoint does not geocode city names or infer ambiguous places.
{
  "gender": "male",
  "birthDate": { "year": 1990, "month": 5, "day": 15 },
  "birthTime": { "hour": 14, "minute": 30 },
  "birthLocation": {
    "latitude": 1.3521,
    "longitude": 103.8198,
    "timezone": "Asia/Singapore"
  }
}
POST/v1/name-analysis

Name Analysis

Analyzes a Chinese name using Kangxi stroke counts, Wu Ge, San Cai, and stroke-meaning scoring. The response includes per-character stroke metadata, five-grid calculations, San Cai interpretation, and an overall score.

Important notes

  • `surname` and `givenName` should be Chinese characters.
  • Romanized names such as `Zhang` or `Wei Qiang` are not valid inputs for this calculator.
  • If characters are not found in the Kangxi dataset, the response will indicate that instead of forcing an incorrect calculation.
{
  "surname": "张",
  "givenName": "伟强"
}
POST/v1/baby-name

Baby Name

Generates baby-name candidates based on surname, birth data, and BaZi-related naming rules. The response includes top candidate characters, top combined names, BaZi summary information, and analysis for generated combinations.

Important notes

  • `fatherSurname` should be Chinese characters.
  • `generationCharacter`, if provided, should also be Chinese characters.
  • `charactersToAvoid` can be a comma-separated or plain string list of Chinese characters to exclude.
{
  "fatherSurname": "林",
  "gender": "female",
  "birthDate": { "year": 2026, "month": 4, "day": 2 },
  "birthTime": { "hour": 9, "minute": 20 },
  "generationCharacter": "美"
}
POST/v1/wedding-date

Wedding Date

Returns ranked auspicious wedding dates inside the requested date range using the same deterministic date-selection logic used on the public calculator. Each result includes the solar date, day pillar, lunar date, and scoring breakdown.

Important notes

  • Only a date range is required for this API version.
  • The endpoint returns top-ranked dates rather than every possible date in the range.
  • The response is deterministic for the same input range.
{
  "preferredDateRange": {
    "startDate": { "year": 2026, "month": 6, "day": 1 },
    "endDate": { "year": 2026, "month": 6, "day": 30 }
  }
}
POST/v1/move-in-date

Move-In Date

Returns ranked auspicious move-in dates for a requested date range. The response includes the solar date, day pillar, lunar date, and the rating object used to score each date.

Important notes

  • Only a date range is required for this API version.
  • The endpoint focuses on the best dates rather than a full calendar dump.
  • Use this when an external system wants a shortlist of recommended move-in dates.
{
  "preferredDateRange": {
    "startDate": { "year": 2026, "month": 7, "day": 1 },
    "endDate": { "year": 2026, "month": 7, "day": 31 }
  }
}
POST/v1/caesarean-date

Caesarean Date

Finds strong candidate caesarean dates around the estimated delivery date and enriches each candidate with year pillar, month pillar, day-master profile, strength summary, destiny overview, and recommended Chinese-hour windows.

Important notes

  • `estimatedDeliveryDate` is required.
  • `gender` must be `male`, `female`, or `unknown`.
  • Results are returned as a shortlist of recommended dates, not as an unrestricted calendar feed.
{
  "estimatedDeliveryDate": { "year": 2026, "month": 5, "day": 18 },
  "gender": "unknown"
}