인증

Authentication — header-based partner authentication and key management. English text follows each Korean section.

헤더 인증

모든 FI 엔드포인트(공개 GET /fi/health 제외)는 요청마다 두 개의 헤더를 요구합니다.

EN — Every FI endpoint (except the public GET /fi/health) requires two headers on each request.

헤더설명
X-Client-Id발급받은 파트너 클라이언트 ID / your partner client id
X-API-Key발급받은 API 키(평문). 서버는 BCrypt 해시와 대조 / your API key (plaintext); verified against a BCrypt hash server-side
curl -s https://trendy.storydot.kr/superapp/api/fi/whoami \
  -H "X-Client-Id: YOUR_CLIENT_ID" \
  -H "X-API-Key: YOUR_API_KEY"

헤더가 없거나 키가 틀리면 SW2102(INVALID_API_KEY), 클라이언트가 정지 상태면 SW2101(PARTNER_CLIENT_SUSPENDED)이 반환됩니다.

EN — Missing/invalid credentials return SW2102 (INVALID_API_KEY); a suspended client returns SW2101 (PARTNER_CLIENT_SUSPENDED).

환경(environment)과 키

키는 발급 시 LIVE 또는 SANDBOX 환경에 결속됩니다. 기본 URL은 동일하며, 서버가 인증된 키의 환경을 보고 분기합니다.

현재 키의 환경은 GET /fi/whoami로 확인할 수 있고, 점수 응답에도 environment 필드("LIVE" | "SANDBOX")가 포함됩니다.

EN — A key is bound to LIVE or SANDBOX at issuance. The base URL is shared; the server branches on the authenticated key's environment. A SANDBOX key never reaches real-subject lookup code. Check your environment via GET /fi/whoami; score responses also carry an environment field ("LIVE" | "SANDBOX").

키 관리 수칙

EN — Key management rules: the key is shown in plaintext only once at issuance (hash-only storage; it cannot be retrieved later — request re-issuance if lost). Keep it in a secrets manager, never in code, repos or logs. Server-to-server only — never embed the key in a browser or mobile app. Request rotation immediately on suspected exposure. The server updates the client's last_used_at on each successful authentication so unused keys can be identified.

속도 제한

기본 속도 제한은 60 req/min입니다. 초과 시 HTTP 429와 Retry-After: <seconds> 헤더가 반환됩니다. 재시도 정책은 에러 페이지를 보세요.

EN — Default rate limit is 60 req/min. Exceeding it returns HTTP 429 with a Retry-After: <seconds> header. See Errors for the retry policy.

웹훅 서명 키

웹훅 엔드포인트를 등록하면 별도의 서명 시크릿이 생성되어 1회 평문으로 반환됩니다. API 키와는 다른 값이며, 수신한 웹훅의 X-HACS-Signature 검증에만 사용합니다. 상세는 웹훅 페이지를 보세요.

EN — Registering a webhook endpoint generates a separate signing secret, returned in plaintext once. It differs from the API key and is used only to verify the X-HACS-Signature header on received webhooks. See Webhooks.