Skip to content

Turn a site's Cloudflare protection on or off

PUT /v1/sites/{siteId}/protection

Turns Cloudflare protection on (on: true) or off (on: false). Turning it on needs a live site with its SSL certificate, its server running, and a domain of your own as its primary domain (409 needs_domain); not for staging copies.

What happens next. The answer is 202 with status: "applying". Turning on: the site's domains are added to Cloudflare, which checks each one and makes its certificate while the site keeps answering as before; each domain then goes through Cloudflare once its DNS points at edge (see domains). An hour after a domain starts coming through Cloudflare, the server refuses visitors who skip Cloudflare on it. Turning off takes up to 15 minutes; domains still pointed at edge keep working (stillPointed). If it fails, status is failed with the reason in error: send the same again to retry. Asking for what's already in place answers 200 as it is.

Up to 30 changes a minute per account.

Scopes

The token needs this scope. Without it, the request is refused with insufficient_scope (see Scopes).

sites:write
Manage sites. Domains, SSL, CDN, cache, firewall, malware protection, resources, backups, staging, Media Offload, SMTP and RabbitPress Cache. Choosing Rabbitflare Backup for a site's backups, and turning on Media Offload or a site's malware protection, also need Turn on paid features: they start monthly charges.

Headers

FieldType and description
Idempotency-Key

string 1 to 255 characters

A key of your own for this request, like a UUID: letters, digits and _ - : . Send the request again with the same key (after a timeout, say) and it's done only once. Keys are kept for 24 hours (see Idempotency).

Path parameters

FieldType and description
siteId Required

string

The site's id.

Request body

JSON, with these fields. Fields that aren't listed are refused.

FieldType and description
on Required

boolean

true to turn Cloudflare protection on for the site, false to turn it off.

Example request

curl -X PUT "https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/protection" \
  -H "Authorization: Bearer $RABBITFLARE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "on": true
}'

Response

202 Accepted Returns the SiteProtection object in data. It can also answer 200 OK.

The SiteProtection object's fields 22 fields
FieldType and description
on

boolean

Whether Cloudflare protection is switched on for the site.

status

string

off, applying (being turned on or off: adding the site's domains to Cloudflare, or taking them out, which can take up to 15 minutes), active, or failed (see error; switch it on or off again to retry).

Known values: offapplyingactivefailed More can appear.

error

string or null

Why turning it on or off failed (with status: "failed"). Null otherwise.

edge

string or null

The site's own name at Cloudflare, like shop-x7k2p.rabbitflare.net: each domain goes through Cloudflare once its DNS points here. Null when the site can't be protected (contact support).

needs

string or null

What the site needs before protection can go on (a domain of your own as its primary domain). Null when nothing, and while it's on.

domains

array of objects

The site's own domains, while protection is on (its built-in address isn't listed). Empty while it's off.

domainId

string

The domain's id, as the site's list of domains gives it.

hostname

string

The domain, like www.example.com.

status

string

protected: its visitors come through Cloudflare. switching: Rabbitflare is switching its DNS (dnsBy isn't you); nothing to do. ready: its certificate is ready: set record at its DNS company now. preparing: Cloudflare is checking it and making its certificate (a few minutes); nothing to change yet. action: something comes first, detail says what (such as turning off your own Cloudflare proxy for it). redirects: a root domain that can't point at a name: its visitors are sent on to the primary domain; nothing to do. error: Cloudflare refused it, detail says why.

Known values: protectedswitchingreadypreparingactionredirectserror More can appear.

detail

string or null

What's happening with it, or why it waits or was refused, in a sentence. Null when it's protected.

record

object or null

The DNS record that sends the domain through Cloudflare. At Cloudflare, set it to DNS only (grey cloud), and remove other A, AAAA or CNAME records of the same name (keep MX and TXT records: they're for email). Null for a root domain whose DNS company can't point it at a name.

Show its 3 fields
FieldType and description
type

string

CNAME, or for a root domain the DNS company's ALIAS or ANAME record.

Known values: CNAMEALIASANAME More can appear.

name

string

The record's name: the domain itself.

value

string

What it points at: the site's name at Cloudflare (edge).

dnsBy

string

Who changes its DNS: rabbitflare (it was bought from Rabbitflare), your_cloudflare (its DNS is in a Cloudflare account you connected to Rabbitflare: Rabbitflare changes it there), or you (at its DNS company, as record says).

Known values: rabbitflareyour_cloudflareyou More can appear.

dnsCompany

object or null

The DNS company its nameservers belong to. Null when not known yet or not recognised, and for domains bought from Rabbitflare.

Show its 3 fields
FieldType and description
id

string

The company's id, like cloudflare, godaddy or namecheap.

name

string

The company's name, like Cloudflare, GoDaddy or Namecheap.

root

string

How a root domain (example.com, no www) can point at a name there: cname (a CNAME works), alias or aname (its own record type for it), none (it can't: make www the primary domain, and the root keeps its A record), or unknown.

Known values: cnamealiasanamenoneunknown More can appear.

locked

boolean

Whether the site's server already refuses visitors who skip Cloudflare on its protected domains (an hour after a domain starts coming through Cloudflare).

stillPointed

array of strings

While it's off: domains whose DNS still points at the site's name at Cloudflare. They keep working (that name now leads straight to the server); point them back at the server when you like.

connectFor

array of strings

While it's on: domains whose DNS is in a Cloudflare account that isn't connected to Rabbitflare. Connect that account in the panel and Rabbitflare switches them for you; otherwise set their record yourself.

Example response

202 Accepted
{
  "data": {
    "on": true,
    "status": "applying",
    "error": null,
    "edge": "shop-x7k2p.rabbitflare.net",
    "needs": null,
    "domains": [
      {
        "domainId": "c4d5e6f7-a8b9-4c0d-9e1f-2a3b4c5d6e7f",
        "hostname": "shop.example.com",
        "status": "preparing",
        "detail": "Cloudflare is checking it and making its certificate (a few minutes). Nothing to change yet.",
        "record": {
          "type": "CNAME",
          "name": "shop.example.com",
          "value": "shop-x7k2p.rabbitflare.net"
        },
        "dnsBy": "you",
        "dnsCompany": {
          "id": "godaddy",
          "name": "GoDaddy",
          "root": "none"
        }
      }
    ],
    "locked": false,
    "stillPointed": [],
    "connectFor": []
  }
}

Errors

The errors this request can answer besides those every request can (a missing token, a missing scope, the rate limits). Each answer is an Error object (see Errors).

Status and codeWhen, and what to do
403 feature_unavailable

This product isn't open to the account.

Contact support if you'd like it opened.

404 not_found

The resource doesn't exist, or isn't this account's.

Check the id. Ids of other accounts' resources answer the same way.

409 not_ready

Something this needs isn't ready yet (for example, the server has no IP address yet).

Wait a few minutes, then try again.

409 staging_copy

This site is a staging copy, which can't do this.

Do it on the live site. A staging copy is managed through its live site's staging operations.

409 site_unavailable

The site isn't in a state that allows this (for example, it's still installing).

Wait until the site is active, then try again.

409 server_unavailable

The server isn't in a state that allows this (for example, it's off or still being set up).

Start the server, or wait until it's active, then try again.

409 staging_busy

A staging operation is running on this site, or on a site of this server.

Wait until it finishes (activeRun in GET /sites/{siteId}/staging is null again), or cancel it, then try again.

409 server_restoring

The server is being restored, and nothing else can change it or its sites until that's done.

Wait until the restore finishes (the server's pendingAction is null again), then try again. A restore that stopped partway keeps pendingAction: "restore", with the server's lastError set, until our team has checked the server.

422 validation_failed

One or more fields are missing or wrong. fields names each one with what's wrong.

Correct the fields named in fields. Unknown fields are refused too.

Rate limit

Write requests: 30 a minute per token, 60 per account. More in Rate limits.

Added on .

Deprecated since November 28, 2026; it stops working on November 30, 2027. Cloudflare protection was removed from Rabbitflare on 28 November 2026: this operation answers `403 feature_unavailable` for every site, and goes in v2.

Popular

API docs