Skip to content

Lá số Tử vi ​

Tính toán lá số tử vi hoàn chỉnh với vị trí hành tinh, điểm cung và các góc chiếu.

Tính toán Cơ bản ​

bash
curl -X POST "https://api.astroapi.cloud/api/calc/natal" \
  -H "X-Api-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "dateTime": "1990-06-15T14:30",
    "location": {
      "latitude": 51.5074,
      "longitude": -0.1278,
      "timezone": "Europe/London"
    }
  }'
javascript
const response = await fetch("https://api.astroapi.cloud/api/calc/natal", {
    method: "POST",
    headers: {
        "X-Api-Key": "your-api-key",
        "Content-Type": "application/json"
    },
    body: JSON.stringify({
        dateTime: "1990-06-15T14:30",
        location: {
            latitude: 51.5074,
            longitude: -0.1278,
            timezone: "Europe/London"
        }
    })
});

const data = await response.json();
console.log(JSON.stringify(data, null, 2));
python
import requests

response = requests.post(
    "https://api.astroapi.cloud/api/calc/natal",
    headers={
        "X-Api-Key": "your-api-key",
        "Content-Type": "application/json"
    },
    json={
        "dateTime": "1990-06-15T14:30",
        "location": {
            "latitude": 51.5074,
            "longitude": -0.1278,
            "timezone": "Europe/London"
        }
    }
)

print(response.json())

Tham số ​

Tham sốKiểuBắt buộcMô tả
dateTimestringCóNgày/giờ theo định dạng YYYY-MM-DDTHH:mm
location.latitudenumberCóVĩ độ (-90 đến 90)
location.longitudenumberCóKinh độ (-180 đến 180)
location.timezonestringCóMã định danh múi giờ IANA
houseSystemstringKhôngHệ thống cung nhà (mặc định: "placidus")
moonCenterstringKhôngTâm tham chiếu Mặt Trăng: topocentric (mặc định, đã hiệu chỉnh thị sai cho nơi sinh) hoặc geocentric (tâm Trái Đất). Chỉ ảnh hưởng đến Mặt Trăng. Xem Độ Chính Xác
pointsarrayKhôngCác điểm thiên thể để tính toán (xem Các Điểm Khả dụng bên dưới)
orbsobjectKhôngGiá trị dung sai tùy chỉnh theo loại góc chiếu (ví dụ: { "conjunction": 8, "opposition": 6 })
languagestringKhôngMã ngôn ngữ cho nội dung văn bản (mặc định: "en")
includeTextbooleanKhôngBao gồm văn bản giải thích (mặc định: false)
includeReadableEntitiesbooleanKhôngBao gồm tiêu đề thực thể dễ đọc (mặc định: false)

Hệ thống Cung nhà ​

  • placidus - Placidus (mặc định)
  • koch - Koch
  • equal - Cung Bằng nhau
  • whole - Toàn Dấu hiệu
  • campanus - Campanus
  • regiomontanus - Regiomontanus
  • porphyry - Porphyry

Phản hồi ​

json
{
  "data": {
    "dateTime": "1990-06-15T12:30:00.000Z",
    "points": {
      "sun": {
        "pointId": "sun",
        "longitude": 84.5,
        "sign": "gemini",
        "signTitle": "Gemini",
        "degreesInSign": 24.5,
        "degreesInSignDms": [24, 30, 0],
        "houseNumber": 10,
        "houseId": "house-10",
        "retrograde": false,
        "pointTitle": "Sun",
        "houseTitle": "10th House"
      },
      "moon": {
        "pointId": "moon",
        "longitude": 245.2,
        "sign": "sagittarius",
        "signTitle": "Sagittarius",
        "degreesInSign": 5.2,
        "degreesInSignDms": [5, 12, 0],
        "houseNumber": 4,
        "houseId": "house-4",
        "retrograde": false,
        "pointTitle": "Moon",
        "houseTitle": "4th House"
      }
    },
    "angles": {
      "ascendant": {
        "pointId": "ascendant",
        "longitude": 180.5,
        "degreesInSign": 0.5,
        "degreesInSignDms": [0, 30, 0],
        "sign": "libra"
      },
      "descendant": {
        "pointId": "descendant",
        "longitude": 0.5,
        "degreesInSign": 0.5,
        "degreesInSignDms": [0, 30, 0],
        "sign": "aries"
      },
      "midheaven": {
        "pointId": "midheaven",
        "longitude": 270.2,
        "degreesInSign": 0.2,
        "degreesInSignDms": [0, 12, 0],
        "sign": "capricorn"
      },
      "imumCoeli": {
        "pointId": "imumCoeli",
        "longitude": 90.2,
        "degreesInSign": 0.2,
        "degreesInSignDms": [0, 12, 0],
        "sign": "cancer"
      }
    },
    "houses": {
      "cusps": [
        { "longitude": 180.5, "longitudeDms": { "degrees": 180, "minutes": 30, "seconds": 0 }, "sign": "libra" },
        { "longitude": 210.3, "longitudeDms": { "degrees": 210, "minutes": 18, "seconds": 0 }, "sign": "scorpio" }
      ],
      "ascmc": [
        { "longitude": 180.5, "longitudeDms": { "degrees": 180, "minutes": 30, "seconds": 0 }, "sign": "libra" },
        { "longitude": 270.2, "longitudeDms": { "degrees": 270, "minutes": 12, "seconds": 0 }, "sign": "capricorn" }
      ]
    },
    "aspects": [
      {
        "pointA": "sun",
        "pointB": "moon",
        "aspect": "opposition",
        "angle": 160.7,
        "orb": 0.7,
        "applying": false,
        "pointATitle": "Sun",
        "pointBTitle": "Moon",
        "aspectTitle": "Opposition"
      }
    ],
    "chart": {
      "url": "https://api.astroapi.cloud/api/chart2/natal.svg?..."
    }
  }
}

Điểm Cung nhà

Mỗi đối tượng cusp bao gồm longitude (độ hoàng đạo), longitudeDms (độ/phút/giây) và sign (mã cung hoàng đạo). Cusp đầu tiên (cusps[0]) là Cung Mệnh (Ascendant). Mảng ascmc chứa Cung Mệnh, Trung Thiên (MC), ARMC và Vertex.

Các Điểm Khả dụng ​

Sử dụng tham số points để chọn các điểm thiên thể cần tính toán. Nếu bỏ qua, bộ mặc định sẽ được sử dụng.

Các Điểm Mặc định ​

sun, moon, mercury, venus, mars, jupiter, saturn, uranus, neptune, pluto, meanNode, trueNode, meanApogee, osculatingApog

Tất cả các Điểm Khả dụng ​

Point IDMô tả
sunMặt Trời
moonMặt Trăng
mercurySao Thủy
venusSao Kim
marsSao Hỏa
jupiterSao Mộc
saturnSao Thổ
uranusSao Thiên Vương
neptuneSao Hải Vương
plutoSao Diêm Vương
meanNodeBắc Giao điểm Trung bình
trueNodeBắc Giao điểm Thực
meanApogeeLilith Trung bình (Mặt Trăng Đen)
osculatingApogLilith Thực (Mặt Trăng Đen)
chironChiron
pholusPholus
ceresCeres
pallasPallas
junoJuno
vestaVesta
interpolatedLunarApogeeApogee Mặt Trăng Nội suy
interpolatedLunarPerigeePerigee Mặt Trăng Nội suy (Priapus)
earthTrái Đất

Ví dụ: Chỉ Tính toán Mặt Trời và Sao Hỏa ​

bash
curl -X POST "https://api.astroapi.cloud/api/calc/natal" \
  -H "X-Api-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "dateTime": "1990-06-15T14:30",
    "location": {
      "latitude": 51.5074,
      "longitude": -0.1278,
      "timezone": "Europe/London"
    },
    "points": ["sun", "mars"]
  }'

Phản hồi sẽ có sun và mars trong đối tượng points, và tất cả bốn góc trong đối tượng angles:

json
{
  "data": {
    "points": {
      "sun": { "pointId": "sun", "longitude": 84.5, "sign": "gemini", ... },
      "mars": { "pointId": "mars", "longitude": 12.3, "sign": "aries", ... }
    },
    "angles": {
      "ascendant": {
        "pointId": "ascendant",
        "longitude": 180.5,
        "degreesInSign": 0.5,
        "degreesInSignDms": [0, 30, 0],
        "sign": "libra"
      },
      "descendant": { "pointId": "descendant", "longitude": 0.5, "sign": "aries", ... },
      "midheaven": { "pointId": "midheaven", "longitude": 270.2, "sign": "capricorn", ... },
      "imumCoeli": { "pointId": "imumCoeli", "longitude": 90.2, "sign": "cancer", ... }
    },
    "houses": { ... },
    "aspects": [ ... ]
  }
}

Các Góc

Cả bốn góc (ascendant, descendant, midheaven, imumCoeli) luôn được bao gồm trong đối tượng angles, bất kể tham số points. Các góc được tính từ phép tính cung nhà, không phải từ lịch thiên văn, nên có cấu trúc đơn giản hơn (không có dữ liệu tốc độ hoặc nghịch hành). Mảng ascmc trong phản hồi houses cũng luôn chứa kinh độ góc thô.

Mặt Trăng & Mặt Trời ​

Tính toán pha trăng, độ chiếu sáng, thời gian mọc/lặn và dữ liệu vị trí mặt trời.

POST /api/calc/moon-sun ​

bash
curl -X POST "https://api.astroapi.cloud/api/calc/moon-sun" \
  -H "X-Api-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "dateTime": "2024-06-15T12:00",
    "location": {
      "latitude": 52.37,
      "longitude": 4.89,
      "timezone": "Europe/Amsterdam"
    }
  }'

Tham số ​

Tham sốKiểuBắt buộcMô tả
dateTimestringCóNgày/giờ theo định dạng YYYY-MM-DDTHH:mm
location.latitudenumberCóVĩ độ (-90 đến 90)
location.longitudenumberCóKinh độ (-180 đến 180)
location.timezonestringCóMã định danh múi giờ IANA

Module Bắt buộc

Endpoint này yêu cầu module module:moon.

Phản hồi ​

json
{
  "data": {
    "moon": {
      "phaseName": "Waxing Gibbous",
      "phase": 0.62,
      "illumination": 0.78,
      "age": 9.2,
      "distance": 384400,
      "diameterDegrees": 0.52,
      "rise": "2024-06-15T14:23:00Z",
      "set": "2024-06-16T02:15:00Z"
    },
    "sun": {
      "rise": "2024-06-15T05:18:00Z",
      "set": "2024-06-15T22:03:00Z",
      "transit": "2024-06-15T13:40:00Z",
      "distance": 151820000,
      "diameterDegrees": 0.524,
      "twilight": {
        "civil": {
          "begin": "2024-06-15T04:38:00Z",
          "end": "2024-06-15T22:43:00Z"
        },
        "nautical": {
          "begin": "2024-06-15T03:32:00Z",
          "end": "2024-06-15T23:49:00Z"
        },
        "astronomical": {
          "begin": null,
          "end": null
        }
      }
    }
  }
}

Độ chính xác Tính toán ​

AstroAPI đọc trực tiếp lịch thiên văn JPL DE442 của NASA để đạt độ chính xác dưới mili-giây cung cho vị trí hành tinh. Xem trang Độ chính xác Tính toán để biết chi tiết đầy đủ về nguồn dữ liệu và các hiệu chỉnh.

AstroAPI Documentation