Skip to content
Start here

Update configuration properties

client.APIGateway.Configurations.Update(ctx, params) (*Configuration, error)
PUT/zones/{zone_id}/api_gateway/configuration

Updates API Shield configuration settings for a zone. Can modify validation strictness, enforcement mode, and other global settings.

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)
Account API GatewayDomain API Gateway
ParametersExpand Collapse
params ConfigurationUpdateParams
ZoneID param.Field[string]

Path param: Identifier.

maxLength32
Configuration param.Field[Configuration]

Body param

Normalize param.Field[bool]optional

Query param: Ensures that the configuration is written or retrieved in normalized fashion

ReturnsExpand Collapse
type Configuration struct{…}
AuthIDCharacteristics []ConfigurationAuthIDCharacteristic
One of the following:
type ConfigurationAuthIDCharacteristicsAPIShieldAuthIDCharacteristic struct{…}

Auth ID Characteristic

Name string

The name of the characteristic field, i.e., the header or cookie name.

maxLength128
Type ConfigurationAuthIDCharacteristicsAPIShieldAuthIDCharacteristicType

The type of characteristic.

One of the following:
const ConfigurationAuthIDCharacteristicsAPIShieldAuthIDCharacteristicTypeHeader ConfigurationAuthIDCharacteristicsAPIShieldAuthIDCharacteristicType = "header"
const ConfigurationAuthIDCharacteristicsAPIShieldAuthIDCharacteristicTypeCookie ConfigurationAuthIDCharacteristicsAPIShieldAuthIDCharacteristicType = "cookie"
type ConfigurationAuthIDCharacteristicsAPIShieldAuthIDCharacteristicJWTClaim struct{…}

Auth ID Characteristic extracted from JWT Token Claims

Name string

Claim location expressed as $(token_config_id):$(json_path), where token_config_id is the ID of the token configuration used in validating the JWT, and json_path is a RFC 9535 JSONPath (https://goessner.net/articles/JsonPath/, https://www.rfc-editor.org/rfc/rfc9535.html). The JSONPath expression may be in dot or bracket notation, may only specify literal keys or array indexes, and must return a singleton value, which will be interpreted as a string.

maxLength128
Type ConfigurationAuthIDCharacteristicsAPIShieldAuthIDCharacteristicJWTClaimType

The type of characteristic.

Update configuration properties

package main

import (
  "context"
  "fmt"

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

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  configuration, err := client.APIGateway.Configurations.Update(context.TODO(), api_gateway.ConfigurationUpdateParams{
    ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    Configuration: api_gateway.ConfigurationParam{
      AuthIDCharacteristics: cloudflare.F([]api_gateway.ConfigurationAuthIDCharacteristicsUnionParam{api_gateway.ConfigurationAuthIDCharacteristicsAPIShieldAuthIDCharacteristicParam{
        Name: cloudflare.F("authorization"),
        Type: cloudflare.F(api_gateway.ConfigurationAuthIDCharacteristicsAPIShieldAuthIDCharacteristicTypeHeader),
      }}),
    },
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", configuration.AuthIDCharacteristics)
}
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "auth_id_characteristics": [
      {
        "name": "authorization",
        "type": "header"
      }
    ]
  },
  "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"
      }
    }
  ],
  "result": {
    "auth_id_characteristics": [
      {
        "name": "authorization",
        "type": "header"
      }
    ]
  },
  "success": true
}