Skip to content
Start here

Get Cache Reserve setting

client.Cache.CacheReserve.Get(ctx, query) (*CacheReserveGetResponse, error)
GET/zones/{zone_id}/cache/cache_reserve

Increase cache lifetimes by automatically storing all cacheable files into Cloudflare's persistent object storage buckets. Requires Cache Reserve subscription. Note: using Tiered Cache with Cache Reserve is highly recommended to reduce Reserve operations costs. See the developer docs for more information.

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 Settings ReadZone ReadZone Write
ParametersExpand Collapse
query CacheReserveGetParams
ZoneID param.Field[string]

Identifier.

maxLength32
ReturnsExpand Collapse
type CacheReserveGetResponse struct{…}

The identifier of the caching setting.

Editable bool

Whether the setting is editable.

Value CacheReserveGetResponseValue

Value of the Cache Reserve zone setting.

One of the following:
const CacheReserveGetResponseValueOn CacheReserveGetResponseValue = "on"
const CacheReserveGetResponseValueOff CacheReserveGetResponseValue = "off"
ModifiedOn Timeoptional

Last time this setting was modified.

formatdate-time

Get Cache Reserve setting

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"),
  )
  cacheReserve, err := client.Cache.CacheReserve.Get(context.TODO(), cache.CacheReserveGetParams{
    ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", cacheReserve.ID)
}
{
  "errors": [],
  "messages": [],
  "result": {
    "editable": true,
    "id": "cache_reserve",
    "value": "off"
  },
  "success": true
}
{
  "errors": [
    {
      "code": 12345,
      "message": "Some error message"
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
Returns Examples
{
  "errors": [],
  "messages": [],
  "result": {
    "editable": true,
    "id": "cache_reserve",
    "value": "off"
  },
  "success": true
}
{
  "errors": [
    {
      "code": 12345,
      "message": "Some error message"
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}