HKAIEHF Logo

香港人工智能教育及健康基金

Hong Kong AI Education & Health Foundation

證書驗證 API 文檔

供第三方系統程式化驗證證書真偽

API 概述
香港人工智能教育及健康基金提供公開的 REST API,供企業、機構和開發者驗證證書的真偽和有效性。

🔑 認證方式

目前 API 為公開訪問,無需認證。未來可能會引入 API Key 機制。

🌐 Base URL

https://hkaiehf.ai/api/trpc

📊 速率限制

批量驗證最多支持 100 個證書編號

單個證書驗證
驗證單個證書的真偽和有效性

請求方式

GET

端點

/api/trpc/publicCertificate.verify?input={"certificateNumber":"HKAIEHF-AI-00001"}

請求參數

參數名類型必填說明
certificateNumberstring證書編號(例如:HKAIEHF-AI-00001)

回應範例(成功)

{
  "result": {
    "data": {
      "valid": true,
      "message": "證書有效",
      "certificate": {
        "certificateNumber": "HKAIEHF-AI-00001",
        "studentName": "張三",
        "issuedAt": "2024-01-15T00:00:00.000Z",
        "validUntil": "2027-01-15T00:00:00.000Z",
        "certificatePdfUrl": "https://..."
      }
    }
  }
}

回應範例(證書不存在)

{
  "result": {
    "data": {
      "valid": false,
      "message": "證書編號不存在"
    }
  }
}
批量證書驗證
一次驗證多個證書(最多 100 個)

請求方式

GET

端點

/api/trpc/publicCertificate.batchVerify?input={"certificateNumbers":["HKAIEHF-AI-00001","HKAIEHF-AI-00002"]}

請求參數

參數名類型必填說明
certificateNumbersstring[]證書編號陣列(最多 100 個)

回應範例

{
  "result": {
    "data": {
      "total": 2,
      "results": [
        {
          "certificateNumber": "HKAIEHF-AI-00001",
          "valid": true,
          "message": "證書有效",
          "studentName": "張三",
          "issuedAt": "2024-01-15T00:00:00.000Z",
          "validUntil": "2027-01-15T00:00:00.000Z"
        },
        {
          "certificateNumber": "HKAIEHF-AI-00002",
          "valid": false,
          "message": "證書不存在或尚未發出"
        }
      ]
    }
  }
}
HTTP 狀態碼
狀態碼說明
200請求成功
400請求參數錯誤
500伺服器內部錯誤
程式碼範例
不同程式語言的調用示例

JavaScript / TypeScript

// 單個驗證
const response = await fetch(
  'https://hkaiehf.ai/api/trpc/publicCertificate.verify?input=' +
  encodeURIComponent(JSON.stringify({ certificateNumber: 'HKAIEHF-AI-00001' }))
);
const data = await response.json();
console.log(data.result.data);

// 批量驗證
const batchResponse = await fetch(
  'https://hkaiehf.ai/api/trpc/publicCertificate.batchVerify?input=' +
  encodeURIComponent(JSON.stringify({ 
    certificateNumbers: ['HKAIEHF-AI-00001', 'HKAIEHF-AI-00002'] 
  }))
);
const batchData = await batchResponse.json();
console.log(batchData.result.data);

Python

import requests
import json
from urllib.parse import urlencode

# 單個驗證
params = {'certificateNumber': 'HKAIEHF-AI-00001'}
url = f'https://hkaiehf.ai/api/trpc/publicCertificate.verify?input={json.dumps(params)}'
response = requests.get(url)
data = response.json()
print(data['result']['data'])

# 批量驗證
batch_params = {'certificateNumbers': ['HKAIEHF-AI-00001', 'HKAIEHF-AI-00002']}
batch_url = f'https://hkaiehf.ai/api/trpc/publicCertificate.batchVerify?input={json.dumps(batch_params)}'
batch_response = requests.get(batch_url)
batch_data = batch_response.json()
print(batch_data['result']['data'])

PHP

<?php
// 單個驗證
$params = ['certificateNumber' => 'HKAIEHF-AI-00001'];
$url = 'https://hkaiehf.ai/api/trpc/publicCertificate.verify?input=' . 
       urlencode(json_encode($params));
$response = file_get_contents($url);
$data = json_decode($response, true);
print_r($data['result']['data']);

// 批量驗證
$batchParams = ['certificateNumbers' => ['HKAIEHF-AI-00001', 'HKAIEHF-AI-00002']];
$batchUrl = 'https://hkaiehf.ai/api/trpc/publicCertificate.batchVerify?input=' . 
            urlencode(json_encode($batchParams));
$batchResponse = file_get_contents($batchUrl);
$batchData = json_decode($batchResponse, true);
print_r($batchData['result']['data']);
?>
技術支援

如有任何技術問題或需要協助整合 API,請聯絡我們:

📧 電郵:[email protected]

訂閱電子報
獲取最新的 AI 教育資訊、活動通知和精選文章,直接送到您的郵箱。

我們尊重您的隱私,不會與第三方分享您的電子郵件地址。您可以隨時取消訂閱。

支持我們的使命

您的捐款將幫助我們推動 AI 教育與健康項目,讓更多人受惠。

立即捐款
HKAIEHF Logo

致力推動人工智能於教育與健康領域的實際應用,讓更多人回歸運動、健康與幸福的生活。

聯絡我們

測試期間收費項目由代理公司處理:

Slash Service Ltd

www.slashservice.com

© 2026 香港人工智能教育及健康基金. 版權所有.