Skip to content
Start here

Update configuration properties

api_gateway.configurations.update(ConfigurationUpdateParams**kwargs) -> Configuration
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
zone_id: str

Identifier.

maxLength32
auth_id_characteristics: Iterable[AuthIDCharacteristic]
One of the following:
class AuthIDCharacteristicAPIShieldAuthIDCharacteristic:

Auth ID Characteristic

name: str

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

maxLength128
type: Literal["header", "cookie"]

The type of characteristic.

One of the following:
"header"
"cookie"
class AuthIDCharacteristicAPIShieldAuthIDCharacteristicJWTClaim:

Auth ID Characteristic extracted from JWT Token Claims

name: str

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: Literal["jwt"]

The type of characteristic.

normalize: Optional[bool]

Ensures that the configuration is written or retrieved in normalized fashion

ReturnsExpand Collapse
class Configuration:
auth_id_characteristics: List[AuthIDCharacteristic]
One of the following:
class AuthIDCharacteristicAPIShieldAuthIDCharacteristic:

Auth ID Characteristic

name: str

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

maxLength128
type: Literal["header", "cookie"]

The type of characteristic.

One of the following:
"header"
"cookie"
class AuthIDCharacteristicAPIShieldAuthIDCharacteristicJWTClaim:

Auth ID Characteristic extracted from JWT Token Claims

name: str

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: Literal["jwt"]

The type of characteristic.

Update configuration properties

import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN"),  # This is the default and can be omitted
)
configuration = client.api_gateway.configurations.update(
    zone_id="023e105f4ecef8ad9ca31a8372d0c353",
    auth_id_characteristics=[{
        "name": "authorization",
        "type": "header",
    }],
)
print(configuration.auth_id_characteristics)
{
  "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
}