Skip to content
Start here

Edit TLS setting for hostname

client.Hostnames.Settings.TLS.Update(ctx, settingID, hostname, params) (*Setting, error)
PUT/zones/{zone_id}/hostnames/settings/{setting_id}/{hostname}

Update the tls setting value for the hostname.

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)
SSL and Certificates Write
ParametersExpand Collapse

The TLS Setting name. The value type depends on the setting:

  • ciphers: value is an array of cipher suite strings (e.g., ["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"])
  • min_tls_version: value is a TLS version string ("1.0", "1.1", "1.2", or "1.3")
  • http2: value is "on" or "off"
One of the following:
const SettingTLSUpdateParamsSettingIDCiphers SettingTLSUpdateParamsSettingID = "ciphers"
const SettingTLSUpdateParamsSettingIDMinTLSVersion SettingTLSUpdateParamsSettingID = "min_tls_version"
const SettingTLSUpdateParamsSettingIDHTTP2 SettingTLSUpdateParamsSettingID = "http2"
hostname string

The hostname for which the tls settings are set.

params SettingTLSUpdateParams
ZoneID param.Field[string]

Path param: Identifier.

maxLength32
Value param.Field[SettingValueUnion]

Body param: The TLS setting value. The type depends on the setting_id used in the request path:

  • ciphers: an array of allowed cipher suite strings in BoringSSL format (e.g., ["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"])
  • min_tls_version: a string indicating the minimum TLS version — one of "1.0", "1.1", "1.2", or "1.3" (e.g., "1.2")
  • http2: a string indicating whether HTTP/2 is enabled — "on" or "off" (e.g., "on")
ReturnsExpand Collapse
type Setting struct{…}
CreatedAt Timeoptional

This is the time the tls setting was originally created for this hostname.

formatdate-time
Hostname stringoptional

The hostname for which the tls settings are set.

Status stringoptional

Deployment status for the given tls setting.

UpdatedAt Timeoptional

This is the time the tls setting was updated.

formatdate-time
Value SettingValueUnionoptional

The TLS setting value. The type depends on the setting_id used in the request path:

  • ciphers: an array of allowed cipher suite strings in BoringSSL format (e.g., ["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"])
  • min_tls_version: a string indicating the minimum TLS version — one of "1.0", "1.1", "1.2", or "1.3" (e.g., "1.2")
  • http2: a string indicating whether HTTP/2 is enabled — "on" or "off" (e.g., "on")
One of the following:
type SettingValueString string
One of the following:
const SettingValueString1_0 SettingValueString = "1.0"
const SettingValueString1_1 SettingValueString = "1.1"
const SettingValueString1_2 SettingValueString = "1.2"
const SettingValueString1_3 SettingValueString = "1.3"
const SettingValueStringOn SettingValueString = "on"
const SettingValueStringOff SettingValueString = "off"
type SettingValueArray []string

Used when setting_id is ciphers. An array of allowed cipher suite strings.

Edit TLS setting for hostname

package main

import (
  "context"
  "fmt"

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

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  setting, err := client.Hostnames.Settings.TLS.Update(
    context.TODO(),
    hostnames.SettingTLSUpdateParamsSettingIDCiphers,
    "app.example.com",
    hostnames.SettingTLSUpdateParams{
      ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
      Value: cloudflare.F[hostnames.SettingValueUnionParam](hostnames.SettingValueString(hostnames.SettingValueString1_0)),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", setting.CreatedAt)
}
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "created_at": "2023-07-10T20:01:50.219171Z",
    "hostname": "app.example.com",
    "status": "pending_deployment",
    "updated_at": "2023-07-10T20:01:50.219171Z",
    "value": "1.0"
  }
}
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"
      }
    }
  ],
  "success": true,
  "result": {
    "created_at": "2023-07-10T20:01:50.219171Z",
    "hostname": "app.example.com",
    "status": "pending_deployment",
    "updated_at": "2023-07-10T20:01:50.219171Z",
    "value": "1.0"
  }
}