curl --request PUT \
--url https://api.example.com/api/ai/key \
--header 'Content-Type: application/json' \
--data '
{
"key": "<string>"
}
'Store or update the user’s Gemini API key
curl --request PUT \
--url https://api.example.com/api/ai/key \
--header 'Content-Type: application/json' \
--data '
{
"key": "<string>"
}
'204 No Content on success with an empty response body.
curl -X PUT https://api.example.com/api/ai/key \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
-H "Content-Type: application/json" \
-d '{
"key": "AIzaSyD..."
}'
HTTP/1.1 204 No Content
{
"error": "Bad Request",
"message": "API key cannot be empty"
}
{
"error": "Unauthorized",
"message": "Invalid or missing authentication token"
}
{
"error": "Not Found",
"message": "User not found"
}
EncryptionService before storage