AgeKit: 범용 나이 API
소개
AgeKit은 k-ID의 범용 나이 API로, 195개 이상의 국가와 240개 이상의 관할권에서 디지털 동의 나이 요구사항 및 규제 정보에 즉시 액세스할 수 있도록 합니다. 단일 API 통합으로 나이 게이트를 표시해야 하는지 여부를 결정하고, 디지털 동의 및 데이터 처리 컴플라이언스를 위한 현지 나이 요구사항을 이해할 수 있습니다.
API는 사용자의 관할권을 기반으로 포괄적인 나이 게이트 요구사항을 반환하여, 적절한 나이 확인 플로우를 구현하고, 현지 규정을 이해하며, 사용자 경험을 최적화하면서 글로벌 컴플라이언스를 보장하는 데 도움을 줍니다.
주요 기능
- 글로벌 커버리지: 195개 이상의 국가와 240개 이상의 관할권
- 규제 인텔리전스: 현지 나이 요구사항에 대한 실시간 액세스
- 프라이버시 우선: 개인 데이터 보관 없이 최소한의 데이터 처리
- 항상 최신: 월간 규제 업데이트
- 간단 한 통합: 전 세계 컴플라이언스를 위한 단일 엔드포인트
기본 URL
https://game-api.k-id.com/api/v1/
인증
모든 API 요청은 Authorization 헤더에서 Bearer 토큰을 사용한 인증이 필요합니다. 이 토큰은 AgeKit 환영 이메일에서 제공됩니다.
Authorization: Bearer YOUR_API_KEY
⚠️ 보안 모범 사례: API 키를 클라이언트 측 코드나 프론트엔드 애플리케이션에 포함하지 마세요. 이 엔드포인트는 서버 간 통신 전용으로 설계되었습니다.
엔드포인트: 나이 게이트 요구사항 가져오기
GET /age-gate/get-requirements
플레이어의 관할권을 기반으로 나이 게이트를 표시하기 위한 요구사항을 가져옵니다. 이 엔드포인트는 나이 게이트를 표시해야 하는지, 현지 나이 요구사항이 무엇인지, 그리고 관할권에서 승인된 나이 수집 방법이 무엇인지 결정하는 데 도움을 줍니다.
매개변수
매개변수 | 유형 | 필수 | 설명 |
---|---|---|---|
jurisdiction | string | 예 | ISO 3166-1 alpha-2 국가 코드(예: "US") 또는 ISO 3166-2 세분화 코드(예: "US-CA")로 된 관할권. 가능한 경우 세분화 코드를 권장합니다. |
요청 예시
- cURL
- JavaScript
- Python
- PHP
- C#
curl -X GET "https://game-api.k-id.com/api/v1/age-gate/get-requirements?jurisdiction=US-CA" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json"
const axios = require('axios');
async function getAgeGateRequirements(jurisdiction) {
try {
const response = await axios.get('https://game-api.k-id.com/api/v1/age-gate/get-requirements', {
params: { jurisdiction },
headers: {
'Authorization': `Bearer ${process.env.AGEKIT_API_KEY}`,
'Accept': 'application/json'
}
});
return response.data;
} catch (error) {
console.error('Error fetching age gate requirements:', error.response?.data || error.message);
throw error;
}
}
// 사용법
getAgeGateRequirements('US-CA')
.then(result => {
console.log('Should display age gate:', result.shouldDisplay);
console.log('Digital consent age:', result.digitalConsentAge);
console.log('Approved methods:', result.approvedAgeCollectionMethods);
})
.catch(error => console.error(error));
import requests
import os
def get_age_gate_requirements(jurisdiction):
url = "https://game-api.k-id.com/api/v1/age-gate/get-requirements"
headers = {
"Authorization": f"Bearer {os.getenv('AGEKIT_API_KEY')}",
"Accept": "application/json"
}
params = {
"jurisdiction": jurisdiction
}
try:
response = requests.get(url, headers=headers, params=params)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f"Error fetching age gate requirements: {e}")
raise
# 사용법
try:
result = get_age_gate_requirements("US-CA")
print(f"Should display age gate: {result['shouldDisplay']}")
print(f"Digital consent age: {result['digitalConsentAge']}")
print(f"Approved methods: {result['approvedAgeCollectionMethods']}")
except Exception as e:
print(f"Error: {e}")
<?php
function getAgeGateRequirements($jurisdiction) {
$url = 'https://game-api.k-id.com/api/v1/age-gate/get-requirements';
$url .= '?' . http_build_query(['jurisdiction' => $jurisdiction]);
$headers = [
'Authorization: Bearer ' . $_ENV['AGEKIT_API_KEY'],
'Accept: application/json'
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode !== 200) {
throw new Exception("API request failed with status code: $httpCode");
}
return json_decode($response, true);
}
// 사용법
try {
$result = getAgeGateRequirements('US-CA');
echo "Should display age gate: " . ($result['shouldDisplay'] ? 'Yes' : 'No') . "\n";
echo "Digital consent age: " . $result['digitalConsentAge'] . "\n";
echo "Approved methods: " . implode(', ', $result['approvedAgeCollectionMethods']) . "\n";
} catch (Exception $e) {
echo "Error: " . $e->getMessage() . "\n";
}
?>
using System;
using System.Net.Http;
using System.Threading.Tasks;
using System.Text.Json;
public class AgeKitClient
{
private readonly HttpClient _httpClient;
private readonly string _apiKey;
public AgeKitClient(string apiKey)
{
_apiKey = apiKey;
_httpClient = new HttpClient();
_httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiKey}");
_httpClient.DefaultRequestHeaders.Add("Accept", "application/json");
}
public async Task<AgeGateRequirementsResponse> GetAgeGateRequirementsAsync(string jurisdiction)
{
var url = $"https://game-api.k-id.com/api/v1/age-gate/get-requirements?jurisdiction={jurisdiction}";
try
{
var response = await _httpClient.GetAsync(url);
response.EnsureSuccessStatusCode();
var json = await response.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize<AgeGateRequirementsResponse>(json, new JsonSerializerOptions
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
});
}
catch (HttpRequestException ex)
{
throw new Exception($"Error fetching age gate requirements: {ex.Message}");
}
}
}
public class AgeGateRequirementsResponse
{
public bool ShouldDisplay { get; set; }
public bool AgeAssuranceRequired { get; set; }
public int DigitalConsentAge { get; set; }
public int CivilAge { get; set; }
public int MinimumAge { get; set; }
public string[] ApprovedAgeCollectionMethods { get; set; }
}
// 사용법
var client = new AgeKitClient(Environment.GetEnvironmentVariable("AGEKIT_API_KEY"));
var result = await client.GetAgeGateRequirementsAsync("US-CA");
Console.WriteLine($"Should display age gate: {result.ShouldDisplay}");
Console.WriteLine($"Digital consent age: {result.DigitalConsentAge}");
Console.WriteLine($"Approved methods: {string.Join(", ", result.ApprovedAgeCollectionMethods)}");
응답 형식
성공 응답 (200 OK)
{
"shouldDisplay": true,
"ageAssuranceRequired": true,
"digitalConsentAge": 13,
"civilAge": 18,
"minimumAge": 0,
"approvedAgeCollectionMethods": [
"date-of-birth",
"age-slider",
"platform-account"
]
}
응답 필드
필드 | 유형 | 필수 | 설명 |
---|---|---|---|
shouldDisplay | boolean | 예 | 현지 규정에 따라 플레이어에게 나이 게이트를 표시해야 하는지 여부를 나타냅니다 |
ageAssuranceRequired | boolean | 예 | 이 관할권의 플레이어에게 나이 보증(확인)이 필요한지 여부 |
digitalConsentAge | integer | 예 | 플레이어가 데이터 처리에 대한 디지털 동의를 제공할 수 있는 최소 나이 |
civilAge | integer | 예 | 플레이어가 관할권에서 법적 성인으로 간주되는 민사/계약 나이 |
minimumAge | integer | 예 | 플랫폼/게임에 액세스하는 데 필요한 최소 나이(제한이 없는 경우 일반적으로 0) |
approvedAgeCollectionMethods | array | 예 | 이 관할권의 플레이어로부터 나이 신호를 수집하기 위한 승인된 방법 목록 |
나이 수집 방법
approvedAgeCollectionMethods
배열에는 다음이 포함될 수 있습니다:
승인된 수집 방법 | 설명 |
---|---|
date-of-birth | 전체 생년월일 (YYYY-MM-DD) |
age-slider | 나이 범위 또는 대략적인 나이 선택 |
platform-account | 기존 플랫폼 계정 나이 확인 사용 |
관할권 형식
관할권은 다음과 같이 제공되어야 합니다:
- ISO 3166-1 alpha-2 국가 코드:
US
,GB
,DE
,AU
- ISO 3166-2 세분화 코드:
US-CA
,GB-ENG
,DE-BY
,AU-NSW
권장사항: 더 정확한 규제 컴플라이언스를 위해 가능한 경우 항상 세분화 코드를 사용하세요.
오류 응답
- 400
- 401
- 429
HTTP 400 - 잘못된 요청
{
"error": "INVALID_INPUT",
"errorMessage": "Invalid jurisdiction"
}
HTTP 401 - 인증되지 않음
{
"error": "UNAUTHORIZED",
"errorMessage": "Unauthorized"
}
HTTP 429 - 너무 많은 요청
모범 사례
보안
- API 키를 노출하지 마세요: API 키를 안전하게 보관하고 클라이언트 측 코드에 포함하지 마세요
- 환경 변수 사용: API 키를 소스 코드가 아닌 환경 변수에 저장하세요
- 서버 측만: 브라우저나 모바일 앱이 아닌 백엔드 서버에서 모든 API 호출을 수행하세요
- HTTPS만: 전송 중 API 키를 보호하기 위해 API 요청에 항상 HTTPS를 사용하세요
성능
- 응답 캐싱: API 호출을 줄이기 위해 관할권별 나이 게이트 요구사항을 캐시하세요
- 오류 처리: 지수 백오프를 사용한 적절한 오류 처리 및 재시도 로직을 구현하세요
구현
- 지역별 변형 처리: 정확한 컴플라이언스를 위해 가능한 경우 세분화 코드(US-CA, GB-ENG)를 사용하세요
- 우아한 성능 저하: API가 일시적으로 사용할 수 없는 경우 대체 로직을 갖추세요
- 사용자 경험:
shouldDisplay
플래그를 사용하여 필요한 경우에만 조건부로 나이 게이트를 표시하세요