Tạo Key nhiều lần
API tạo key kích hoạt nhiều lần.
Tạo key kích hoạt nhiều lần (Multi-use)
API này cho phép tạo key có thể kích hoạt nhiều lần trên nhiều thiết bị khác nhau (giới hạn bởi activateCount).
POST /public/v1/key/multiple-activate
Content-Type: application/json X-API-Key: YOUR_API_KEY
Tham số (Request Body)
| Trường | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
quantity | Int | ✅ | Số lượng key cần tạo (1 - 100). |
packageIds | Array | ✅ | Mảng ID các package. |
duration | Int | ✅ | Thời hạn (ví dụ: 30). |
unit | String | ✅ | hour, day, week, month, year. |
activateCount | Int | ✅ | Số lượng thiết bị tối đa được dùng chung 1 key này. |
alias | String | ❌ | Prefix cho key. |
Ví dụ Response
201 Created - Thành công
json
{
"message": "Create key successfully",
"data": [
"DEMO-30D-XYZ789..."
]
}
401 Unauthorized - Sai / Thiếu API Key
json
{
"message": "API key is required"
}
Ví dụ PHP (cURL)
php
<?php
$apiKey = 'YOUR_API_KEY';
$url = 'http://' . $_SERVER['HTTP_HOST'] . '/public/v1/key/multiple-activate';
$data = [
'quantity' => 1,
'packageIds' => [5],
'duration' => 6,
'unit' => 'month',
'activateCount' => 10,
'alias' => 'vip-group'
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'X-API-Key: ' . $apiKey
],
]);
$response = curl_exec($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
echo "HTTP Code: " . $httpCode . "\n";
echo "Response: " . $response . "\n";
?>
© 2026 CTDOAPIKEY Documentation