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 - Bad Request
{
"error": "INVALID_INPUT",
"errorMessage": "Invalid jurisdiction"
}
HTTP 401 - Unauthorized
{
"error": "UNAUTHORIZED",
"errorMessage": "Unauthorized"
}
HTTP 429 - Too Many Requests
ベストプラクティス
セキュリティ
- APIキーを公開しない: APIキーを安全に保管し、クライアントサイドコードに含めないでください
- 環境変数を使用: APIキーをソースコードではなく環境変数に保存してください
- サーバーサイドのみ: ブラウザやモバイルアプリではなく、バックエンドサーバーからすべてのAPI呼び出しを行ってください
- HTTPSのみ: APIキーを転送中に保護するために、APIリクエストには常にHTTPSを使用してください
パフォーマンス
- レスポンスをキャッシュ: API呼び出しを減らすために、管轄区域の年齢ゲート要件をキャッシュしてください
- エラーハンドリング: 適切なエラーハンドリングと指数バックオフによる再試行ロジックを実装してください
実装
- 地域の変動を処理: 正確なコンプライアンスのために、利用可能な場合は細分区分コード(US-CA、GB-ENG)を使用してください
- グレースフルデグラデーション: APIが一時的に利用できない場合のフォールバックロジックを持ってください
- ユーザーエクスペリエンス: 必要な場合にのみ年齢ゲートを条件付きで表示するために
shouldDisplay
フラグを使用してください