Getting Started¶
Download¶
Cloudflare-utils is build for Windows, Mac and Linux and the latest release is available to download from GitHub. Download the tar/zip file for your operating system and then extract the executable.
Deprecated archive naming convention
The archive downloads previously had the version number in the name, for example cloudflare-utils_1.2.3_windows_amd64.zip. This has been deprecated and the new naming convention is just cloudflare-utils_windows_amd64.zip.
The old naming convention will be removed in v2.0.0.
There is also a GitHub Action available to install and run cloudflare-utils in your workflows read more: here.
Additional Installation Methods¶
- Docker
cyb3rjak3/cloudflare-utilsghcr.io/cyb3r-jak3/cloudflare-utils
- Chocolatey: cloudflare-utils
- Homebrew:
brew install cyb3r-jak3/cyberjake/cloudflare-utils
Authentication¶
OAuth 2.0¶
Starting with v1.7.0, you can add --oauth to your command to remove the need for an API token. You will need to have access to a browser for the oauth callback process.
This is the recommended way as you don't need to store any auth credentials and the token is revoked after it has been used. All 6 scopes will be always be requested.
Non-interactive runs will need to use either API Token or API Key to run.
API Token¶
The recommended method to authenticate in CI pipelines is with an API Token. Each command will list the API permissions needed for it to run.
You can use this link to create a token with all the necessary permissions.
To Use
cloudflare-utils --api-token <Token Here>
You can also pass your API Token via an environment variable of CLOUDFLARE_API_TOKEN
API Key¶
The legacy API Key method is also supported but is not recommended.
To Use
cloudflare-utils --api-token <API Token Here>
Pass your API email and key with environment variables of CLOUDFLARE_API_EMAIL and CLOUDFLARE_API_KEY
Global Flags¶
-
--account-idPass your account ID with the--account-idflag or with the environment variableCLOUDFLARE_ACCOUNT_ID -
--api-emailPass your API email with the--api-emailflag or with the environment variableCLOUDFLARE_API_EMAIL. This is only needed if you are using the legacy auth method. -
--api-keyPass your API key with the--api-keyflag or with the environment variableCLOUDFLARE_API_KEY. This is only needed if you are using the legacy auth method. -
--api-tokenPass your API token with the--api-tokenflag or with the environment variableCLOUDFLARE_API_TOKEN. This is the recommended method of authentication. -
--rate-limitPass the rate limit in milliseconds with the--rate-limitflag. This is useful if you are getting rate limited by Cloudflare or want to speed up the rate of requests. -
--zone-namePass your zone name with the--zone-nameflag or with the environment variableCLOUDFLARE_ZONE_NAME. This is useful if you are running a command that only requires a zone name. -
--zone-idPass your zone ID with the--zone-idflag or with the environment variableCLOUDFLARE_ZONE_ID. This is useful if you are running a command that only requires a zone ID. -
--extra-user-agentPass an extra user agent string to be added to the default user agent with the--extra-user-agentflag. This is useful if you want to identify requests made by cloudflare-utils in your Cloudflare logs. The final format of the user agent will becloudflare-utils/<version> (<extra-user-agent>) -
--oauthTriggers an oauth flow to get credentials rather than using API Token and will override any passed api credentials. Requires a browser on the same machine.