CLI Companion

  • Hugging Face CLI
    • login
    • whoami
    • repo create
    • upload
    • download
    • lfs-enable-largefiles
    • scan-cache
    • delete-cache
  • Hapi CLI
    • new
    • start
    • build
    • test
    • plugin create
    • route add
  • Cloudflared
    • tunnel
    • tunnel run
    • tunnel list
    • tunnel delete
    • access
    • access tcp
    • update

    The `cloudflared tunnel delete` command is used to permanently remove a Cloudflare Tunnel configuration from your Cloudflare account. Deleting a tunnel will stop all traffic routing through it and disconnect any `cloudflared` instances actively connected to that tunnel. If there are running `cloudflared` instances still attempting to connect to the tunnel, the command will typically prompt you or require a `--force` flag.

    Syntax

    bash
    cloudflared tunnel delete <TUNNEL_NAME_OR_UUID> [--force] [--confirm]

    Arguments

    * `<TUNNEL_NAME_OR_UUID>`: This is a required argument. It can be either the unique name you assigned to the tunnel during its creation, or its UUID (Universal Unique Identifier).

    Options

    * `-f`, `--force`: This flag allows you to delete the tunnel even if there are active `cloudflared` instances connected to it. Without this flag, `cloudflared` will usually refuse to delete a tunnel if it detects active connections, prompting you to manually stop the `cloudflared` service first.

    * `-y`, `--confirm`: This flag automatically confirms the deletion without an interactive prompt. Useful for scripting or automated environments.

    Usage Examples

    #### 1. Deleting a tunnel by its name (with confirmation)

    This is the most common way to delete a tunnel. `cloudflared` will prompt you to confirm the action.

    bash
    cloudflared tunnel delete my-web-tunnel

    Output (example):

    Are you sure you want to delete tunnel my-web-tunnel (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)? [y/N]: y
    Tunnel my-web-tunnel (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) deleted successfully.

    #### 2. Deleting a tunnel by its UUID (without confirmation)

    If you know the UUID of the tunnel and want to delete it without any interactive prompts (e.g., in a script), use the `--confirm` flag.

    bash
    cloudflared tunnel delete xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --confirm

    #### 3. Deleting a tunnel with active connections (force delete)

    If you have `cloudflared` running and connected to a tunnel, and you wish to delete the tunnel immediately without stopping the running service first, use the `--force` flag. Be cautious with this as it will abruptly terminate the tunnel's connections.

    bash
    cloudflared tunnel delete my-stuck-tunnel --force --confirm

    Important Notes

    * **Credential File**: Deleting a tunnel using `cloudflared tunnel delete` *does not* remove the associated credential file (e.g., `~/.cloudflared/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.json`) from your local system. You should manually remove this file if you no longer need it to prevent potential misuse or clutter.

    * **DNS Records**: If you configured DNS records to point to your tunnel (e.g., CNAME records), `cloudflared tunnel delete` *will not* automatically remove these DNS entries from your Cloudflare zone. You must manually delete any related DNS records through the Cloudflare dashboard or API if they are no longer needed. The only exception might be if `cloudflared` itself created CNAME records for public hostnames directly managed by the tunnel's configuration, which might be cleaned up automatically in some cases.

    * **Impact**: Deleting a tunnel is an irreversible action. Ensure you are deleting the correct tunnel, especially when using `--force` and `--confirm` flags.