ソウルメモリーコードを使って、外部サービス(LINE公式アカウント、ミニアプリ、他の占いサイト等)から占術データを利用できます。認証不要・無料です(一部APIに回数制限あり)。
1. コード検証 API
POST /.netlify/functions/api-validate
{ "code": "SMC-11GECNMEWQSAAINTJ" }
→ { "success": true, "result": { "valid": true } }
2. デコード API
POST /.netlify/functions/api-decode
{ "code": "SMC-11GECNMEWQSAAINTJ" }
→ { "success": true, "profile": { "sunSign": "双子座", ... } }
3. 運勢占い API
POST /api/public-fortune
{ "code": "SMC-...", "period": "today" }
// period: today/week/month/3months/firsthalf/secondhalf/year
→ { "success": true, "fortune": { "reading": "..." } }
※ このAPIのみ、同一IPから10回/60秒の制限があります。超えると429が返ります。
4. 相性診断 API
POST /.netlify/functions/api-compatibility
{ "code1": "SMC-...", "code2": "SMC-...", "types": ["love"] }
// types: work/friend/love/family
→ { "success": true, "compatibility": { "overallScore": 78, ... } }
LINE連携の例
const res = await fetch(
"https://soulmemorycode.com/api/public-fortune",
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ code: "SMC-...", period: "today" })
}
);
const data = await res.json();
// data.fortune.reading をLINE返信メッセージとして送信