---
title: Delete Spend Policy
---

[Skip to content](#_top)

[API Reference](https://developers.cloudflare.com/api/go)

[Billing](https://developers.cloudflare.com/api/go/resources/billing)

[Spend Policies](https://developers.cloudflare.com/api/go/resources/billing/subresources/spend_policies)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# Delete Spend Policy

client.Billing.SpendPolicies.Delete(ctx, policyID, params) (\*[SpendPolicyDeleteResponse](<https://developers.cloudflare.com/api/go/resources/billing#(resource)%20billing.spend_policies%20%3E%20(model)%20SpendPolicyDeleteResponse%20%3E%20(schema)>), error)

DELETE/accounts/{account\_id}/billing/spend-policies/{policy\_id}

Soft-deletes the spend policy. The policy is disabled and no longer appears in list, get or audit responses. The `If-Match` header must equal the policy’s current `version`.

##### Security

<details>

<summary>API Token</summary>



The preferred authorization scheme for interacting with the Cloudflare API. <a href="https://developers.cloudflare.com/fundamentals/api/get-started/create-token/">Create a token</a>.

**Example:**<code>Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY</code>

</details>

<details>

<summary>API Email + API Key</summary>



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

**Example:**<code>X-Auth-Email: user@example.com</code>

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

**Example:**<code>X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194</code>

</details>

##### ParametersExpand Collapse

policyID string

The unique identifier of the spend policy.

formatuuid

[Link to this property](<#(resource)%20billing.spend_policies%20%3E%20(method)%20delete%20%3E%20(params)%20default%20%3E%20(param)%20policy_id%20%3E%20(schema)>)

<details>

<summary>

params SpendPolicyDeleteParams

</summary>

AccountID param.Field\[string]

Path param: Represents a Cloudflare resource identifier tag.

maxLength32

<a href="#(resource)%20billing.spend_policies%20%3E%20(method)%20delete%20%3E%20(params)%20default%20%3E%20(param)%20account_id">Link to this property</a>

IfMatch param.Field\[string]

Header param: The policy <code>version</code> the change is based on, as returned in <code>ETag</code>. Quoted (<code>"3"</code>) and bare (<code>3</code>) values are both accepted. Weak ETags (<code>W/"3"</code>) and <code>*</code> are not.

<a href="#(resource)%20billing.spend_policies%20%3E%20(method)%20delete%20%3E%20(params)%20default%20%3E%20(param)%20If-Match">Link to this property</a>

</details>

[Link to this property](<#(resource)%20billing.spend_policies%20%3E%20(method)%20delete%20%3E%20(params)%20default>)

##### ReturnsExpand Collapse

<details>

<summary>

type SpendPolicyDeleteResponse struct{…}

</summary>

ID string

The unique identifier of the spend policy.

formatuuid

<a href="#(resource)%20billing.spend_policies%20%3E%20(model)%20SpendPolicyDeleteResponse%20%3E%20(schema)%20%3E%20(property)%20id">Link to this property</a>

</details>

[Link to this property](<#(resource)%20billing.spend_policies%20%3E%20(model)%20SpendPolicyDeleteResponse%20%3E%20(schema)>)

### Delete Spend Policy

Go

HTTPTypeScriptPythonGoTerraform

```
package main

import (
  "context"
  "fmt"

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

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  spendPolicy, err := client.Billing.SpendPolicies.Delete(
    context.TODO(),
    "6f1c2b8e-3d4a-4f5b-9c6d-7e8f9a0b1c2d",
    billing.SpendPolicyDeleteParams{
      AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
      IfMatch: cloudflare.F(`"3"`),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", spendPolicy.ID)
}
```

200 example

```
{
  "errors": [
    {
      "message": "message",
      "code": 0
    }
  ],
  "messages": [
    {
      "message": "message",
      "code": 0
    }
  ],
  "result": {
    "id": "6f1c2b8e-3d4a-4f5b-9c6d-7e8f9a0b1c2d"
  },
  "success": true
}
```

##### Returns Examples

200 example

```
{
  "errors": [
    {
      "message": "message",
      "code": 0
    }
  ],
  "messages": [
    {
      "message": "message",
      "code": 0
    }
  ],
  "result": {
    "id": "6f1c2b8e-3d4a-4f5b-9c6d-7e8f9a0b1c2d"
  },
  "success": true
}
```