rest_forbidden WordPress Origin: Application & API OSI layer 7 · Application Last updated 13 Oct 2026

WordPress REST API: {"code":"rest_forbidden","message":"Sorry, you are not allowed to do that."} (401/403)

The REST request isn’t authenticated or the user lacks the capability required by the route’s permission_callback.

Exact message you may see Sorry, you are not allowed to do that.
Seen on: WordPress

Meaning

Cookie authentication needs the X-WP-Nonce header; external clients need Application Passwords (Basic auth) or OAuth/JWT. Some hosts strip the Authorization header, and security plugins can disable REST for anonymous users.

Common causes

  • Missing X-WP-Nonce for cookie-authenticated requests
  • External request without Application Password/JWT
  • Authorization header stripped by the server (CGI/FastCGI)
  • User lacks the capability
  • Security plugin restricting REST

⚡ Quick fix

  1. Send X-WP-Nonce (wp_create_nonce('wp_rest')) from the frontend
  2. Use an Application Password for external clients
  3. Pass Authorization through in .htaccess

Detailed fix by platform

Apache

  1. apache
    # .htaccess — keep the Authorization header for PHP
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

Shell

  1. curl -u "user:abcd efgh ijkl mnop qrst uvwx" https://example.com/wp-json/wp/v2/posts?status=draft

How to diagnose

  1. Auth — Nonce or Application Password sent?
  2. Header — Reaches PHP?
  3. Capability — User role

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

401 — HTTP 401 Unauthorized (HTTP)401403 — HTTP 403 Forbidden (HTTP)403454 — 454 4.7.0 Temporary authentication failure (SMTP AUTH backend unavailable) (Email / SMTP)454530 5.7.0 Authentication Required — SMTP: 530 5.7.0 Must issue a STARTTLS command first / 530 5.7.1 Authentication required (Email / SMTP)530 5.7.0 Authenticat…534 5.7.9 Application-specific password required — SMTP: 534-5.7.9 Application-specific password required. Learn more at https://support.google.com/accounts/answer/185833 (Email / SMTP)534 5.7.9 Application…535 5.7.3 — Microsoft 365: 535 5.7.3 Authentication unsuccessful (SMTP AUTH / client submission blocked) (Email / SMTP)535 5.7.3bad auth : Authentication failed — MongoDB: MongoServerError: bad auth : Authentication failed (code 8000 / 18) (MongoDB)bad auth : Authentica…Could not load the default credentials — Google Cloud: Error: Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started (Google Cloud / Firebase)Could not load the de…rest_forb…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.