API Documentation

Delete an account

This command deletes an account along with all resources, access tokens, backup history, and all child accounts. 

API request 

Method DELETE 

/users/{user-id}

Example

Method DELETE

https://dk-co.keepit.com/users/r4hsnr-ktb74l-bsq8ka

Result

PowerShell script

try { 
    # Define the API credentials 
    $username = '<API Token username>' 
    $password = '<API Token password>' 

     
    # Define the fixed subaccount ID 
    $subaccountID = 'Subaccount GUID' 

     
    # Create the Basic Authentication header 
    $basicauth = [Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("${username}:${password}")) 
    $headers = @{ 
        "User-Agent" = "PowerShell-Keepit-API-Agent-1.0" 
        "Authorization" = "Basic $basicauth" 
    } 

 
    # Construct the URL with the subaccount ID 
    $url = "https://dk-co.keepit.com/users/$subaccountID" 

 
    # Send the DELETE request 
    $response = Invoke-WebRequest -Uri $url -Method Delete -Headers $headers -ErrorAction Stop -TimeoutSec 10 

 
    # Display the response 
    Write-Host $response.Content 
} 
catch { 
    # Handle errors and provide line number and error message 
    $line = $_.InvocationInfo.ScriptLineNumber 
    Write-Host "Cannot query Keepit API due to: $_" 
    Write-Host "at line $line" 
} 

Additional information

  • If the delete-retention-period resource is set in the product configuration, the account will be scheduled for deletion instead of being deleted immediately. All associated resources will be retained until the retention period expires.
  • The initiating token must be authenticated as a parent of that account.