Skip to content

Configure payload logging via API

Configure an account default to capture supported payloads across your account. Add a zone override only when a zone needs a different key.

Before you begin, generate a key pair. The API requires a base64-encoded X25519 public key that decodes to 32 bytes.

Configure the account default

The account key applies to supported rule matches for every zone without an override.

Set the payload logging keybash
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/firewall/payload_logging/key" \
	--request PUT \
	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
	--json '{
		"public_key": "Ycig/Zr/pZmklmFUN99nr+taURlYItL91g+NcHGYpB8="
	}'

Configure a zone override

The zone key applies to supported rule matches in that zone. It takes precedence over the account default.

Set the payload logging keybash
curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/firewall/payload_logging/key" \
	--request PUT \
	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
	--json '{
		"public_key": "Ycig/Zr/pZmklmFUN99nr+taURlYItL91g+NcHGYpB8="
	}'

Delete an account default or zone override

Use the corresponding DELETE operation to remove a key. When you delete a zone override, the zone uses the account default, if configured.

Delete the payload logging keybash
curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/firewall/payload_logging/key" \
	--request DELETE \
	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
Delete the payload logging keybash
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/firewall/payload_logging/key" \
	--request DELETE \
	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"

Deleting an account or zone key does not delete legacy managed ruleset keys.

Was this helpful?