{"success":false,"errors":[{"code":10000,"message":"Authentication error"}]}
{"success":false,"errors":[{"code":10000,"message":"Authentication error"}]}
/intel is locked behind an Enterprise addon. You would have to have that added to your ENT contract for access.https://api.cloudflare.com/client/v4/accounts/<account id>/intel/domain?domain=cloudflare.com"

Account:Intel on itcurl --request GET --url https://api.cloudflare.com/client/v4/accounts/<account id>/intel/domain?domain=cloudflare.com --header 'Content-Type: application/json' --header 'Authorization: Bearer <api token>'import sys
import requests
def get_domain_intel(account_id, domain, auth_token):
url = f"https://api.cloudflare.com/client/v4/accounts/{account_id}/intel/domain?domain={domain}"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {auth_token}"
}
response = requests.get(url, headers=headers)
if response.ok:
return response.json()
else:
response.raise_for_status()
if __name__ == "__main__":
account_id = "xxxxxxxxxxxxxxxxx"
domain = sys.argv[1]
auth_token = "xxxxxxxxxxxxxxxxxxxxxxxx"
domain_intel = get_domain_intel(account_id, domain, auth_token)
print(domain_intel)chatgpt just helped me combine two different apis, first one is Cloudflare domain intel, the ipv4 addressed is grabbed from that then sent to ipinfo.io to retrieve asn info:
import sys
import requests
def get_domain_ip(account_id, domain, auth_token):
url = f"https://api.cloudflare.com/client/v4/accounts/{account_id}/intel/domain?domain={domain}"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {auth_token}"
}
response = requests.get(url, headers=headers)
if response.ok:
domain_intel = response.json()
ipv4_addresses = [r['value'] for r in domain_intel['result']['resolves_to_refs'] if r['id'].startswith('ipv4-addr')]
if ipv4_addresses:
return ipv4_addresses[0]
else:
return None
else:
response.raise_for_status()
def get_ip_asn(ip):
url = f"https://ipinfo.io/{ip}/org?token=43750u3gh3g"
response = requests.get(url)
if response.ok:
return response.text.strip()
else:
response.raise_for_status()
if __name__ == "__main__":
if len(sys.argv) != 4:
print("Usage: python3 combined_script.py <account_id> <auth_token> <domain>")
sys.exit(1)
account_id = sys.argv[1]
auth_token = sys.argv[2]
domain = sys.argv[3]
ip_address = get_domain_ip(account_id, domain, auth_token)
if ip_address:
asn = get_ip_asn(ip_address)
print(f"ASN for {ip_address}: {asn}")
else:
print(f"No IPV4 addresses found for {domain}")/intelhttps://api.cloudflare.com/client/v4/accounts/<account id>/intel/domain?domain=cloudflare.com"Account:Intelcurl --request GET --url https://api.cloudflare.com/client/v4/accounts/<account id>/intel/domain?domain=cloudflare.com --header 'Content-Type: application/json' --header 'Authorization: Bearer <api token>'import sys
import requests
def get_domain_intel(account_id, domain, auth_token):
url = f"https://api.cloudflare.com/client/v4/accounts/{account_id}/intel/domain?domain={domain}"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {auth_token}"
}
response = requests.get(url, headers=headers)
if response.ok:
return response.json()
else:
response.raise_for_status()
if __name__ == "__main__":
account_id = "xxxxxxxxxxxxxxxxx"
domain = sys.argv[1]
auth_token = "xxxxxxxxxxxxxxxxxxxxxxxx"
domain_intel = get_domain_intel(account_id, domain, auth_token)
print(domain_intel)chatgpt just helped me combine two different apis, first one is Cloudflare domain intel, the ipv4 addressed is grabbed from that then sent to ipinfo.io to retrieve asn info:
import sys
import requests
def get_domain_ip(account_id, domain, auth_token):
url = f"https://api.cloudflare.com/client/v4/accounts/{account_id}/intel/domain?domain={domain}"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {auth_token}"
}
response = requests.get(url, headers=headers)
if response.ok:
domain_intel = response.json()
ipv4_addresses = [r['value'] for r in domain_intel['result']['resolves_to_refs'] if r['id'].startswith('ipv4-addr')]
if ipv4_addresses:
return ipv4_addresses[0]
else:
return None
else:
response.raise_for_status()
def get_ip_asn(ip):
url = f"https://ipinfo.io/{ip}/org?token=43750u3gh3g"
response = requests.get(url)
if response.ok:
return response.text.strip()
else:
response.raise_for_status()
if __name__ == "__main__":
if len(sys.argv) != 4:
print("Usage: python3 combined_script.py <account_id> <auth_token> <domain>")
sys.exit(1)
account_id = sys.argv[1]
auth_token = sys.argv[2]
domain = sys.argv[3]
ip_address = get_domain_ip(account_id, domain, auth_token)
if ip_address:
asn = get_ip_asn(ip_address)
print(f"ASN for {ip_address}: {asn}")
else:
print(f"No IPV4 addresses found for {domain}")