How to query the API to get a list of all hostnames that are in pending_validation status?

I’m using Postman to query the Clouflare API. Looking for some doc or an example showing how to get a list of all custom_hostnames where the status is “pending_validation”.

You can use zones/:zone_identifier/custom_hostnames call to get all pending hostname.

curl -X GET “
-H “X-Auth-Email: [email protected]
-H “X-Auth-Key: c2547eb745079dac9320b638f5e225cf483cc5cfdda41”
-H “Content-Type: application/json”

Response would be -

“success”: true,
“errors”: ,
“messages”: ,
“result”: [
“id”: “0d89c70d-ad9f-4843-b99f-6cc0252067e9”,
“hostname”: “”,
“ssl”: {
“status”: “pending_validation”,
“method”: “http”,
“type”: “dv”,
“cname_target”: “”,
“cname”: “

1 Like

Thanks for the reply. I tried this, but it doesn’t give me only pending hostnames. Rather, it gives all custom hostnames. For my case, i have over 6k custom hostnames and most are not active. So I’m trying to write a script to delete the pending or expired host names. So for that, I want to get the list of all pending hostnames without having to inspect the status of each.