Custom_hostnames API error and poor documentation

I’m trying to add custom hostnames using the API, but cannot with the “ssl” property. It kind of works when not passing in the “ssl” property (but on the dashboard it shows as “SSL not requested”).

This is my request body:

{
    "hostname": "example.com",
    "ssl": {
        "bundle_method": "ubiquitous",
        "method": "txt",
        "settings": {
            "ciphers": ["ECDHE-RSA-AES128-GCM-SHA256", "AES128-SHA"],
            "early_hints": "on",
            "http2": "on",
            "min_tls_version": "1.2",
            "tls_1_3": "on"
        },
        "wildcard": false
    }
}

The error I get: “The SSL attribute is invalid. Please refer to the API documentation, check your input and try again.”

Looking at the documentation I have no clue whats going on (am I just missing something). Also, the “hostname” field is not mentioned at all on the docs…

1 Like

I was able to get this working using the older documentation: Cloudflare API v4 Documentation

3 Likes

@user4389 are you able to post the request body that you were able to get working? Still unable to get this functioning and the response body and missing docs are fairly cryptic. Cheers!

{
    "hostname": "",
    "ssl": {
        "method": "txt",
        "type": "dv",
        "settings": {
            "http2": "on",
            "min_tls_version": "1.2",
            "tls_1_3": "on",
            "ciphers": [
                "ECDHE-RSA-AES128-GCM-SHA256",
                "AES128-SHA"
            ],
            "early_hints": "on"
        },
        "bundle_method": "ubiquitous",
        "wildcard": false
    }
}

And don’t forget the X-Auth-Email header (your email address that you signed up to Cloudflare with) and the X-Auth-Key header (your global API key)

1 Like

Unreal, thank you so much! type: 'dv' was what I was missing, cheers!

1 Like

Thanks @user4389, the docs do seem to be missing many details.