Saas api for create custom hostnames

Hi Guys,

I am implementing our own saas api to add custom domain for our customers domains with txt validation.
Currently we could do following steps in cloudflare web pages:

1, add a custom domain here:
https://dash.cloudflare.com/328d9bb0d2e33d8b10759248cab4eadf/pg360.xyz/ssl-tls/custom-hostnames

2, after the submission, we get a txt value from cloudflare and we ask our client to add this txt value in their dns records, and it will be validated after some seconds.

In order to do this via api, we found this:

and we tried following request

## Create Custom Hostnames
curl -X "POST" "https://api.cloudflare.com/client/v4/zones/xxxxx/custom_hostnames" \
     -H 'X-Auth-Key: xxx' \
     -H 'X-Auth-Email: [email protected]' \
     -H 'Authorization: Bearer xxx' \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "ssl": {
    "bundle_method": "ubiquitous",
    "wildcard": false,
    "method": "txt",
    "certificate_authority": "google",
    "type": "dv"
  },
  "custom_metadata": {
    "key": "value"
  },
  "hostname": "xxx.xxx.com"
}'

and cloudflare server always respond with:

{
  "result": {
    "ssl": null
  },
  "success": false,
  "errors": [
    {
      "code": 1459,
      "message": "Certificate Authority selection is only available on an Enterprise plan.  If you're interested in the Enterprise plan,  please fill out this form and someone from our sales team will contact you: https://www.cloudflare.com/plans/enterprise/contact/"
    }
  ],
  "messages": []
}

it seemed our post body is wrongly construced, can anyone advise a correct sample body for txt validation?

Hi @mark123456 Have you tried removing this part from the API call

since this is not possible on a non-ENT plan, as the error message mentions?

1 Like

thx @jochen,
its working now…

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.