API 문서

인증

모든 API 요청에는 Authorization 헤더에 API Key를 포함해야 합니다.

Authorization: Bearer eak_your_api_key_here

Base URL

https://easy-auth.compounding.co.kr/api/v1

인증번호 발송

POST /api/v1/send

지정한 전화번호로 6자리 인증번호를 발송합니다. 인증번호는 3분간 유효합니다.

Request Body

{
  "phoneNumber": "01012345678"  // 하이픈 없이
}

Response (200)

{
  "success": true,
  "requestId": "req_abc123def456...",
  "expiresAt": "2026-01-01T00:03:00.000Z"
}

Error Responses

Status설명
400잘못된 전화번호 형식
401유효하지 않은 API Key
402크레딧 부족

인증번호 검증

POST /api/v1/verify

사용자가 입력한 인증번호를 검증합니다. 성공 시 1크레딧이 차감됩니다.

Request Body

{
  "requestId": "req_abc123def456...",
  "code": "123456"
}

Response - 성공 (200)

{
  "success": true,
  "phoneNumber": "01012345678"
}

Response - 실패 (200)

{
  "success": false,
  "error": "Invalid verification code"
}

Error Responses

Status설명
400만료된 인증번호 / 이미 인증됨
401유효하지 않은 API Key
402크레딧 부족
404인증 세션을 찾을 수 없음

코드 예시

JavaScript / Node.js

// 인증번호 발송
const sendRes = await fetch('https://easy-auth.compounding.co.kr/api/v1/send', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer eak_your_api_key',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ phoneNumber: '01012345678' }),
});
const { requestId } = await sendRes.json();

// 인증번호 검증
const verifyRes = await fetch('https://easy-auth.compounding.co.kr/api/v1/verify', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer eak_your_api_key',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ requestId, code: '123456' }),
});
const { success } = await verifyRes.json();

과금 정책

  • 인증번호 발송(send): 크레딧 차감 없음
  • 인증 성공(verify): 성공 시 1크레딧 차감
  • 인증 실패: 크레딧 차감 없음
  • 크레딧 부족 시: send API에서 402 에러 반환