사주 계산
curl --request POST \
--url https://sajuapi.dev/v1/calculations/saju \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"birth_year": 123,
"birth_month": 123,
"birth_day": 123,
"birth_hour": 123,
"gender": "<string>",
"calendar_type": "<string>",
"include_analysis": true
}
'import requests
url = "https://sajuapi.dev/v1/calculations/saju"
payload = {
"birth_year": 123,
"birth_month": 123,
"birth_day": 123,
"birth_hour": 123,
"gender": "<string>",
"calendar_type": "<string>",
"include_analysis": True
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
birth_year: 123,
birth_month: 123,
birth_day: 123,
birth_hour: 123,
gender: '<string>',
calendar_type: '<string>',
include_analysis: true
})
};
fetch('https://sajuapi.dev/v1/calculations/saju', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sajuapi.dev/v1/calculations/saju",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'birth_year' => 123,
'birth_month' => 123,
'birth_day' => 123,
'birth_hour' => 123,
'gender' => '<string>',
'calendar_type' => '<string>',
'include_analysis' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sajuapi.dev/v1/calculations/saju"
payload := strings.NewReader("{\n \"birth_year\": 123,\n \"birth_month\": 123,\n \"birth_day\": 123,\n \"birth_hour\": 123,\n \"gender\": \"<string>\",\n \"calendar_type\": \"<string>\",\n \"include_analysis\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sajuapi.dev/v1/calculations/saju")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"birth_year\": 123,\n \"birth_month\": 123,\n \"birth_day\": 123,\n \"birth_hour\": 123,\n \"gender\": \"<string>\",\n \"calendar_type\": \"<string>\",\n \"include_analysis\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sajuapi.dev/v1/calculations/saju")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"birth_year\": 123,\n \"birth_month\": 123,\n \"birth_day\": 123,\n \"birth_hour\": 123,\n \"gender\": \"<string>\",\n \"calendar_type\": \"<string>\",\n \"include_analysis\": true\n}"
response = http.request(request)
puts response.read_body계산
사주 계산
POST
/
v1
/
calculations
/
saju
사주 계산
curl --request POST \
--url https://sajuapi.dev/v1/calculations/saju \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"birth_year": 123,
"birth_month": 123,
"birth_day": 123,
"birth_hour": 123,
"gender": "<string>",
"calendar_type": "<string>",
"include_analysis": true
}
'import requests
url = "https://sajuapi.dev/v1/calculations/saju"
payload = {
"birth_year": 123,
"birth_month": 123,
"birth_day": 123,
"birth_hour": 123,
"gender": "<string>",
"calendar_type": "<string>",
"include_analysis": True
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
birth_year: 123,
birth_month: 123,
birth_day: 123,
birth_hour: 123,
gender: '<string>',
calendar_type: '<string>',
include_analysis: true
})
};
fetch('https://sajuapi.dev/v1/calculations/saju', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sajuapi.dev/v1/calculations/saju",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'birth_year' => 123,
'birth_month' => 123,
'birth_day' => 123,
'birth_hour' => 123,
'gender' => '<string>',
'calendar_type' => '<string>',
'include_analysis' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sajuapi.dev/v1/calculations/saju"
payload := strings.NewReader("{\n \"birth_year\": 123,\n \"birth_month\": 123,\n \"birth_day\": 123,\n \"birth_hour\": 123,\n \"gender\": \"<string>\",\n \"calendar_type\": \"<string>\",\n \"include_analysis\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sajuapi.dev/v1/calculations/saju")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"birth_year\": 123,\n \"birth_month\": 123,\n \"birth_day\": 123,\n \"birth_hour\": 123,\n \"gender\": \"<string>\",\n \"calendar_type\": \"<string>\",\n \"include_analysis\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sajuapi.dev/v1/calculations/saju")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"birth_year\": 123,\n \"birth_month\": 123,\n \"birth_day\": 123,\n \"birth_hour\": 123,\n \"gender\": \"<string>\",\n \"calendar_type\": \"<string>\",\n \"include_analysis\": true\n}"
response = http.request(request)
puts response.read_bodyv1 Enterprise API (Coming Soon)이 엔드포인트는 Enterprise 버전에서 제공될 예정입니다.
현재는 v0 API를 사용하세요.
프로필과 함께 사주를 저장하려면 프로필 생성 API를 사용하세요. 이 API는 일회성 계산에 적합합니다.
Request Body 파라미터
integer
required
출생 연도입니다. 1900에서 2100 사이의 값이어야 합니다.
integer
required
출생 월입니다. 1에서 12 사이의 값이어야 합니다.
integer
required
출생 일입니다. 1에서 31 사이의 값이어야 합니다.
integer
출생 시입니다. 0에서 23 사이의 값이어야 합니다. 값을 넣지 않으면 시주(時柱) 없이 연주, 월주, 일주만 계산됩니다.
string
required
성별입니다.
male 또는 female 중 하나입니다. 대운(大運) 계산에 사용됩니다.string
default:"solar"
달력 유형입니다.
solar(양력) 또는 lunar(음력) 중 하나입니다.boolean
default:"true"
상세 분석을 포함할지 여부입니다.
Response
성공
사주 계산에 성공하면 Saju 객체가 반환됩니다.실패
| 상태 코드 | 에러 타입 | 설명 |
|---|---|---|
| 400 | validation_error | 요청 데이터가 유효하지 않음 |
| 401 | authentication_error | API 키가 유효하지 않음 |
| 429 | rate_limited | 요청 한도 초과 |
요청 예시
curl -X POST https://api.sajuapi.dev/v1/calculations/saju \
-H "X-API-Key: bs_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"birth_year": 1990,
"birth_month": 3,
"birth_day": 15,
"birth_hour": 14,
"gender": "male",
"calendar_type": "solar",
"include_analysis": true
}'
const response = await fetch('https://api.sajuapi.dev/v1/calculations/saju', {
method: 'POST',
headers: {
'X-API-Key': 'bs_live_xxx',
'Content-Type': 'application/json'
},
body: JSON.stringify({
birth_year: 1990,
birth_month: 3,
birth_day: 15,
birth_hour: 14,
gender: 'male',
calendar_type: 'solar',
include_analysis: true
})
});
const saju = await response.json();
import requests
response = requests.post(
'https://api.sajuapi.dev/v1/calculations/saju',
headers={'X-API-Key': 'bs_live_xxx'},
json={
'birth_year': 1990,
'birth_month': 3,
'birth_day': 15,
'birth_hour': 14,
'gender': 'male',
'calendar_type': 'solar',
'include_analysis': True
}
)
saju = response.json()
응답 예시
{
"pillars": {
"year": {
"stem": "경",
"stem_hanja": "庚",
"stem_meaning": "양금(陽金)",
"branch": "오",
"branch_hanja": "午",
"branch_meaning": "말",
"element": "metal",
"hidden_stems": ["정", "기"]
},
"month": {
"stem": "기",
"stem_hanja": "己",
"stem_meaning": "음토(陰土)",
"branch": "묘",
"branch_hanja": "卯",
"branch_meaning": "토끼",
"element": "earth",
"hidden_stems": ["을"]
},
"day": {
"stem": "병",
"stem_hanja": "丙",
"stem_meaning": "양화(陽火)",
"branch": "인",
"branch_hanja": "寅",
"branch_meaning": "호랑이",
"element": "fire",
"hidden_stems": ["갑", "병", "무"]
},
"hour": {
"stem": "을",
"stem_hanja": "乙",
"stem_meaning": "음목(陰木)",
"branch": "미",
"branch_hanja": "未",
"branch_meaning": "양",
"element": "wood",
"hidden_stems": ["기", "정", "을"]
}
},
"day_master": {
"stem": "병",
"hanja": "丙",
"name": "병화",
"element": "fire",
"polarity": "yang",
"description": "태양과 같이 밝고 뜨거운 기운입니다. 열정적이고 적극적인 성격을 가집니다.",
"characteristics": [
"밝고 명랑한 성격",
"리더십이 강함",
"열정적이고 진취적",
"자기 표현력이 뛰어남"
]
},
"elements": {
"wood": {
"count": 2,
"percentage": 25,
"stems": ["을"],
"branches": ["묘", "인"]
},
"fire": {
"count": 3,
"percentage": 37.5,
"stems": ["병"],
"branches": ["오"]
},
"earth": {
"count": 1,
"percentage": 12.5,
"stems": ["기"],
"branches": []
},
"metal": {
"count": 1,
"percentage": 12.5,
"stems": ["경"],
"branches": []
},
"water": {
"count": 1,
"percentage": 12.5,
"stems": [],
"branches": []
}
},
"element_balance": {
"strongest": "fire",
"weakest": "water",
"needed": ["water", "metal"],
"excess": ["fire"]
},
"ten_year_cycles": [
{
"age_start": 1,
"age_end": 10,
"stem": "경",
"branch": "진",
"element": "metal",
"description": "초년운"
},
{
"age_start": 11,
"age_end": 20,
"stem": "신",
"branch": "사",
"element": "metal",
"description": "청년운"
}
],
"analysis": {
"personality": "병화 일주는 태양처럼 밝고 따뜻한 성격을 가집니다. 자신감이 넘치고 리더십이 강하며, 다른 사람들에게 영감을 주는 능력이 있습니다.",
"strengths": [
"강한 리더십과 카리스마",
"밝고 긍정적인 에너지",
"창의력과 표현력",
"결단력과 추진력"
],
"weaknesses": [
"지나친 자신감으로 인한 독선",
"인내심 부족",
"감정 기복"
],
"career_advice": "창의적인 분야, 리더십이 필요한 직종, 대중을 상대하는 직업에 적합합니다.",
"relationship_advice": "수(水) 기운이 있는 사람과의 관계가 조화롭습니다."
}
}
Saju 객체
사주(四柱) 정보
| 필드 | 타입 | 설명 |
|---|---|---|
pillars | object | 사주(四柱) 정보입니다. |
pillars.year | object | 연주(年柱)입니다. 태어난 해의 기둥입니다. |
pillars.month | object | 월주(月柱)입니다. 태어난 달의 기둥입니다. |
pillars.day | object | 일주(日柱)입니다. 태어난 날의 기둥입니다. |
pillars.hour | object | 시주(時柱)입니다. 태어난 시간의 기둥입니다. |
기둥(柱) 정보
| 필드 | 타입 | 설명 |
|---|---|---|
stem | string | 천간(天干)입니다. |
stem_hanja | string | 천간의 한자입니다. |
branch | string | 지지(地支)입니다. |
branch_hanja | string | 지지의 한자입니다. |
element | string | 오행입니다. |
hidden_stems | array | 지장간(支藏干)입니다. |
일주(日柱) 정보
| 필드 | 타입 | 설명 |
|---|---|---|
day_master.stem | string | 일간(日干)입니다. |
day_master.name | string | 일간의 이름입니다. |
day_master.element | string | 일간의 오행입니다. |
day_master.polarity | string | 음양입니다. yang 또는 yin입니다. |
day_master.description | string | 일간에 대한 설명입니다. |
천간(天干)과 지지(地支)
천간 (10개)
| 천간 | 한자 | 오행 | 음양 |
|---|---|---|---|
| 갑 | 甲 | 목(木) | 양 |
| 을 | 乙 | 목(木) | 음 |
| 병 | 丙 | 화(火) | 양 |
| 정 | 丁 | 화(火) | 음 |
| 무 | 戊 | 토(土) | 양 |
| 기 | 己 | 토(土) | 음 |
| 경 | 庚 | 금(金) | 양 |
| 신 | 辛 | 금(金) | 음 |
| 임 | 壬 | 수(水) | 양 |
| 계 | 癸 | 수(水) | 음 |
지지 (12개)
| 지지 | 한자 | 띠 | 오행 |
|---|---|---|---|
| 자 | 子 | 쥐 | 수(水) |
| 축 | 丑 | 소 | 토(土) |
| 인 | 寅 | 호랑이 | 목(木) |
| 묘 | 卯 | 토끼 | 목(木) |
| 진 | 辰 | 용 | 토(土) |
| 사 | 巳 | 뱀 | 화(火) |
| 오 | 午 | 말 | 화(火) |
| 미 | 未 | 양 | 토(土) |
| 신 | 申 | 원숭이 | 금(金) |
| 유 | 酉 | 닭 | 금(金) |
| 술 | 戌 | 개 | 토(土) |
| 해 | 亥 | 돼지 | 수(水) |
⌘I