Toolkit · Security

Restrict REST API

Close the REST API to anonymous visitors while keeping the routes your front end needs open.

Restrict REST API screenshot

Where it lives

Settings → Security

How it’s enabled

A switch on Settings → Security

Cost

Free — included in Toolkit

What you get

REST for your app, not for everyone.

Anonymous requests receive a 401. Logged-in users stay allowed unless you block them too, and any route prefix you list remains public.

Anonymous blocked

Returns 401 with a clear error code.

Optional: block logged-in too

For sites that never use REST from the browser.

Excluded routes

One prefix per line, such as /wp/v2/posts, stays open.

Early

Enforced at rest_pre_dispatch.

How it works

Three steps. No wizard.

Open Settings → Security

Enable REST API.

List exceptions

Add route prefixes that should remain public.

Save

Test an anonymous request.

Be honest

What it doesn’t do

Exclusions match by prefix on the route.

Restrict REST API is included in Toolkit.

Install the platform, switch this on from Available Tools, and leave everything else off.

Scroll to Top