Skip to content

Delete Keys

Overview

Delete API keys that are no longer needed via API to free up resources and reduce security risks.

API Request

Request Example

bash
curl -X DELETE https://ai-tokenhub.com/v1/keys/{hash} \
  -H "Authorization: Bearer <YOUR_MANAGEMENT_API_KEY>"

Request Parameters

ParameterTypeLocationDescription
hashstringpathHash of the key to delete

Response Example

Success Response

json
{
  "success": true
}

Error Response

json
{
  "error": {
    "message": "Key not found",
    "type": "invalid_request_error",
    "code": "key_not_found"
  }
}

Precautions

  1. Verify Before Deleting: Before deleting a key, ensure it is not being used by any application
  2. Backup Information: Record the basic information of the key before deletion for audit purposes
  3. Non-recoverable: Keys cannot be recovered after deletion, please operate with caution

Security Best Practices

Regular Cleanup

  • Regularly review and delete keys that are no longer in use
  • Monitor abnormally used keys and revoke them promptly

Least Privilege

  • Create keys with the minimum necessary permissions for different applications
  • Avoid creating unrestricted keys