INTEGRITY Cloudflare Docs

Customize cipher suites via API

Cipher suites are a combination of ciphers used to negotiate security settings during the SSL/TLS handshake (and therefore separate from the SSL/TLS protocol).

Prerequisites

Cipher suite customization requires an Advanced Certificate Manager subscription.

If you are a SaaS provider looking to restrict cipher suites for connections to custom hostnames, this can be configured with a Cloudflare for SaaS subscription. Refer to TLS management instead.

Before you begin

Note that:

Steps and API examples

  1. Decide which cipher suites you want to specify and which ones you want to disable (meaning they will not be included in your selection).

    Below you will find samples covering the recommended ciphers by security level and compliance standards, but you can also refer to the full list of supported ciphers and customize your choice.

  2. Log in to the Cloudflare dashboard and get your Global API Key in My Profile > API Tokens.

  3. Get the Zone ID from the Overview page of the domain you want to specify cipher suites for.

  4. Make an API call to either the Edit zone setting endpoint or the Edit TLS setting for hostname endpoint, specifying ciphers in the URL. List your array of chosen cipher suites in the value field.

Required API token permissions

At least one of the following token permissions is required:
  • Zone Settings Write
Edit zone setting
curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/settings/ciphers" \
	--request PATCH \
	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
	--json '{
		"value": [
				"ECDHE-ECDSA-AES128-GCM-SHA256",
				"ECDHE-ECDSA-CHACHA20-POLY1305",
				"ECDHE-RSA-AES128-GCM-SHA256",
				"ECDHE-RSA-CHACHA20-POLY1305",
				"ECDHE-ECDSA-AES256-GCM-SHA384",
				"ECDHE-RSA-AES256-GCM-SHA384"
		]
	}'

To configure cipher suites per hostname, replace the first two lines by the following:

curl --request PUT \
"https://api.cloudflare.com/client/v4/zones/{zone_id}/hostnames/settings/ciphers/{hostname}" \

Required API token permissions

At least one of the following token permissions is required:
  • Zone Settings Write
Edit zone setting
curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/settings/ciphers" \
	--request PATCH \
	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
	--json '{
		"value": [
				"ECDHE-ECDSA-AES128-GCM-SHA256",
				"ECDHE-ECDSA-CHACHA20-POLY1305",
				"ECDHE-RSA-AES128-GCM-SHA256",
				"ECDHE-RSA-CHACHA20-POLY1305",
				"ECDHE-ECDSA-AES256-GCM-SHA384",
				"ECDHE-RSA-AES256-GCM-SHA384",
				"ECDHE-ECDSA-AES128-SHA256",
				"ECDHE-RSA-AES128-SHA256",
				"ECDHE-ECDSA-AES256-SHA384",
				"ECDHE-RSA-AES256-SHA384"
		]
	}'

To configure cipher suites per hostname, replace the first two lines by the following:

curl --request PUT \
"https://api.cloudflare.com/client/v4/zones/{zone_id}/hostnames/settings/ciphers/{hostname}" \

Required API token permissions

At least one of the following token permissions is required:
  • Zone Settings Write
Edit zone setting
curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/settings/ciphers" \
	--request PATCH \
	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
	--json '{
		"value": [
				"ECDHE-ECDSA-AES128-GCM-SHA256",
				"ECDHE-RSA-AES128-GCM-SHA256",
				"ECDHE-ECDSA-AES256-GCM-SHA384",
				"ECDHE-RSA-AES256-GCM-SHA384",
				"ECDHE-ECDSA-CHACHA20-POLY1305",
				"ECDHE-RSA-CHACHA20-POLY1305"
		]
	}'

To configure cipher suites per hostname, replace the first two lines by the following:

curl --request PUT \
"https://api.cloudflare.com/client/v4/zones/{zone_id}/hostnames/settings/ciphers/{hostname}" \

Required API token permissions

At least one of the following token permissions is required:
  • Zone Settings Write
Edit zone setting
curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/settings/ciphers" \
	--request PATCH \
	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
	--json '{
		"value": [
				"AES128-GCM-SHA256",
				"AES128-SHA",
				"AES128-SHA256",
				"AES256-SHA",
				"AES256-SHA256",
				"DES-CBC3-SHA",
				"ECDHE-ECDSA-AES128-GCM-SHA256",
				"ECDHE-ECDSA-AES128-SHA",
				"ECDHE-ECDSA-AES128-SHA256",
				"ECDHE-ECDSA-AES256-GCM-SHA384",
				"ECDHE-ECDSA-AES256-SHA384",
				"ECDHE-RSA-AES128-GCM-SHA256",
				"ECDHE-RSA-AES128-SHA",
				"ECDHE-RSA-AES128-SHA256",
				"ECDHE-RSA-AES256-GCM-SHA384",
				"ECDHE-RSA-AES256-SHA",
				"ECDHE-RSA-AES256-SHA384"
		]
	}'

To configure cipher suites per hostname, replace the first two lines by the following:

curl --request PUT \
"https://api.cloudflare.com/client/v4/zones/{zone_id}/hostnames/settings/ciphers/{hostname}" \

Reset to default values

To reset to the default cipher suites at zone level, use the Edit zone setting endpoint, specifying ciphers as the setting name in the URL, and send an empty array in the value field.

Required API token permissions

At least one of the following token permissions is required:
  • Zone Settings Write
Edit zone setting
curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/settings/ciphers" \
	--request PATCH \
	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
	--json '{
		"value": []
	}'

For specific hostname settings, use the Delete TLS setting for hostname endpoint.

Required API token permissions

At least one of the following token permissions is required:
  • SSL and Certificates Write
Delete TLS setting for hostname
curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/hostnames/settings/ciphers/$HOSTNAME" \
	--request DELETE \
	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"

For guidance around custom hostnames, refer to TLS settings - Cloudflare for SaaS.