How to create a Cloudflare worker for Raptive

Please follow these steps to get your Cloudflare account ID and create an API token with permission to edit Cloudflare Workers. Since Cloudflare Workers work at the account level, not the domain level, you'll need to have access to the Workers Admin and DNS roles in Account Scoped Roles.

Please note, your Cloudflare account ID is NOT the email address associated with your Cloudflare account.

Set up your Cloudflare worker in three steps:

Retrieve your Account ID

Create API token with one of the following methods:

Add to your Raptive Dashboard

Do you have a Cloudflare Account?

Most Raptive sites already have a Cloudflare account, so please talk with your host, such as BigScoots or Rocket.net, and/or technical support service, like NerdPress, to help set this up if they manage Cloudflare for you.


Retrieving Your Account ID

  • Log in to Your Cloudflare Account
  • Find Your Cloudflare Account ID
    • There are two ways to find your Cloudflare account ID:
      • #1: Click on Workers & Pages, which can be found under the Compute (Workers) heading in the left sidebar of your Cloudflare dashboard
How-to-create-a-Cloudflare-worker-for-Raptive-02-13-2025_04_47_PM.png
  •  
    •  
      • Your Account ID is a long string of numbers and letters that should be visible in the Account Details section on the right sidebar once you’ve selected Workers & Pages
  •  
    • #2: If you're having trouble with the method above, here's another way to find your Account ID:
      • From your Cloudflare homepage, click on your domain
Cloudflare homepage.png
  •  
    •  
      • You should be taken to a page with your Account ID listed in the API section 
Cloudflare account ID.png
  • Either way, once you can see your Account ID, copy it and save it for later use. This is something you'll need to provide at the end of these instructions. You can ignore the Zone ID for now.

Creating an API token

There are two options you can choose from to create an API token:

  • Account-based API tokens
  • User-based API tokens

How to create an account-based API token

  • Go to Manage Account > Account API tokens from the left sidebar of Cloudflare's dashboard

  • Click the Create Token button 

  • From the list of API token templates, select the Use template button from the Edit Cloudflare Workers option.

  • Leave the Create Token section options as they are; there's no need to modify any.
  • For the Zone Resources section, make sure to set it to Include, Specific zone, and then select the zone (domain name) you want to apply these changes to, from the dropdown.
    • Example:

  • Leave the rest of the options as they are, and then click Continue to summary

  • Finally, click the Create Token button.
  • Copy the API token by clicking the Copy button. You'll need the API token in the last step to securely send us this value, and you won’t be able to view it again after this.

How to create a user-based API token

  • Go to the API Tokens page here (or from your homepage)
    • Click your profile icon or account name on the top right, and select My Profile from the dropdown

  •  
    • On the left sidebar, click API Tokens.
  • Create a Custom API Token:
    • On the API Tokens page, click Create Token.
  •  
    • In the list of API token templates, find the row for Edit Cloudflare Workers and select Use template.
  • Configure the API Token:
    • Create Token:
      • Click the Edit icon to change the token name if desired (we would recommend “Raptive API Token”)
Cloudflare Edit.png

 

  •  
    • Permissions: You can leave permission settings as-is
      • You can expect the list to look as follows: 
image - 2024-10-09T112709.729.png
  •  
    • Account Resources:
      • Select Include → The site owner's account
      • Only give us access to the site owner's account (if you see multiple accounts listed).
    • Zone Resources:
      • Select Include Specific zone Your domain. The Cloudflare worker that we set up will only work for the domain specified. 
        • If you have multiple sites that you would like to set up with the same API Token, you can select All zones from an account The site owner's Account instead
  •  
    • Client IP Address Filtering: You can leave this field empty.
    • TTL: You can leave this empty to ensure this token does not expire until you choose to manually remove it.
  • Click Continue to summary
  • Review the information and then select Create Token.
  • Copy the API token by clicking the Copy button. You'll need the API token in the last step to securely send us this value, and you won’t be able to view it again after this.

Sharing with Raptive

Save your Cloudflare Account ID and the newly created API token in your Raptive dashboard:

Cloudflare Credentials in dashboard.png
  • Log in to your Raptive account
  • Click on your profile picture
  • Select Account Settings
  • Click on Cloudflare Credentials on the left sidebar
  • Enter the Account ID and API Token in the fields
    • If you have multiple sites with Raptive, please input the Account ID and API token for each site. If you share a Cloudflare account for all your sites, the Account ID and API token may be the same for each site.
  • Click Save on the bottom right
  • Once saved, we'll attempt to verify the credentials you provided with Cloudflare.
  • If the submission is successful, you should see a confirmation message stating "Cloudflare Credentials Updated."
Screenshot 2025-02-13 at 11.34.59 AM.png
  • If there is a problem with the submission, you'll see an error message stating "Invalid Account ID/API token. Please refer to the instructions on how to find your Cloudflare Account ID/API token."
    • Note: Although only one field (either Account ID OR API Token) may be entered incorrectly, you'll still see the error message appear under both fields.
FAQ-Cloudflare-Workers-AT-Ad-Code-Raptive-Knowledge-02-13-2025_12_08_PM.png
  • If you receive this error message, we recommend trying the process above again to ensure the information has been entered correctly. If you continue to receive an error message with your submission attempts, please contact your Raptive support team for assistance. 

Once successfully submitted, Raptive will attempt to deploy a Cloudflare Worker within a 5-business-day window. If successful, you should see a Raptive worker listed in your Cloudflare's Workers and Pages Overview. If any issues arise, we will contact you. 

If you have any questions or concerns, please don't hesitate to contact your CPM, AM, or Raptive's Support team.

Was this article helpful?
16 out of 18 found this helpful
Have more questions? Send a message

Want to join Raptive? Apply here!