<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "Tor",
  "identifier" : "/documentation/Tor/TorControlClient/delOnion(_:)-7ei4o",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Tor"
    ],
    "preciseIdentifier" : "s:3Tor0A13ControlClientC8delOnionyySSYaKF"
  },
  "title" : "delOnion(_:)"
}
-->

# delOnion(_:)

Remove an ephemeral onion service by its service ID
(`DEL_ONION`, control-spec.txt §3.28).

```
func delOnion(_ serviceID: String) async throws
```

## Parameters

`serviceID`

The v3 service ID **without** the
`.onion` suffix (56-character base32).

## Discussion

Sends `DEL_ONION <serviceID>` and consumes the reply. Reply
`552` (“unrecognized entity”) is translated to
[`TorError.invalidServiceID(_:)`](/documentation/Tor/TorError/invalidServiceID(_:)) so callers can branch on
typo-vs-real-failure; any other non-success reply becomes
[`TorError.controlProtocolError(code:message:)`](/documentation/Tor/TorError/controlProtocolError(code:message:)).

> Throws: ``doc://Tor/documentation/Tor/TorError/invalidServiceID(_:)`` for reply 552,
> ``doc://Tor/documentation/Tor/TorError/controlProtocolError(code:message:)`` for other
> failures.

> Note: Idempotent in the absence of the service — calling it
> twice back-to-back yields a 552 on the second call, which
> the caller may choose to ignore.