const rewardsAppId = 'YOUR_REWARDS_APP_ID';
const apiKeyId = 'YOUR_API_KEY_ID';
const jwtToken = 'YOUR_JWT_TOKEN';
async function revokeApiKey(rewardsAppId, apiKeyId) {
const response = await fetch(
`https://api.zbdpay.com/api/v1/rewards/app/${rewardsAppId}/api-key/${apiKeyId}`,
{
method: 'DELETE',
headers: {
'z-client': 'developer-dashboard',
'Authorization': `Bearer ${jwtToken}`
}
}
);
const data = await response.json();
if (data.success) {
console.log('✅ API key revoked successfully!');
console.log('This key can no longer be used for authentication.');
return data;
} else {
throw new Error(`Failed: ${data.message}`);
}
}
// Revoke key
await revokeApiKey(
'b28e0306-2c06-4092-8d56-a1623d6b97fb',
'78b411d8-1f61-4824-97c6-e3c3a571f1c5'
);