Skip to content
Start here

Delete Prefix

client.Addressing.Prefixes.Delete(ctx, prefixID, body) (*PrefixDeleteResponse, error)
DELETE/accounts/{account_id}/addressing/prefixes/{prefix_id}

Delete an unapproved prefix owned by the account.

Security

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
Accepted Permissions (at least one required)
Magic Transit Write
ParametersExpand Collapse
prefixID string

Identifier of an IP Prefix.

maxLength32
body PrefixDeleteParams
AccountID param.Field[string]

Identifier of a Cloudflare account.

maxLength32
ReturnsExpand Collapse
type PrefixDeleteResponse struct{…}
Errors []PrefixDeleteResponseError
Code int64
minimum1000
Message string
DocumentationURL stringoptional
Source PrefixDeleteResponseErrorsSourceoptional
Pointer stringoptional
Messages []PrefixDeleteResponseMessage
Code int64
minimum1000
Message string
DocumentationURL stringoptional
Source PrefixDeleteResponseMessagesSourceoptional
Pointer stringoptional
Success PrefixDeleteResponseSuccess

Whether the API call was successful.

Delete Prefix

package main

import (
  "context"
  "fmt"

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

func main() {
  client := cloudflare.NewClient(
    option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
    option.WithAPIEmail("user@example.com"),
  )
  prefix, err := client.Addressing.Prefixes.Delete(
    context.TODO(),
    "2af39739cc4e3b5910c918468bb89828",
    addressing.PrefixDeleteParams{
      AccountID: cloudflare.F("258def64c72dae45f3e4c8516e2111f2"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", prefix.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
}