Skip to content
Start here

Start Cache Reserve Clear

client.Cache.CacheReserve.Clear(ctx, params) (*CacheReserveClearResponse, error)
POST/zones/{zone_id}/cache/cache_reserve_clear

You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation.

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
Accepted Permissions (at least one required)
Zone Settings WriteZone Write
ParametersExpand Collapse
params CacheReserveClearParams
ZoneID param.Field[string]

Path param: Identifier.

maxLength32
Body param.Field[unknown]

Body param

ReturnsExpand Collapse
type CacheReserveClearResponse struct{…}

You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation.

ID of the zone setting.

StartTs Time

The time that the latest Cache Reserve Clear operation started.

formatdate-time
State State

The current state of the Cache Reserve Clear operation.

One of the following:
const StateInProgress State = "In-progress"
const StateCompleted State = "Completed"
EndTs Timeoptional

The time that the latest Cache Reserve Clear operation completed.

formatdate-time
ModifiedOn Timeoptional

Last time this setting was modified.

formatdate-time

Start Cache Reserve Clear

package main

import (
  "context"
  "fmt"

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

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  response, err := client.Cache.CacheReserve.Clear(context.TODO(), cache.CacheReserveClearParams{
    ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    Body: map[string]interface{}{
    },
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.ID)
}
{
  "errors": [],
  "messages": [],
  "result": {
    "id": "cache_reserve_clear",
    "start_ts": "2023-10-02T10:00:00.12345Z",
    "state": "In-progress"
  },
  "success": true
}
{
  "errors": [
    {
      "code": 1152,
      "message": "Turn off Cache Reserve sync to proceed with deletion."
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
Returns Examples
{
  "errors": [],
  "messages": [],
  "result": {
    "id": "cache_reserve_clear",
    "start_ts": "2023-10-02T10:00:00.12345Z",
    "state": "In-progress"
  },
  "success": true
}
{
  "errors": [
    {
      "code": 1152,
      "message": "Turn off Cache Reserve sync to proceed with deletion."
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}