Skip to content

Instantly share code, notes, and snippets.

@mfld-pub
Created June 19, 2020 04:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfld-pub/ac49dbc1101bed29c08c9e0938883885 to your computer and use it in GitHub Desktop.
Save mfld-pub/ac49dbc1101bed29c08c9e0938883885 to your computer and use it in GitHub Desktop.
#!/bin/bash
# This POC uses the API's "registrar" endpoint to change NS delegation of a Cloudflare registrar domain to NS outside of Cloudflare
# export account e-mail address and Global API key.
# Untested: New style APO token with appropriate perms may also work.
export CF_API_EMAIL=user@server.com
export CF_API_KEY=changeme
# replace "changeme" below with your actual account ID and "domain.com" with the domain to be changed
curl -X PUT "https://api.cloudflare.com/client/v4/accounts/"changeme"/registrar/domains/"domain.com" \
-H "X-Auth-Email: $CF_API_EMAIL" \
-H "X-Auth-Key: $CF_API_KEY" \
-H "Content-Type: application/json" \
--data '{"name_servers":["ns1.namecheap.com","ns2.namecheap.com"],"privacy":true,"locked":true,"auto_renew":true}'
# Result should be something like:
# {"result":{"message":"Domain updates complete!"},"success":true,"errors":[],"messages":[]}
# whois the domain to confirm
@mfld-pub
Copy link
Author

Verification:
cf_ns

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment