Cloudflare mass delete subdomains

In our case we need to delete quadrillion of subdomain which may be automated via api like so

$headers = @{'Authorization' = "Bearer $($env:CLOUDFLARE_TOKEN)" } # "DNS read/write" token
$zones = Invoke-RestMethod "https://api.cloudflare.com/client/v4/zones" -Headers $headers | Select-Object -ExpandProperty result | Select-Object id, name
$zone = $zones | Where-Object name -eq 'rabota.ua' | Select-Object -ExpandProperty id
$dns = @()
$page = 1
do {
    $response = Invoke-RestMethod -Method Get -Uri "https://api.cloudflare.com/client/v4/zones/$zone/dns_records?type=A,CNAME&per_page=100&page=$page" -Headers $headers
    $dns += $response.result
    $page += 1
} while ($page -le $response.result_info.total_pages)
Write-Host "Retrieved $($dns.Count) DNS records"
$items = $dns | Where-Object name -Like '*.dev3.rabota.ua'
Write-Host "$($items.Count) are to be removed"
# $items | Select-Object name, type, content
# $item = $dns | Where-Object name -EQ 'dictionaries.dev.rabota.ua'
foreach ($item in $items) {
    try {
        Invoke-RestMethod -Method Delete -Uri "https://api.cloudflare.com/client/v4/zones/$zone/dns_records/$($item.id)" -Headers $headers | Out-Null
        Write-Host "$($item.name) - success" -ForegroundColor Green
    } catch {
        Write-Host "$($item.name) - failed" -ForegroundColor Red
    }
    Start-Sleep -Seconds 1
}