- List zones and read or edit DNS records
- Read traffic and security-event analytics from the GraphQL Analytics API
- Change zone settings and purge cache
- Operate Workers scripts, R2 buckets, and KV namespaces
- Read and edit web application firewall (WAF) custom rules, IP access rules, and bot configuration
- Report on account members, Zero Trust Access apps, and audit logs
This is a connector for apps you build with Lovable. It integrates your app with your Cloudflare
account. It does not deploy, host, or publish your Lovable app on Cloudflare Pages or Workers. To
publish a Lovable app, use Lovable’s own publish flow.
Common use cases and example apps
These examples show what you can build with Cloudflare API, each with a prompt to start from.
What your app can reach depends on the permissions and resource scope of the API token you connect with.
How to connect Cloudflare API
Who can create Cloudflare API connections depends on your plan and workspace settings. App + chat connectors are available by default on Free, Pro, and Business plans. On Enterprise plans, they are effectively disabled at first: Who can create connections and clients defaults to No one until an admin changes it in Connectors → Admin settings → App + chat connectors. You can create multiple Cloudflare API connections using different API tokens, which is useful for separating environments or scoping each connection to a different set of zones. When the connection is created, you can link it to the projects where you want to use it. Anyone building in a project can ask Lovable in chat to link their project to it.Prerequisites
Before connecting Cloudflare API, make sure you have:- A Cloudflare account with the zones or resources you want your app to use
- A Cloudflare API token whose permissions match the endpoints your app calls
- Super Administrator permission in Cloudflare if you need to create or update an account API token
- Permission to create connections in your Lovable workspace (see Who can create connections and clients)
API requests made through this connector count toward Cloudflare’s rate limits, and any paid
Cloudflare resources your app uses or creates, such as R2 storage, KV, or Workers usage, are
billed to your Cloudflare account. Cloudflare handles its own quotas and billing. Gateway requests
from your app also have a per-project usage limit.
Step 1: Create a Cloudflare API token
An API token authenticates your Lovable app with the Cloudflare v4 API. Cloudflare offers two kinds, and both work with this connector:- Account API tokens are owned by the account rather than a person, so they keep working when someone leaves the team. Cloudflare recommends them for integrations like this one, and they are the better default.
- User API tokens are tied to your Cloudflare user. Cloudflare currently lists six products that do not support account-owned tokens and need a user token: Intel Data Platform, Page Rules, Registrar, Super Bot Fight Mode, Turnstile, and Zero Trust Client Platform. Check the compatibility matrix for the latest list.
1
Open the Cloudflare dashboard
Sign in to the Cloudflare dashboard.
2
Open the token editor
For an account token, open Manage Account in the left navigation and select Account API Tokens.For a user token, open My Profile and select API Tokens.
3
Create the token
Click Create Token. Start from a template that matches what you are building, or choose Create Custom Token to pick permissions yourself.
4
Select permissions
Add one permission per feature your app needs. For example, a DNS management tool needs Zone Read and DNS Edit, and a traffic dashboard needs Analytics Read. See the Troubleshooting section for the full mapping.
5
Set the resource scope
Under Zone Resources and Account Resources, limit the token to the specific zones and accounts your app needs. You can also restrict client IP addresses and set an expiration date.
6
Copy the token
Click Continue to summary, then Create Token, and copy the value. Cloudflare shows it only once.
Cloudflare’s API, permissions, and token compatibility can change, so this guide may become
outdated. For the most accurate and current Cloudflare requirements, refer to Cloudflare’s
official account API token
documentation
and API token creation
guide.
Step 2: Connect Cloudflare API to Lovable
With the token copied, create the connection in Lovable.1
Open Cloudflare API in Connectors
Open Connectors and select Cloudflare API. For the other places to open the catalog from, see Where to find connectors.
2
Add a connection
Click Add connection.
3
Configure the connection
- Display name: name the connection, for example
Cloudflare Prod. This name is only used inside Lovable to identify the connection. - API Token: paste the API token you created in step 1. This connector does not accept a Global API Key.
4
Choose who can use this connection
Under Who can use this connection, decide who in your workspace can use the connection. You start as the only person with access:
- Only you (default): leave the access list as is; only you can use the connection and its associated data.
- Invite specific people: add workspace members by email; only you and the people you add can use the connection and its associated data.
- Invite entire workspace: click Invite entire workspace to make the connection available to everyone in your Lovable workspace.
5
Connect
Click Connect. Lovable verifies the token against the Cloudflare API before saving the connection.
Limitations
The Cloudflare API connector cannot:- Support per-end-user Cloudflare login. Each connection represents a single API token shared across all projects linked to it.
- Receive Cloudflare webhooks, notifications, or Logpush streams.
Troubleshooting
Use these checks when a Cloudflare request fails or returns an unexpected status.Cloudflare returned 403 Forbidden
Cloudflare returned 403 Forbidden
Check whether the token has the permission for that endpoint and covers the zone or account you requested. Saving a connection verifies the token but does not prove it can access every endpoint your app needs. Retrying will not fix missing permissions.Open the token in the Cloudflare dashboard and check it against the feature you are building:
Cloudflare’s bot plans distinguish Bot Fight Mode on Free, Super Bot Fight Mode on Pro, Business, and Enterprise without the Bot Management add-on, and Bot Management for Enterprise with the add-on. Super Bot Fight Mode does not support account API tokens, so adding a Bot Management permission to an account token will not enable access to that product. Use a user API token.These are dashboard permission labels. API permission names may use Write for Edit. See Cloudflare’s API token permissions. Add the missing permission, or widen the token’s zone or account resources. Tokens can also restrict client IP addresses and expire on a set date, so check those too.Check the endpoint’s authentication requirements and account-token compatibility. If it requires a user token, create one from My Profile → API Tokens. Whenever you replace a token, update the connection with the new value.
A request returned 429 Too Many Requests
A request returned 429 Too Many Requests
Cloudflare’s default client API limit is 1,200 requests per five minutes per user or account token. For user-based access, the limit is shared across the Cloudflare dashboard, API tokens, and legacy Global API Key requests made outside this connector. The GraphQL Analytics API has its own separate limits. Frequent polling with a user token can exhaust the shared limit and block your dashboard sessions.Lovable’s connector gateway also enforces a separate per-project usage limit on requests from your app and can return a 429 before the request reaches Cloudflare.Ask Lovable to respect the response’s
Retry-After header, cache zone lists, DNS records, and analytics results, and read on demand rather than on a frequent fixed timer.A WAF rule change removed the other rules
A WAF rule change removed the other rules
Updating a ruleset with
PUT, whether to a ruleset ID or to a phase entrypoint, replaces the entire rules array. Ask Lovable to read the ruleset first and write back the complete list, or to update a single rule with PATCH on /zones/{zone_id}/rulesets/{ruleset_id}/rules/{rule_id}.Manage your connection
Connections are managed from Connectors: select , then open the connection.- Unlink projects to remove access from specific projects while keeping the connection available for others. See Unlink projects from a connection for the steps.
- Delete the connection to remove it from the workspace entirely. Deleting is permanent. It removes the credentials from all linked projects, and app features that use stop working until a new connection is added. See Delete a connection for the steps and who can delete.