Skip to main content

Managing BigScoots Cache with the WordPress REST API

Clear the cache, check that caching works, change settings, and turn BigScoots Cache on or off from your own scripts, apps, or tools like Postman.

Written by Saumya Majumder

This page is intended for developers. It shows how to control BigScoots Cache from outside the WordPress dashboard: from a script, a deployment pipeline, another app, or a tool like Postman.

With the BigScoots Cache REST API you can:

  • Clear the cache (whole site, page cache only, specific posts, specific URLs, or specific logged-in users)

  • Clear OPcache

  • Enable or disable the cache, and turn on cache for logged-in users

  • Check the plugin status and test whether page caching works

  • Save plugin settings and import a settings file

  • Clear the plugin log

All endpoints live under https://example.com/wp-json/bigscoots-cache/v2/. Replace example.com with your own domain.


Who can use the API

Every request must be authenticated as a WordPress user. Requests without valid credentials are rejected.

  • Administrators can use every endpoint.

  • Other user roles can use the cache endpoints (clear cache, clear OPcache, enable/disable cache, status, test cache) if an admin has allowed that role. To do that, open the BigScoots Cache settings page, click Show Plugin Settings, then go to Advanced → Permission Settings → Select user roles allowed to purge the cache.

  • Every other endpoint is for administrators only. The table under API Endpoints shows which is which.

Step 1: Generate an Application Password

WordPress Application Passwords let you authenticate API requests without using your normal login password. If you prefer to watch, the video at the end of this article shows every step.

1. Log in to your WordPress dashboard and go to Users → Profile.

2. Scroll down to the Application Passwords section, enter a name you will recognize later (for example, BigScoots Cache API), and click Add New Application Password.

3. Copy the new password right away and save it somewhere safe. WordPress shows it only once. You won't be able to see it again after you leave the page.

The password contains spaces (for example, abcd EFGH 1234 ijkl MNOP 5678). The spaces are part of the password. Copy it exactly as shown.

You now have the two things every request needs:

  • Your WordPress username (shown at the top of the Profile page)

  • The Application Password you just generated

Note: WordPress only allows Application Passwords over HTTPS. If you don't see the Application Passwords section, check that your site loads over https://, and that a security plugin hasn't turned the feature off.

Treat an Application Password like any other password. If one is lost or no longer needed, revoke it from the same Application Passwords section.

Step 2: Make an authenticated request

The API uses HTTP Basic authentication: your username and Application Password, joined by a colon and Base64-encoded, sent in the Authorization header.

With cURL, the -u option builds the header for you:

curl -X PATCH "https://example.com/wp-json/bigscoots-cache/v2/clear-cache" \
-u "your-username:abcd EFGH 1234 ijkl MNOP 5678" \
-H "Content-Type: application/json" \
-d '{"purge_type": "all"}'

With Postman, open the Authorization tab, choose Basic Auth, and enter your username and Application Password. Postman then adds the header for you. You can see it on the Headers tab.

From your own code, send the header directly:

Authorization: Basic <base64 of "your-username:your application password">

You can copy the ready-made value from Postman's Headers tab (the whole value, including the word `Basic` and the space after it).

Requests that send a JSON body must also send Content-Type: application/json.

API Endpoints

What it does

Endpoint

Method

Who can use it

/clear-cache

PATCH

Admins and allowed roles

/clear-opcache

DELETE

Admins and allowed roles

/enable-cache

PATCH

Admins and allowed roles

/disable-cache

PATCH

Admins and allowed roles

/status

GET

Admins and allowed roles

/test-cache

GET

Admins and allowed roles

/user-cache

PATCH

Admins only

/save-settings

POST

Admins only

/import-config

POST

Admins only

/clear-logs

DELETE

Admins only

Every endpoint is under /wp-json/bigscoots-cache/v2/, so the full URL for clearing the cache is https://example.com/wp-json/bigscoots-cache/v2/clear-cache.

Each endpoint accepts only the method listed. Any other method returns a 405 error.

Clear Cache

API Endpoint: /wp-json/bigscoots-cache/v2/clear-cache

Request Type: PATCH

The purge_type field in the request body decides what gets cleared. Cache clearing is not available on staging sites (they are never cached), or while the cache is disabled.

A successful request returns:

{
"success": true,
"status": "success",
"message": "Your request to clear cache has been submitted! Please allow up to 30 seconds for this to take effect."
}

Clear everything (pages and static files)

Clears the whole site from the cache, including static files like images, CSS, and JavaScript.

{
"purge_type": "all"
}

Clear the page cache only

Clears every cached page (HTML) but leaves static files like images, CSS, and JavaScript in the cache. Use this when your pages changed, but your static files did not.

{
"purge_type": "page_cache"
}

This needs page cache to be turned on. The success message for this purge type says "clear the page cache" instead of "clear cache".

Clear specific posts

Clears the cache for the posts, pages, or custom post type entries you list.

{
"purge_type": "post_ids",
"post_ids": [1, 17]
}

post_ids must be an array of numbers ([1, 17]), not strings (["1", "17"]).

Some post types, such as block theme templates, affect every page on the site. Clearing one of those clears the whole page cache.

To also clear the pages where those posts appear, such as the home page, archives, category and tag pages, add purge_related_urls:

{
"purge_type": "post_ids",
"post_ids": [1, 17],
"purge_related_urls": true
}

If some of the IDs can't be cleared, the rest are still cleared and the response lists the skipped IDs under post_ids_with_error:

{
"success": true,
"status": "success",
"message": "Your request to clear cache has been submitted! Please allow up to 30 seconds for this to take effect.",
"post_ids_with_error": {
"post_doesnt_exists": [99999]
}
}

Key

Meaning

post_doesnt_exists

No post exists with this ID.

post_part_of_ignored_post_type

The post belongs to a post type that BigScoots Cache is set to ignore.

post_status_is_not_publish_or_private

The post is not published or private (for example, a draft).

no_permalink_found

WordPress returned no URL for this post.

If none of the IDs can be cleared, the request fails with the error code no_post_id_eligible_for_cache_purge.

This needs page cache to be turned on.

Clear specific URLs

{
"purge_type": "urls",
"urls": [
"https://example.com/some-page/",
"https://example.com/some-post/",
"/blog/another-post/"
]
}

You can pass full URLs or paths that start with /. Paths are resolved against your site's home URL.

By default, each URL is cleared together with everything under it. The query string is ignored. For example:

  • https://example.com/blog/ clears /blog/ and every URL that starts with /blog/, such as /blog/my-post/ and /blog/page/2/.

  • https://example.com/shop/?color=red clears /shop/ and everything under it.

  • Your home page URL (https://example.com/) clears only the home page, not the whole site.

To clear only the exact URL you pass, including its query string, add exact_url_purge:

{
"purge_type": "urls",
"urls": ["https://example.com/shop/?color=red"],
"exact_url_purge": true
}

exact_url_purge works only with "purge_type": "urls". Sending it with any other purge type returns an error.

Invalid URLs are skipped. If none of the URLs are valid, the request fails with the error code invalid_urls.

Clear the cache for specific logged-in users

Available only on the Boost plan, with cache for logged-in users turned on. Clears the cached pages of the users you list.

{
"purge_type": "user_ids",
"user_ids": [10302, 10254, 32012, 45021]
}

user_ids must be an array of numbers, not strings.

Clear OPcache

API Endpoint: /wp-json/bigscoots-cache/v2/clear-opcache

Request Type: DELETE

Request Body: not needed

On success, you will get a response like this:

{
"success": true,
"status": "success",
"message": "OPcache for your website has been cleared successfully!"
}

If OPcache can't be cleared (for example, the OPcache extension is not loaded on the server), the request fails with the error code opcache_purge_failed and HTTP status 424.

Enable Cache

API Endpoint: /wp-json/bigscoots-cache/v2/enable-cache

Request Type: PATCH

Request Body: not needed

On success, you will get a response like this:

{
"success": true,
"status": "success",
"message": "BigScoots Cache has been enabled successfully on your website."
}

Disable Cache

API Endpoint: /wp-json/bigscoots-cache/v2/disable-cache

Request Type: PATCH

Request Body: not needed

This turns off the whole cache, pages and static files, and clears the cache for the whole site. To stop caching pages but keep caching static files, use Save Settings with page_cache_enabled set to 0 instead.

On success, you will get a response like this:

{
"success": true,
"status": "success",
"message": "BigScoots Cache has been disabled successfully on your website."
}

Plugin Status

API Endpoint: /wp-json/bigscoots-cache/v2/status

Request Type: GET

Request Body: not needed

Returns an overview of how BigScoots Cache is set up and working on your site. Example response:

{
"success": true,
"status": "success",
"message": "Plugin status check request has been processed successfully.",
"data": {
"website_environment_type": { "label": "Website Environment Type", "value": "Production" },
"plugin_cache_status": { "label": "Plugin Cache Status", "value": "Enabled" },
"plugin_version": { "label": "Plugin Version", "value": "x.y.z" },
"plugin_setup_mode": { "label": "Plugin Setup Mode", "value": "Boost" },
"website_using_cloudflare": { "label": "Website Using Cloudflare", "value": "Yes" },
"cloudflare_setup_mode": { "label": "Cloudflare Setup Mode", "value": "Standard" },
"cache_rule_status": { "label": "Cache Rule Status", "value": "Working" },
"cache_by_user_status": { "label": "Cache by User Status", "value": "Disabled" },
"home_page_cache_status": { "label": "Home Page Cache Status", "value": "HIT" }
}
}

Field

What it tells you

website_environment_type`

Whether the site is production or staging.

plugin_cache_status

Enabled, Disabled, Page Cache Disabled, or Disabled for Staging.

plugin_version

The installed BigScoots Cache version.

plugin_setup_mode

The plan the plugin is set up for (Standard or Boost).

website_using_cloudflare

Whether the site is served through Cloudflare.

cloudflare_setup_mode

Standard or O2O.

cache_rule_status

Whether the cache rules at Cloudflare are working.

cache_by_user_status

Whether cache for logged-in users is enabled, disabled, or not supported.

home_page_cache_status

The cache status of the home page (for example HIT, MISS, or Bypassed from Cache).

On staging sites, the checks that need a live request show Not Checked.

Test Page Cache

API Endpoint: /wp-json/bigscoots-cache/v2/test-cache

Request Type: GET

Request Body: not needed

Tests whether your home page is being served from the cache. This is the same test as the Test Cache button in the plugin settings.

When page caching works, you will get:

{
"success": true,
"status": "success",
"message": "Page caching is working properly.",
"home_page_url": "https://example.com/"
}

When the test fails, the response has the error code page_cache_not_working_properly and a message explaining what went wrong. This failure is returned with HTTP status 200, so check the response body (success: true or the code field), not only the status code.

If page cache is turned off, the request fails with the error code page_cache_disabled. The test is not available on staging sites.

Enable Cache for Logged-in Users

API Endpoint: /wp-json/bigscoots-cache/v2/user-cache

Request Type: PATCH

Request Body: not needed

Admins only. Turns on cache for logged-in users, then clears the page cache so pages are cached under the new rules. This is the same action as the Turn on logged-in caching button in the dashboard notice.

It works only when all of these are true:

  • The site is on the Boost plan

  • The site is a production site, not staging

  • The cache and page cache are both turned on

On success, you will get a response like this:

{
"success": true,
"status": "success",
"message": "Logged-in user cache has been enabled on your website."
}

If the site doesn't meet the conditions above, the request fails with the error code logged_in_user_cache_not_available. If our systems can't apply the change, it fails with logged_in_user_cache_error (HTTP status 500). In that case, please contact our support team.

This endpoint only turns the feature on. To turn it off, use Save Settings with `cache_logged_in_users` set to `0`.

Save Settings

API Endpoint: /wp-json/bigscoots-cache/v2/save-settings

Request Type: POST

Admins only. This endpoint saves the same settings as the Save Changes button on the plugin settings page.

Send only the settings you want to change. Any setting you leave out keeps its current value. For example, to stop caching search pages and turn on caching for author pages:

{
"bypass_search_pages": 1,
"bypass_author_pages": 0
}

On success, you will get a response like this:

{
"success": true,
"status": "success",
"message": "Successfully updated the settings changes."
}

A setting name that isn't listed below is ignored.

How values work

  • On/off settings take 1 (on) or 0 (off).

  • bypass_* settings are "Don't cache" options: 1 means the page type is not cached, 0 means it is cached.

  • List settings (excluded_urls, predefined_related_url_paths, excluded_post_types, prefetch_url_list) take a single string with one entry per line, separated by \n. Sending a list replaces the whole list. Send an empty string "" to clear it.

  • purge_roles takes an array of role slugs as WordPress stores them, for example ["editor", "shop_manager"] (not "Shop Manager"). It also replaces the whole list. Send [] to remove every role.

  • Most settings are only saved while page cache is on. If page cache is off, only the settings marked "Saved when page cache is off" below are saved, and the rest are ignored. To change both in one request, include "page_cache_enabled": 1 in the same request.

Page cache

Setting

What it controls

Value

page_cache_enabled

Page caching. When off, pages are no longer cached, but static files (images, CSS, JavaScript) still are.

1 or 0

Cache lifetime

Setting

Setting page label

Value

maxage

CDN Cache-Control max-age

Seconds. Recommended: 31536000 (1 year).

browser_maxage

Browser Cache-Control max-age

Seconds. Recommended: 0, but you can set it higher if you know what you are doing.

Cache behavior

"Don't cache the following dynamic contents" options. 1 means the page type is not cached.

Setting

Page type

bypass_single_post

Single Posts (is_single)

bypass_pages

Pages (is_page)

bypass_front_page

Front Page (is_front_page)

bypass_home

Home (is_home)

bypass_archives

Archives (is_archive)

bypass_tags

Tags (is_tag)

bypass_category

Categories (is_category)

bypass_search_pages

Search Pages (is_search)

bypass_author_pages

Author Pages (is_author)

bypass_amp

AMP Pages

bypass_ajax

Ajax Requests

bypass_query_var

Pages with query args

bypass_wp_json_rest

WP REST API Endpoints (/wp-json/)

bypass_redirects

Redirection done by WordPress (theme, plugins, or WordPress core)

Other cache behavior settings:

Setting

Setting page label

Value

excluded_urls

Prevent the following URIs from being cached

One path per line. * works as a wildcard, for example "/checkout/*\n/my-page/".

predefined_related_url_paths

Additional related pages to clear cache

One path per line.

excluded_post_types

Prevent purging cache for the following Custom Post Types (CPT)

One post type name per line, for example "shop_order\nshop_coupon".

cache_logged_in_users

Enable Cache for Logged-in Users

1 or 0. Boost plan only (see below).

prefetch_urls

Enable Prefetch URLs to improve Cache HIT Ratio

1 or 0

prefetch_url_list

URLs to Prefetch

One URL per line. An empty string removes the list.

strip_cookies

Strip response cookies on pages that should be cached

1 or 0

auto_purge_on_comments

Automatically purge single post cache when a new comment is approved or deleted

1 or 0

auto_purge_related_pages_on_comments

Automatically purge related pages when a new comment is approved or deleted

1 or 0

auto_purge_opcache_on_upgrader_process_complete

Automatically purge the PHP OPcache when themes, plugins or WordPress core has been updated

1 or 0

auto_purge_on_upgrader_process_complete

Automatically purge the BigScoots CDN cache when themes, plugins or WordPress core has been updated

1 or 0

When the WooCommerce cart or checkout, or the Easy Digital Downloads checkout, is set to not be cached, its URL is added to excluded_urls for you. You don't need to add it yourself.

WooCommerce

"Don't cache the following WooCommerce page types" options. 1 means the page type is not cached.

Setting

Page type

bypass_woo_cart_page

Cart (is_cart)

bypass_woo_checkout_page

Checkout (is_checkout)

bypass_woo_checkout_pay_page

Checkout's pay page (is_checkout_pay_page)

bypass_woo_product_page

Product (is_product)

bypass_woo_shop_page

Shop (is_shop)

bypass_woo_product_tax_page

Product Taxonomy (is_product_taxonomy)

bypass_woo_product_tag_page

Product Tag (is_product_tag)

bypass_woo_product_cat_page

Product Category (is_product_category)

bypass_woo_pages

WooCommerce Page (is_woocommerce)

bypass_woo_account_page

My Account Page (is_account)

Other WooCommerce settings:

Setting

Setting page label

Value

bypass_woo_cart_cookies

Bypass Cache on WooCommerce Cart Cookies

1 or 0. Boost plan only (see below).

bypass_woo_session_cookies

Bypass Cache on WooCommerce Session Cookies

1 or 0. Boost plan only (see below).

auto_purge_woo_product_page

Automatically purge cache for product pages and related archives on successful orders, stock changes and price changes

1 or 0

auto_purge_woo_scheduled_sales

Automatically purge cache for scheduled sales

1 or 0

Easy Digital Downloads

"Don't cache the following EDD page types" options. 1 means the page type is not cached.

Setting

Page type

bypass_edd_checkout_page

Primary Checkout Page

bypass_edd_purchase_history_page

Purchase History Page

bypass_edd_login_redirect_page

Login Redirect Page

bypass_edd_success_page

Success Page

bypass_edd_failure_page

Failure Page

Setting

Setting page label

Value

auto_purge_edd_payment_add

Automatically purge purchased product pages when an order completes

1 or 0

WP Rocket

"Automatically purge the cache when" options.

Setting

Setting page label

Value

wp_rocket_purge_on_domain_flush

WP Rocket flushes all caches

1 or 0

wp_rocket_purge_on_rucss_job_complete

RUCSS generation process ends

1 or 0

Advanced

Setting

Setting page label

Value

early_hints

Enable auto Early Hints?

1 or 0. Saved when page cache is off.

prefetch_urls_on_hover

Auto prerender/prefetch URLs on mouse hover

1 or 0. Saved when page cache is off.

bfcache_enabled

Enable BFcache?

1 or 0. Saved when page cache is off.

remove_purge_option_toolbar

Remove purge option from toolbar

1 or 0. Saved when page cache is off.

purge_roles

Select user roles allowed to purge the cache

Array of role slugs, for example ["editor", "shop_manager"]. Saved when page cache is off. Admins are always allowed.

keep_settings_on_deactivation

Keep settings on deactivation

1 or 0. Saved when page cache is off.

Plugin log

Setting

Setting page label

Value

log_enabled

Enable plugin logs?

1 or 0. Saved when page cache is off.

log_max_file_size

Maximum plugin log file size (in MB)

Number of MB. The settings page allows 0 to 100. Saved when page cache is off.

log_verbosity

Log verbosity

1 (Standard) or 2 (High). Saved when page cache is off.

Cache for logged-in users and WooCommerce cookie settings

cache_logged_in_users, bypass_woo_cart_cookies, and bypass_woo_session_cookies are applied on our CDN as well as in the plugin. They work only on the Boost plan, on a production site, with page cache turned on.

When you change one of them:

  • The page cache is cleared, so pages are cached under the new rules.

  • If our systems can't apply the change, nothing in the request is saved, and the request fails with the error code plugin_specific_cache_settings_error (HTTP status 500). In that case, please contact our support team.

  • If the settings were saved but clearing the page cache failed, the request still succeeds, and the message says so. Clear the page cache yourself with the Clear Cache endpoint and "purge_type": "page_cache".

Import Settings

API Endpoint: /wp-json/bigscoots-cache/v2/import-config

Request Type: POST

Admins only. Imports a settings file exported from BigScoots Cache → Tools → Import/Export Settings → Export Settings. This is the same as the Import Settings button on that page.

Send the contents of the exported file as a string in the config field:

{
"config": "{\"cache_enabled\":1,\"maxage\":31536000,\"browser_maxage\":0, ...}"
}

Importing does the following, in order:

  1. Clears the whole cache (pages and static files) and the plugin log.

  2. Restores the settings to their defaults.

  3. Applies the settings from the file.

  4. Leaves the cache disabled. Call the Enable Cache endpoint afterwards to turn it back on.

On success, you will get a response like this:

{
"success": true,
"status": "success",
"message": "Configurations imported successfully. Now you must re-enable the page cache."
}

If config is missing, the request fails with config_not_provided. If the file is not a valid BigScoots Cache settings file, it fails with invalid_config_provided.

On the Boost plan, the file's cache for logged-in users and WooCommerce cookie settings are applied on our CDN too. If our systems can't apply them, nothing is imported, and the request fails with plugin_specific_cache_settings_error. On other plans, those three settings in the file are skipped.

Clear Plugin Log

API Endpoint: /wp-json/bigscoots-cache/v2/clear-logs

Request Type: DELETE

Request Body: not needed

Admins only. On success, you will get a response like this:

{
"success": true,
"status": "success",
"message": "BigScoots Cache plugin log has been cleared successfully."
}

Error responses

When a request fails, the API returns the standard WordPress REST API error format:

{
"code": "cache_disabled",
"message": "Cannot process the clear cache request as the cache is disabled.",
"data": {
"status": 403
}
}

Errors that only one endpoint returns are listed in that endpoint's section above. The common ones are:

Code

HTTP status

Why it happens

incorrect_password or invalid_username

401

The username or Application Password is wrong.

rest_forbidden

401 or 403

The user's role is not allowed to use this endpoint.

no_data_provided

403

The JSON body, purge_type, or a required list (post_ids, urls, user_ids) is missing.

clear_cache_not_allowed_on_staging

403

Cache clearing was requested on a staging site. Staging sites are never cached.

cache_disabled

403

The cache is disabled. Enable it first.

page_cache_disabled

403

The request needs page cache, and page cache is turned off.

improper_purge_type

403

purge_type is not one of all, page_cache, post_ids, urls, or user_ids.

exact_url_purge_not_supported

403

exact_url_purge was sent with a purge type other than urls.

cache_by_user_disabled

403

A user_ids purge was requested, but the site is not on the Boost plan or cache for logged-in users is off.

plugin_misconfigured

403

BigScoots Cache is not set up correctly on this site. Please contact support.

If edge caching isn't available for your site, every endpoint returns a 403 response in this format instead. If you see it, please contact our support team.

{
"success": false,
"status": "error",
"message": "Edge cache is not supported on this site."
}

If you use the wrong request method (for example POST instead of PATCH), you will get a 405 response:

{
"success": false,
"status": "error",
"message": "Sorry! POST request is not allowed to this endpoint. Please make the request with appropriate method."
}

If you run into an error you can't resolve, reach out to our support team with the request you sent and the response you got back, and we'll take a look with you.


Video Walkthrough

This short video (about 3 minutes) walks through generating an Application Password and making your first request with Postman: Making BigScoots Cache WP REST API Requests via Postman.

Did this answer your question?