Neo Bazi Solutions 四柱推命 API 仕様書

エンドポイント

POST GET /api/v1/calculate

四柱推命の計算結果を取得します。

認証

APIキーによる認証が必要です。以下のいずれかの方法でAPIキーを提供してください。

Authorization ヘッダー (推奨):

Authorization: Bearer YOUR_API_KEY

クエリパラメータ:

?api_key=YOUR_API_KEY
📝 Note: APIキーはダッシュボードで確認できます。

リクエストパラメータ

以下のパラメータを application/json 形式のPOSTボディ、またはURLクエリパラメータとして含めてください。

パラメータ名 必須 説明
year integer 必須 西暦年 (例: 1990)
month integer 必須 月 (1-12) (例: 5)
day integer 必須 日 (1-31) (例: 15)
location float 必須 経度 (東経を正の値で指定) (例: 139.6917)
hour integer 任意 時 (0-23)。time パラメータが指定されている場合は無視されます。
minute integer 任意 分 (0-59)。time パラメータが指定されている場合は無視されます。デフォルトは0です。
time string 任意 時刻を HH:MM 形式で指定します (例: "14:30")。hour, minute より優先されます。時刻が指定されない場合、デフォルトで "12:00" が使用されます。
api_key string 任意 APIキー。Authorizationヘッダーが優先されます。

レスポンス

成功した場合、以下の構造を持つJSONオブジェクトを返します。

{ "status": "success", "message": "API処理が正常に完了しました。", "credits_consumed": 10, "credits_remaining": 990, "result": { "input_date": "1990-05-15 14:30", "true_solar_time_raw": "1990-05-15 14:47:23", "true_solar_time": "1990-05-15 14:47", "spring_date": "1990/02/04 05:27", "year_ganzhi": "庚午", "month_ganzhi": "辛巳", "day_ganzhi": "甲戌", "time_ganzhi": "辛未", "month_ganzhi_date": "1990/05/05 16:27", "month_ganzhi_biko": "立夏(黄経45°)", "julian_day": 2448021.1159722, "day_ganzhi_details": { "number": 11, "element": "木", "yin_yang": "陽+", "heavenly_stem": "甲", "earthly_branch_group": "寅卯", "star": "貫索星", "animal": "緑の虎" }, "ten_gods": { "description": "十神は日干を基準とした他の天干との五行関係を表す", "year_pillar": { "stem": "庚", "ten_god": "偏財", "meaning": "自分がコントロールする動的な財。事業、流動資産" }, "month_pillar": { "stem": "辛", "ten_god": "正財", "meaning": "自分がコントロールする安定した財。給与、固定資産" }, "day_pillar": { "stem": "甲", "ten_god": "比肩", "meaning": "自分と同じ性質。協力者、兄弟姉妹、自立心" }, "hour_pillar": { "stem": "辛", "ten_god": "正財", "meaning": "自分がコントロールする安定した財。給与、固定資産" }, "summary": { "dominant_ten_god": "正財", "dominant_count": 2, "pattern_description": "バランス十神型 - 調和的な性格", "balance_assessment": { "strongest_category": "財産系", "balance_type": "バランス良好" } } }, "nayin": { "description": "納音は60干支を五行の音律により30対に分類したもの", "year_pillar": { "ganzhi": "庚午", "nayin": "路傍土", "element": "土", "meaning": "道端の土 - 実用的、基盤作り" }, "month_pillar": { "ganzhi": "辛巳", "nayin": "白蠟金", "element": "金", "meaning": "白い蝋の金 - 美的センス、洗練" }, "day_pillar": { "ganzhi": "甲戌", "nayin": "山頭火", "element": "火", "meaning": "山の火 - 高い志、リーダーシップ" }, "hour_pillar": { "ganzhi": "辛未", "nayin": "路傍土", "element": "土", "meaning": "道端の土 - 実用的、基盤作り" }, "compatibility": { "element_distribution": { "土": 2, "金": 1, "火": 1 }, "harmony_level": { "score": 75, "level": "中調和" }, "dominant_element": "土" } }, "shensha": { "description": "神殺は命式に現れる特殊な星で、吉凶や特殊な性質を表す", "tianyi_guiren": { "present": true, "locations": [ { "pillar": "時柱", "branch": "未", "meaning": "最高の吉星。貴人の助け、災難回避" } ], "count": 1, "effect": "強い貴人運、困難時の支援" }, "wenchang_guiren": { "present": false, "locations": [], "count": 0, "effect": "なし" }, "kuigang": { "present": false, "ganzhi": null, "meaning": "なし", "effect": "なし" }, "taohua": { "present": true, "locations": [ { "pillar": "年柱", "branch": "午", "meaning": "異性運、魅力、芸術性" } ], "count": 1, "effect": "魅力的、人気運、異性関係活発" }, "huagai": { "present": false, "locations": [], "count": 0, "effect": "なし" }, "kongwang": { "present": true, "locations": [ { "pillar": "月柱", "branch": "巳", "meaning": "空虚感、不安定さ、精神的な深み" } ], "count": 1, "effect": "精神的深み、不安定さ、特殊な感性" }, "summary": { "active_stars": [ "天乙貴人×1", "桃花×1", "空亡×1" ], "total_stars": 3, "fortune_score": 25, "overall_assessment": "普通の神殺配置", "description": "天乙貴人×1、桃花×1、空亡×1が命式に現れています" } }, "enhanced_summary": { "description": "拡張分析結果のサマリー", "key_characteristics": [ "十神: 正財が優勢 - 自分がコントロールする安定した財。給与、固定資産", "納音: 山頭火 - 山の火 - 高い志、リーダーシップ", "神殺: 天乙貴人×1、桃花×1、空亡×1が命式に現れています" ], "fortune_indicators": { "overall_fortune": { "score": 72, "level": "良好", "description": "良い運勢を持っています" }, "career_potential": { "score": 65, "level": "良好", "suitable_fields": [ "会計", "銀行", "不動産", "接客業", "芸能界" ] }, "relationship_luck": { "score": 78, "level": "良好", "characteristics": [ "魅力的で人気がある", "異性関係が活発", "困った時に助けてくれる人が現れる" ] }, "wealth_potential": { "score": 80, "level": "優秀", "wealth_type": "財運に恵まれるタイプ" }, "academic_talent": { "score": 55, "level": "普通", "learning_style": [ "標準的な学習能力" ] } } } }, "transaction_id": "txn_abc123def456", "log_id": "log_xyz789ghi012" }
📝 Note: result オブジェクト内のキーの順序は上記と異なる場合があります。

エラーレスポンス

エラーが発生した場合、以下の構造を持つJSONオブジェクトを返します。

{ "status": "error", "message": "エラーメッセージ" }

クレジット消費

API呼び出しごとに 10クレジット が消費されます。Enterpriseプランのユーザーはクレジットを消費しません。

サンプルコード

APIを利用するためのサンプルコードです。YOUR_API_KEY をご自身のAPIキーに置き換えてください。

cURL (Bash)

curl -X POST "https://api.nbs.jp/api/v1/calculate" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "year": 1990, "month": 5, "day": 15, "hour": 14, "minute": 30, "location": 139.6917 }'

JavaScript (Node.js)

const axios = require('axios'); const calculateBazi = async () => { try { const response = await axios.post( 'https://api.nbs.jp/api/v1/calculate', { year: 1990, month: 5, day: 15, hour: 14, minute: 30, location: 139.6917 }, { headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' } } ); return response.data; } catch (error) { console.error('Error:', error.response.data); throw error; } }; calculateBazi() .then(result => console.log(result)) .catch(error => console.error(error));

Python

import requests import json api_key = 'YOUR_API_KEY' url = 'https://api.nbs.jp/api/v1/calculate' data = { 'year': 1990, 'month': 5, 'day': 15, 'hour': 14, 'minute': 30, 'location': 139.6917 } headers = { 'Content-Type': 'application/json', 'Authorization': f'Bearer {api_key}' } response = requests.post( url, headers=headers, data=json.dumps(data) ) if response.status_code == 200: result = response.json() print(json.dumps(result, indent=2, ensure_ascii=False)) else: print(f"APIリクエストエラー: {response.status_code}") print(response.text)

備考

💡 Tips: 高精度な四柱推命計算のため、可能な限り正確な出生時刻と出生地の経度をご指定ください。