궁합 계산
curl --request POST \
--url https://sajuapi.dev/v1/calculations/compatibility \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"person1.birth_year": 123,
"person1.birth_month": 123,
"person1.birth_day": 123,
"person1.birth_hour": 123,
"person1.gender": "<string>",
"person2.birth_year": 123,
"person2.birth_month": 123,
"person2.birth_day": 123,
"person2.birth_hour": 123,
"person2.gender": "<string>",
"relationship_type": "<string>",
"model": "<string>"
}
'import requests
url = "https://sajuapi.dev/v1/calculations/compatibility"
payload = {
"person1.birth_year": 123,
"person1.birth_month": 123,
"person1.birth_day": 123,
"person1.birth_hour": 123,
"person1.gender": "<string>",
"person2.birth_year": 123,
"person2.birth_month": 123,
"person2.birth_day": 123,
"person2.birth_hour": 123,
"person2.gender": "<string>",
"relationship_type": "<string>",
"model": "<string>"
}
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({
'person1.birth_year': 123,
'person1.birth_month': 123,
'person1.birth_day': 123,
'person1.birth_hour': 123,
'person1.gender': '<string>',
'person2.birth_year': 123,
'person2.birth_month': 123,
'person2.birth_day': 123,
'person2.birth_hour': 123,
'person2.gender': '<string>',
relationship_type: '<string>',
model: '<string>'
})
};
fetch('https://sajuapi.dev/v1/calculations/compatibility', 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/compatibility",
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([
'person1.birth_year' => 123,
'person1.birth_month' => 123,
'person1.birth_day' => 123,
'person1.birth_hour' => 123,
'person1.gender' => '<string>',
'person2.birth_year' => 123,
'person2.birth_month' => 123,
'person2.birth_day' => 123,
'person2.birth_hour' => 123,
'person2.gender' => '<string>',
'relationship_type' => '<string>',
'model' => '<string>'
]),
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/compatibility"
payload := strings.NewReader("{\n \"person1.birth_year\": 123,\n \"person1.birth_month\": 123,\n \"person1.birth_day\": 123,\n \"person1.birth_hour\": 123,\n \"person1.gender\": \"<string>\",\n \"person2.birth_year\": 123,\n \"person2.birth_month\": 123,\n \"person2.birth_day\": 123,\n \"person2.birth_hour\": 123,\n \"person2.gender\": \"<string>\",\n \"relationship_type\": \"<string>\",\n \"model\": \"<string>\"\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/compatibility")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"person1.birth_year\": 123,\n \"person1.birth_month\": 123,\n \"person1.birth_day\": 123,\n \"person1.birth_hour\": 123,\n \"person1.gender\": \"<string>\",\n \"person2.birth_year\": 123,\n \"person2.birth_month\": 123,\n \"person2.birth_day\": 123,\n \"person2.birth_hour\": 123,\n \"person2.gender\": \"<string>\",\n \"relationship_type\": \"<string>\",\n \"model\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sajuapi.dev/v1/calculations/compatibility")
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 \"person1.birth_year\": 123,\n \"person1.birth_month\": 123,\n \"person1.birth_day\": 123,\n \"person1.birth_hour\": 123,\n \"person1.gender\": \"<string>\",\n \"person2.birth_year\": 123,\n \"person2.birth_month\": 123,\n \"person2.birth_day\": 123,\n \"person2.birth_hour\": 123,\n \"person2.gender\": \"<string>\",\n \"relationship_type\": \"<string>\",\n \"model\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body계산
궁합 계산
POST
/
v1
/
calculations
/
compatibility
궁합 계산
curl --request POST \
--url https://sajuapi.dev/v1/calculations/compatibility \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"person1.birth_year": 123,
"person1.birth_month": 123,
"person1.birth_day": 123,
"person1.birth_hour": 123,
"person1.gender": "<string>",
"person2.birth_year": 123,
"person2.birth_month": 123,
"person2.birth_day": 123,
"person2.birth_hour": 123,
"person2.gender": "<string>",
"relationship_type": "<string>",
"model": "<string>"
}
'import requests
url = "https://sajuapi.dev/v1/calculations/compatibility"
payload = {
"person1.birth_year": 123,
"person1.birth_month": 123,
"person1.birth_day": 123,
"person1.birth_hour": 123,
"person1.gender": "<string>",
"person2.birth_year": 123,
"person2.birth_month": 123,
"person2.birth_day": 123,
"person2.birth_hour": 123,
"person2.gender": "<string>",
"relationship_type": "<string>",
"model": "<string>"
}
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({
'person1.birth_year': 123,
'person1.birth_month': 123,
'person1.birth_day': 123,
'person1.birth_hour': 123,
'person1.gender': '<string>',
'person2.birth_year': 123,
'person2.birth_month': 123,
'person2.birth_day': 123,
'person2.birth_hour': 123,
'person2.gender': '<string>',
relationship_type: '<string>',
model: '<string>'
})
};
fetch('https://sajuapi.dev/v1/calculations/compatibility', 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/compatibility",
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([
'person1.birth_year' => 123,
'person1.birth_month' => 123,
'person1.birth_day' => 123,
'person1.birth_hour' => 123,
'person1.gender' => '<string>',
'person2.birth_year' => 123,
'person2.birth_month' => 123,
'person2.birth_day' => 123,
'person2.birth_hour' => 123,
'person2.gender' => '<string>',
'relationship_type' => '<string>',
'model' => '<string>'
]),
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/compatibility"
payload := strings.NewReader("{\n \"person1.birth_year\": 123,\n \"person1.birth_month\": 123,\n \"person1.birth_day\": 123,\n \"person1.birth_hour\": 123,\n \"person1.gender\": \"<string>\",\n \"person2.birth_year\": 123,\n \"person2.birth_month\": 123,\n \"person2.birth_day\": 123,\n \"person2.birth_hour\": 123,\n \"person2.gender\": \"<string>\",\n \"relationship_type\": \"<string>\",\n \"model\": \"<string>\"\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/compatibility")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"person1.birth_year\": 123,\n \"person1.birth_month\": 123,\n \"person1.birth_day\": 123,\n \"person1.birth_hour\": 123,\n \"person1.gender\": \"<string>\",\n \"person2.birth_year\": 123,\n \"person2.birth_month\": 123,\n \"person2.birth_day\": 123,\n \"person2.birth_hour\": 123,\n \"person2.gender\": \"<string>\",\n \"relationship_type\": \"<string>\",\n \"model\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sajuapi.dev/v1/calculations/compatibility")
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 \"person1.birth_year\": 123,\n \"person1.birth_month\": 123,\n \"person1.birth_day\": 123,\n \"person1.birth_hour\": 123,\n \"person1.gender\": \"<string>\",\n \"person2.birth_year\": 123,\n \"person2.birth_month\": 123,\n \"person2.birth_day\": 123,\n \"person2.birth_hour\": 123,\n \"person2.gender\": \"<string>\",\n \"relationship_type\": \"<string>\",\n \"model\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyv1 Enterprise API (Coming Soon)이 엔드포인트는 Enterprise 버전에서 제공될 예정입니다.
현재는 v0 API를 사용하세요.
이 API는 현재 베타 버전입니다. 기능과 응답 형식이 변경될 수 있습니다.
Request Body 파라미터
person1 (필수)
integer
required
첫 번째 사람의 출생 연도입니다.
integer
required
첫 번째 사람의 출생 월입니다.
integer
required
첫 번째 사람의 출생 일입니다.
integer
첫 번째 사람의 출생 시입니다.
string
required
첫 번째 사람의 성별입니다.
person2 (필수)
integer
required
두 번째 사람의 출생 연도입니다.
integer
required
두 번째 사람의 출생 월입니다.
integer
required
두 번째 사람의 출생 일입니다.
integer
두 번째 사람의 출생 시입니다.
string
required
두 번째 사람의 성별입니다.
기타 파라미터
string
default:"romantic"
관계 유형입니다.
romantic(연애/결혼), business(비즈니스), friendship(우정) 중 하나입니다.string
default:"haiku"
AI 분석에 사용할 모델입니다.
Response
성공
궁합 계산에 성공하면 Compatibility 객체가 반환됩니다.실패
| 상태 코드 | 에러 타입 | 설명 |
|---|---|---|
| 400 | validation_error | 요청 데이터가 유효하지 않음 |
| 401 | authentication_error | API 키가 유효하지 않음 |
| 429 | rate_limited | 요청 한도 초과 |
| 503 | service_unavailable | AI 모델 서비스 일시 불가 |
요청 예시
curl -X POST https://api.sajuapi.dev/v1/calculations/compatibility \
-H "X-API-Key: bs_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"person1": {
"birth_year": 1990,
"birth_month": 3,
"birth_day": 15,
"birth_hour": 14,
"gender": "male"
},
"person2": {
"birth_year": 1992,
"birth_month": 7,
"birth_day": 22,
"birth_hour": 10,
"gender": "female"
},
"relationship_type": "romantic",
"model": "sonnet"
}'
const response = await fetch('https://api.sajuapi.dev/v1/calculations/compatibility', {
method: 'POST',
headers: {
'X-API-Key': 'bs_live_xxx',
'Content-Type': 'application/json'
},
body: JSON.stringify({
person1: {
birth_year: 1990,
birth_month: 3,
birth_day: 15,
birth_hour: 14,
gender: 'male'
},
person2: {
birth_year: 1992,
birth_month: 7,
birth_day: 22,
birth_hour: 10,
gender: 'female'
},
relationship_type: 'romantic',
model: 'sonnet'
})
});
const compatibility = await response.json();
import requests
response = requests.post(
'https://api.sajuapi.dev/v1/calculations/compatibility',
headers={'X-API-Key': 'bs_live_xxx'},
json={
'person1': {
'birth_year': 1990,
'birth_month': 3,
'birth_day': 15,
'birth_hour': 14,
'gender': 'male'
},
'person2': {
'birth_year': 1992,
'birth_month': 7,
'birth_day': 22,
'birth_hour': 10,
'gender': 'female'
},
'relationship_type': 'romantic',
'model': 'sonnet'
}
)
compatibility = response.json()
응답 예시
{
"relationship_type": "romantic",
"overall": {
"score": 82,
"rating": "excellent",
"summary": "두 분의 궁합은 매우 좋습니다. 병화(丙火)와 임수(壬水)의 조합으로 서로를 보완하는 관계입니다."
},
"person1": {
"day_master": "병화",
"element": "fire",
"characteristics": ["열정적", "리더십", "적극적"]
},
"person2": {
"day_master": "임수",
"element": "water",
"characteristics": ["지혜로움", "유연함", "포용력"]
},
"element_interaction": {
"type": "상극",
"description": "화(火)와 수(水)는 상극 관계이지만, 적절한 균형을 이루면 서로를 제어하고 보완합니다.",
"balance": "positive",
"advice": "서로의 다름을 인정하고 존중하면 더욱 강한 유대를 형성할 수 있습니다."
},
"categories": {
"emotional": {
"score": 85,
"description": "감정적으로 서로를 잘 이해합니다. 첫 번째 분의 열정을 두 번째 분이 차분하게 받아줍니다."
},
"communication": {
"score": 78,
"description": "의사소통 스타일이 다르지만, 노력하면 좋은 대화가 가능합니다."
},
"values": {
"score": 80,
"description": "핵심 가치관이 비슷합니다. 가정과 안정을 중시합니다."
},
"physical": {
"score": 88,
"description": "물리적 케미스트리가 좋습니다."
},
"growth": {
"score": 82,
"description": "함께 성장할 수 있는 관계입니다."
}
},
"strengths": [
"서로 부족한 부분을 보완합니다",
"열정과 지혜가 조화를 이룹니다",
"갈등 해결 능력이 있습니다",
"장기적인 관계에 적합합니다"
],
"challenges": [
"의사소통 방식의 차이",
"에너지 레벨의 차이로 인한 갈등 가능성",
"서로 다른 표현 방식"
],
"advice": {
"for_person1": "상대방의 조용한 시간을 존중해주세요. 모든 것을 적극적으로 끌고 가려 하지 마세요.",
"for_person2": "상대방의 열정에 좀 더 적극적으로 반응해주세요. 감정 표현을 조금 더 해주면 좋겠습니다.",
"together": "서로의 다름을 인정하고, 정기적으로 깊은 대화 시간을 가지세요."
},
"lucky_elements": {
"shared_colors": ["보라", "파랑"],
"shared_numbers": [1, 6],
"best_date_days": ["수요일", "토요일"]
},
"generated_at": "2025-01-16T09:00:00Z",
"model": "sonnet",
"latency_ms": 4200
}
Compatibility 객체
| 필드 | 타입 | 설명 |
|---|---|---|
relationship_type | string | 관계 유형입니다. |
overall | object | 전체 궁합 점수와 요약입니다. |
person1 | object | 첫 번째 사람의 사주 정보입니다. |
person2 | object | 두 번째 사람의 사주 정보입니다. |
element_interaction | object | 오행 상호작용 분석입니다. |
categories | object | 카테고리별 호환성입니다. |
strengths | array | 관계의 강점입니다. |
challenges | array | 관계의 도전 과제입니다. |
advice | object | 각자와 함께에 대한 조언입니다. |
lucky_elements | object | 함께 어울리는 행운 요소입니다. |
궁합 등급
| 점수 | 등급 | 설명 |
|---|---|---|
| 90-100 | perfect | 천생연분 |
| 80-89 | excellent | 매우 좋음 |
| 70-79 | good | 좋음 |
| 60-69 | moderate | 보통 |
| 50-59 | challenging | 노력 필요 |
| 0-49 | difficult | 어려움 |
궁합 결과는 참고용입니다. 실제 관계의 성공은 두 사람의 노력과 소통에 달려있습니다.
⌘I