Back to Docs

BaZi Dictionary

GET/api/v1/chinese/bazi/dictionary

Retrieve the complete mapping of integer IDs to their interaction and star definitions. Use this to cache definitions client-side and efficiently resolve IDs from the /flow endpoint.

Full URL

https://astro-api-1qnc.onrender.com/api/v1/chinese/bazi/dictionary

✨ Best Practice

  1. Fetch this dictionary once on application startup
  2. Cache it in localStorage, memory, or your database
  3. When calling /flow, set dictionary_response: false (default)
  4. Resolve integer IDs against your cached dictionary

This approach minimizes bandwidth and response times for repeated flow requests.

ID Range Reference

ID RangeTypeExamples
1000-1999Stem Combinations甲-己合, 乙-庚合, etc.
2000-2999Branch Clashes子午冲, 丑未冲, etc.
3000-3099Six Harmonies子丑合, 寅亥合, etc.
3100-3199Three Harmonies寅午戌, 申子辰, etc.
3200-3299Harms (Hai)子未害, 丑午害, etc.
3300-3399Breaks (Po)子酉破, 丑辰破, etc.
3400-3499Punishments (Xing)寅巳申刑, etc.
4000-4999Stars (Shen Sha)天乙贵人, 桃花, etc.

Request Parameters

This is a GET request with no parameters. Simply include your API key in the header.

Sample Code

import requests

url = "https://astro-api-1qnc.onrender.com/api/v1/chinese/bazi/dictionary"

headers = {
    "x-api-key": "YOUR_API_KEY"
}

response = requests.get(url, headers=headers)
dictionary = response.json()

# Cache locally for use with /flow endpoint
# Example: resolve an ID from flow response
# interaction_1005 = dictionary["1005"]
print(dictionary)

Response Data

{
  // Stem Combinations (1000-1999)
  "1000": {
    "type": "Stem Combination",
    "name": "甲-己 Combination",
    "name_zh": "甲己合",
    "stems": ["甲", "己"],
    "transform_to": "Earth",
    "description": "Wood and Earth combine, can transform to Earth element"
  },
  "1001": {
    "type": "Stem Combination",
    "name": "乙-庚 Combination",
    "stems": ["乙", "庚"],
    "transform_to": "Metal"
  },
  // ...
  
  // Branch Clashes (2000-2999)
  "2000": {
    "type": "Branch Clash",
    "name": "子-午 Clash",
    "name_zh": "子午冲",
    "branches": ["子", "午"],
    "elements": ["Water", "Fire"],
    "description": "Rat-Horse opposition, Water-Fire conflict"
  },
  "2001": {
    "type": "Branch Clash",
    "name": "丑-未 Clash",
    "branches": ["丑", "未"]
  },
  // ...
  
  // Branch Combinations (3000-3999)
  "3000": {
    "type": "Branch Six Harmony",
    "name": "子-丑 Harmony",
    "name_zh": "子丑合",
    "branches": ["子", "丑"],
    "transform_to": "Earth"
  },
  "3100": {
    "type": "Branch Three Harmony",
    "name": "寅-午-戌 Fire Frame",
    "name_zh": "寅午戌三合火局",
    "branches": ["寅", "午", "戌"],
    "element": "Fire"
  },
  // ...
  
  // Stars / Shen Sha (4000-4999)
  "4000": {
    "name": "Tian Yi Nobleman",
    "name_zh": "天乙贵人",
    "id": "star_nobleman",
    "category": "Beneficial",
    "description": "The greatest protective star, brings help from influential people"
  },
  "4001": {
    "name": "Peach Blossom",
    "name_zh": "桃花",
    "id": "star_peach",
    "category": "Romance",
    "description": "Romantic charm and social popularity"
  },
  "4002": {
    "name": "Academic Star",
    "name_zh": "文昌",
    "id": "star_academic",
    "category": "Intelligence"
  },
  "4003": {
    "name": "Traveling Horse",
    "name_zh": "驿马",
    "id": "star_travel",
    "category": "Movement"
  }
  // ...
}

Related Endpoints