운세 목록 조회
curl --request GET \
--url https://sajuapi.dev/v1/fortunes \
--header 'X-API-Key: <api-key>'import requests
url = "https://sajuapi.dev/v1/fortunes"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://sajuapi.dev/v1/fortunes', 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/fortunes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://sajuapi.dev/v1/fortunes"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sajuapi.dev/v1/fortunes")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sajuapi.dev/v1/fortunes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body운세
운세 목록 조회
GET
/
v1
/
fortunes
운세 목록 조회
curl --request GET \
--url https://sajuapi.dev/v1/fortunes \
--header 'X-API-Key: <api-key>'import requests
url = "https://sajuapi.dev/v1/fortunes"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://sajuapi.dev/v1/fortunes', 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/fortunes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://sajuapi.dev/v1/fortunes"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sajuapi.dev/v1/fortunes")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sajuapi.dev/v1/fortunes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_bodyv1 Enterprise API (Coming Soon)이 엔드포인트는 Enterprise 버전에서 제공될 예정입니다.
현재는 v0 API를 사용하세요.
Query 파라미터
string
특정 프로필의 운세만 조회합니다.
string
운세 유형으로 필터링합니다.
daily, yearly, monthly 중 하나입니다.string
특정 날짜의 운세만 조회합니다. YYYY-MM-DD 형식입니다.
string
지정된 날짜 이후의 운세를 조회합니다. YYYY-MM-DD 형식입니다.
string
지정된 날짜 이전의 운세를 조회합니다. YYYY-MM-DD 형식입니다.
string
사용된 AI 모델로 필터링합니다.
integer
default:"20"
한 페이지에 반환할 운세 수입니다. 1에서 100 사이의 값이어야 합니다.
string
다음 페이지를 조회하기 위한 커서입니다.
Response
성공
운세 목록 조회에 성공하면 운세 배열과 페이지네이션 정보가 반환됩니다.| 필드 | 타입 | 설명 |
|---|---|---|
data | array | Fortune 객체 배열입니다. |
has_more | boolean | 다음 페이지가 있는지 여부입니다. |
next_cursor | string | 다음 페이지 조회를 위한 커서입니다. |
total_count | integer | 필터 조건에 맞는 전체 운세 수입니다. |
실패
| 상태 코드 | 에러 타입 | 설명 |
|---|---|---|
| 400 | validation_error | 쿼리 파라미터가 유효하지 않음 |
| 401 | authentication_error | API 키가 유효하지 않음 |
| 429 | rate_limited | 요청 한도 초과 |
요청 예시
curl -X GET "https://api.sajuapi.dev/v1/fortunes?profile_id=prf_abc123&fortune_type=daily&limit=10" \
-H "X-API-Key: bs_live_xxx"
const params = new URLSearchParams({
profile_id: 'prf_abc123',
fortune_type: 'daily',
limit: '10'
});
const response = await fetch(
`https://api.sajuapi.dev/v1/fortunes?${params}`,
{
headers: {
'X-API-Key': 'bs_live_xxx'
}
}
);
const { data, has_more, next_cursor } = await response.json();
import requests
response = requests.get(
'https://api.sajuapi.dev/v1/fortunes',
headers={'X-API-Key': 'bs_live_xxx'},
params={
'profile_id': 'prf_abc123',
'fortune_type': 'daily',
'limit': 10
}
)
result = response.json()
fortunes = result['data']
응답 예시
{
"data": [
{
"id": "ftn_xyz789abc123",
"profile_id": "prf_abc123def456",
"fortune_type": "daily",
"fortune_date": "2025-01-16",
"model": "sonnet",
"score": 85,
"summary": "오늘은 새로운 기회가 찾아오는 날입니다.",
"cached": false,
"generated_at": "2025-01-16T09:00:00Z"
},
{
"id": "ftn_abc123xyz789",
"profile_id": "prf_abc123def456",
"fortune_type": "daily",
"fortune_date": "2025-01-15",
"model": "haiku",
"score": 72,
"summary": "안정적인 하루가 예상됩니다.",
"cached": true,
"generated_at": "2025-01-15T09:00:00Z"
}
],
"has_more": true,
"next_cursor": "eyJpZCI6ImZ0bl9hYmMxMjN4eXo3ODkifQ==",
"total_count": 45
}
날짜 범위 조회
특정 기간의 운세를 조회할 때date_from과 date_to를 함께 사용합니다.
// 최근 7일간의 운세 조회
const today = new Date();
const weekAgo = new Date(today);
weekAgo.setDate(weekAgo.getDate() - 7);
const params = new URLSearchParams({
profile_id: 'prf_abc123',
date_from: weekAgo.toISOString().split('T')[0],
date_to: today.toISOString().split('T')[0]
});
const response = await fetch(`/v1/fortunes?${params}`, {
headers: { 'X-API-Key': 'bs_live_xxx' }
});
⌘I