Reset Key

Xóa trắng thiết bị đã kích hoạt trên key.

Reset Key (Xóa thiết bị)

API này sẽ xóa toàn bộ danh sách thiết bị (UUID) đã kích hoạt trên key này, đưa key về trạng thái "Chưa sử dụng".

PATCH /public/v1/key/{key}/reset
X-API-Key: YOUR_API_KEY

Path Parameters

Tham sốKiểuBắt buộcMô tả
keyStringMã key cần reset (VD: KEY1-XXXX-XXXX).
Cảnh báo
Tất cả thiết bị đang sử dụng key này sẽ bị ngắt kết nối ngay lập tức. Tính năng này yêu cầu bạn là người sở hữu key.

Ví dụ Response

200 OK - Thành công

json
{
  "message": "Reset successfully",
  "resetCount": 3
}

403 Forbidden - Không có quyền

json
{
  "message": "You don't have permission to reset this key"
}

Ví dụ PHP (cURL)

php
<?php
$apiKey = 'YOUR_API_KEY';
$keyToReset = 'DEMO-ONCE-30D-ABCD';
$url = 'http://' . $_SERVER['HTTP_HOST'] . '/public/v1/key/' . $keyToReset . '/reset';

$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 => 'PATCH',
    CURLOPT_HTTPHEADER => [
        '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