Skip to main content
DELETE
/
auth
/
proxy
curl -X DELETE https://api.electronhub.ai/v1/auth/proxy \
  -H "Authorization: Bearer $ELECTRONHUB_API_KEY"
{
  "message": "Proxy keys deleted"
}
curl -X DELETE https://api.electronhub.ai/v1/auth/proxy \
  -H "Authorization: Bearer $ELECTRONHUB_API_KEY"
{
  "message": "Proxy keys deleted"
}

Overview

Delete all proxy keys associated with your account in a single operation. This is useful for bulk cleanup, security incidents, or account reset scenarios.
Irreversible Action: This permanently deletes ALL proxy keys. This action cannot be undone, and all deleted keys will immediately stop working.

Important Considerations

All proxy keys stop working immediately. Any applications using these keys will start receiving authentication errors.
All unused credits from deleted proxy keys are returned to your main account balance.
Deleted keys cannot be recovered. You’ll need to recreate any keys you still need.
The operation executes immediately without additional confirmation prompts.

Before Bulk Deletion

Make sure to:
  1. Audit Current Keys: Use List Proxy Keys to review what will be deleted
  2. Update Applications: Remove or replace proxy keys in all applications
  3. Backup Configurations: Save key settings if you might need to recreate them
  4. Notify Team: Inform team members who might be using the keys
  5. Check Dependencies: Verify no critical services depend on the proxy keys

Example Workflow

Python - Safe Bulk Deletion
import httpx

def safe_bulk_delete_proxy_keys(api_key: str) -> dict:
    """Safely delete all proxy keys with confirmation"""
    client = httpx.Client()
    
    # First, list current keys for confirmation
    list_response = client.get(
        "https://api.electronhub.ai/v1/auth/proxy",
        headers={"Authorization": f"Bearer {api_key}"}
    )
    proxy_keys = list_response.json()
    
    if not proxy_keys:
        print("No proxy keys to delete")
        return {"message": "No proxy keys found"}
    
    print(f"Found {len(proxy_keys)} proxy keys:")
    for key in proxy_keys:
        print(f"  - {key['name']} ({key['key']})")
    
    # Confirm deletion
    confirm = input("Delete ALL proxy keys? (type 'DELETE' to confirm): ")
    if confirm != "DELETE":
        print("Deletion cancelled")
        return {"message": "Deletion cancelled"}
    
    # Perform bulk deletion
    delete_response = client.delete(
        "https://api.electronhub.ai/v1/auth/proxy",
        headers={"Authorization": f"Bearer {api_key}"}
    )
    
    result = delete_response.json()
    print(f"Bulk deletion completed: {result['message']}")
    return result

# Execute safe bulk deletion
result = safe_bulk_delete_proxy_keys(api_key)

Use Cases

Security Incident

Quickly revoke all delegated access during a security breach

Account Reset

Clean slate when restructuring API access patterns

Project Cleanup

Remove all temporary keys after project completion

Key Rotation

Part of a complete key rotation strategy

Alternative Approaches

Consider these alternatives before using bulk deletion:
Delete specific keys using Delete Proxy Key for more control
Temporarily disable all keys instead of deleting them:
# Disable all keys instead of deleting
for key in proxy_keys:
    toggle_response = client.post(
        f"https://api.electronhub.ai/v1/auth/proxy/toggle/{key['key']}",
        headers={"Authorization": f"Bearer {api_key}"}
    )
Filter and delete only specific types of keys:
# Delete only expired keys
import time
current_time = int(time.time())

for key in proxy_keys:
    if key['expires_at'] != -1 and key['expires_at'] < current_time:
        delete_response = client.delete(
            f"https://api.electronhub.ai/v1/auth/proxy/delete/{key['key']}",
            headers={"Authorization": f"Bearer {api_key}"}
        )

Error Codes

401
error
Unauthorized - Invalid or missing API key
403
error
Forbidden - API key doesn’t have permission to delete proxy keys
429
error
Rate Limited - Too many requests, please slow down

Authorizations

Authorization
string
header
required

Enter your API key (starts with 'ek-')

Response

200 - application/json

Success

message
string
Example:

"Proxy keys deleted"