Skip to content
Start here

Delete a sending subdomain

client.EmailSending.Subdomains.Delete(ctx, subdomainID, body) (*SubdomainDeleteResponse, error)
DELETE/zones/{zone_id}/email/sending/subdomains/{subdomain_id}

Disables sending on a subdomain and removes its DNS records. If routing is still active on the subdomain, only sending is disabled.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
ParametersExpand Collapse
subdomainID string

Sending subdomain identifier.

maxLength32
body SubdomainDeleteParams
ZoneID param.Field[string]

Identifier.

maxLength32
ReturnsExpand Collapse
type SubdomainDeleteResponse struct{…}
Errors []SubdomainDeleteResponseError
Code int64
minimum1000
Message string
DocumentationURL stringOptional
Source SubdomainDeleteResponseErrorsSourceOptional
Pointer stringOptional
Messages []SubdomainDeleteResponseMessage
Code int64
minimum1000
Message string
DocumentationURL stringOptional
Source SubdomainDeleteResponseMessagesSourceOptional
Pointer stringOptional
Success SubdomainDeleteResponseSuccess

Whether the API call was successful.

Delete a sending subdomain

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/email_sending"
  "github.com/cloudflare/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  subdomain, err := client.EmailSending.Subdomains.Delete(
    context.TODO(),
    "aabbccdd11223344aabbccdd11223344",
    email_sending.SubdomainDeleteParams{
      ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", subdomain.Errors)
}
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true
}