WordPress REST API 403 Error: Find What’s Blocking It
WordPress REST API 403 error? Identify blocked requests, expired nonces, permissions, and firewall rules—then apply the right fix without weakening security.

A WordPress REST API 403 error means a request was denied, but the HTTP status alone cannot tell you who rejected it. The restriction might come from WordPress permissions, an expired authentication nonce, a security plugin, Cloudflare, or your hosting provider’s firewall.
This guide provides a practical diagnostic sequence for site owners, WordPress administrators, and developers. It covers Gutenberg saving failures, REST API warnings in Site Health, third-party integrations, and endpoint-specific access problems.
- Open
https://example.com/wp-json/and check whether it returns JSON. - Inspect the exact failed REST request in your browser's Network panel.
- Look for error codes such as
rest_cookie_invalid_nonceorrest_forbidden. - If the response is a firewall block, find the matching event in your security logs.
- Apply the smallest correction possible and repeat the original failed action.
Replace example.com with your WordPress domain. A successful API homepage does not guarantee that every protected endpoint works.
What Does a WordPress REST API 403 Error Mean?
The WordPress REST API allows applications and WordPress components to communicate through HTTP requests. The block editor uses it to retrieve information and save content. Plugins, external publishing tools, and administrative interfaces can also depend on REST endpoints.
An HTTP 403 Forbidden response indicates that access was refused. It does not necessarily mean the API is disabled or unavailable.
For example, a website may successfully return public posts from:
https://example.com/wp-json/wp/v2/posts
Yet an authenticated request to edit content may return 403 because the user lacks the required capability or the authentication process failed.
WordPress core also distinguishes authentication failures from authorization failures. Its 🔗 authorization status function returns 401 for an unauthenticated user and 403 for a logged-in user in contexts that use this function. Other authentication handlers and security systems may produce different responses.
🤔 403 vs. 401 vs. 404: Why the Difference Matters
- 401 Unauthorized: Authentication is missing, invalid, or required. A protected endpoint may return this normally to anonymous visitors.
- 403 Forbidden: A request was denied. The cause may be insufficient permissions, invalid nonce validation, or a security restriction.
- 404 Not Found: The requested route may not exist, or URL rewriting may be broken. Some systems intentionally return 404 for restricted resources.
- 500 Internal Server Error: The server encountered an error while processing the request. PHP failures or plugin defects may be involved.
⚠️ Do not treat a 401 from a deliberately protected endpoint as evidence that the WordPress REST API is broken.
Where Can a REST API Request Be Blocked?
A request can encounter several independent checks before WordPress returns a response. Identifying the responsible layer is more important than applying a generic list of fixes.
Diagram explanation: A security service can deny a request before PHP runs. Alternatively, the request can reach WordPress successfully and fail at the authentication or endpoint-permission stage. Both situations may produce the same HTTP status but require different fixes.
Diagnose the Error Before Changing Anything
Step 1: Test the Public REST API Endpoint
Open the following address in a private browser window:
https://example.com/wp-json/
On a typical unrestricted WordPress installation, this endpoint returns JSON containing information about the API and its registered routes.
Interpret the response carefully:
- ✅ JSON is returned: The API index is reachable. Your problem may be limited to a specific route, request method, or authenticated session.
- ⚠️ A 403 HTML page appears: A security service, web server restriction, or another access-control mechanism may be responsible.
- ⚠️ A JSON error appears: WordPress or an integration may be deliberately restricting access. Inspect the error code.
- ⚠️ A 404 or unexpected redirect appears: Investigate URL rewriting, server configuration, and redirects.
Next, try the alternative REST routing format:
https://example.com/?rest_route=/
If this alternative returns the expected JSON while /wp-json/ returns 404, the API may be functioning while the readable URL routing is broken. If the readable URL returns 403 instead, investigate path-specific security restrictions as well.
Step 2: Inspect the Actual Failed Request
If Gutenberg displays a message such as Updating failed or Publishing failed, inspect the request that failed rather than testing only the API homepage.
- Open the WordPress editor where the error occurs.
- Press
F12or open your browser’s Developer Tools. - Select the Network panel.
- Enable request preservation if the page is likely to navigate.
- Repeat the failed action.
- Filter for
wp-json,rest_route, or status 403. - Open the failed request and inspect its URL, method, response headers, and response body.
A POST request rejected while saving a post is not equivalent to a public GET request failing at the API index. Different methods and endpoints can encounter different security checks.
Record the request’s timestamp, including its time zone. This information helps match browser activity with Cloudflare or hosting firewall logs.
⚠️ Do not publish session cookies, Authorization headers, application passwords, or complete authenticated request exports. They may contain credentials or sensitive account information.
Step 3: Identify the Error Signature
| Observed response | Likely investigation | Next action |
|---|---|---|
403 with security HTML or challenge |
CDN, WAF, host firewall, or security plugin | Match request to security logs |
rest_cookie_invalid_nonce |
Invalid REST nonce or session mismatch | Refresh authentication and inspect caching |
rest_forbidden or permission-specific JSON |
Route callback, capabilities, or plugin access restrictions | Check current user and endpoint authorization |
| Public routes work; authenticated routes fail | Credentials, request headers, permissions, or security filters | Check the authentication method |
| Pretty REST route is 404; alternate route works | Rewrite configuration | Refresh permalinks and inspect server rules |
| Only Site Health reports 403 | Authenticated internal request, loopback, or diagnostic-specific failure | Compare the test with normal editor behavior |
This matrix separates problems that troubleshooting articles often group together. A working public endpoint cannot prove that authenticated editing is healthy, and a 403 from WordPress itself cannot be fixed simply by changing Cloudflare settings.
Fix 1: Check Security Plugins Blocking the REST API
WordPress security plugins can restrict REST access, block suspicious requests, or deny certain users access to particular endpoints.
Depending on the installed product and configuration, relevant settings may appear under REST API restrictions, firewall rules, access controls, or security-hardening options.
Products such as Wordfence, Solid Security, and All-In-One Security have different interfaces and capabilities. Do not assume they all block requests in the same way.
🤔 How to Investigate a Plugin Restriction
- Open the dashboard of your active security plugin.
- Inspect firewall activity, blocked requests, and available diagnostic logs.
- Look for the exact REST endpoint, method, and time of your failed request.
- Check whether a REST API restriction or firewall rule applies to that request.
- If appropriate, temporarily adjust only the suspected rule and retest.
- Restore protection and retain only a narrowly scoped correction supported by the plugin.
For example, a security rule blocking anonymous access to sensitive endpoints may be functioning correctly. The problem might be that an integration requires authentication or that a broad rule accidentally includes a necessary public route.
💡 Important: Disabling an entire security plugin is not a good permanent solution. It may also be unnecessary when an individual rule can be corrected.
Fix 2: Investigate Cloudflare and Hosting Firewall Rules
A web application firewall can return 403 without WordPress executing the affected REST endpoint. This makes firewall logs especially useful when the response body contains a challenge page, block notice, or generic HTML rather than WordPress JSON.
◉ Check Cloudflare Security Events
If your site uses Cloudflare, open its dashboard and locate Security Events. The precise navigation can change as the interface evolves.
- Reproduce the failed request.
- Record the requested path, HTTP method, timestamp, and any Cloudflare Ray ID displayed.
- Filter the security events by the available request details.
- Inspect the matched security feature and action, such as Block or Managed Challenge.
- Determine whether the request was legitimate and whether the match was a false positive.
- Configure the narrowest appropriate exception or rule adjustment.
Cloudflare documents these investigations in its 🔗 Security Events documentation.
Its 🔗 managed-rule troubleshooting guidance also explains how to investigate false positives and adjust individual rules.
⚠️ Avoid a global rule that bypasses all security checks for every request beginning with /wp-json/. REST endpoints can expose sensitive operations when properly authenticated, and broad exceptions unnecessarily reduce protection.
Cloudflare event data can be sampled. The absence of an obvious matching event does not conclusively prove that Cloudflare was uninvolved.
◉ Check ModSecurity and Your Hosting Provider
Hosting providers may operate ModSecurity or other server-level filtering systems. A rule may reject request bodies, HTTP methods, specific URL patterns, or traffic classified as suspicious.
If you cannot access the relevant logs, send your host a concise technical report containing:
- The affected website domain.
- The exact REST API path without credentials or secret parameters.
- The HTTP method and returned status.
- The date, time, and time zone of the failure.
- The response type and any available error or request identifier.
- Whether the same request succeeds from another network or authentication context.
Ask the provider to identify the matching firewall rule and confirm whether it generated the 403.
A targeted adjustment by the host is preferable to disabling ModSecurity across the entire website.
Fix 3: Resolve the REST API Invalid Nonce Error
One of the most informative WordPress-specific responses is:
{
"code": "rest_cookie_invalid_nonce",
"message": "Cookie check failed",
"data": {
"status": 403
}
}
This is an illustrative response format based on WordPress core. The important diagnostic value is the error code, not an assumption that every site will return identical wording.
WordPress supports cookie-based authentication for logged-in browser sessions. REST requests using that authentication must include a valid nonce associated with the wp_rest action.
The nonce can be supplied through the X-WP-Nonce request header or the supported request parameter.
According to the 🔗 official WordPress implementation, an invalid nonce can produce HTTP 403 with the code rest_cookie_invalid_nonce. When no nonce is supplied, WordPress may instead treat the request as unauthenticated.
🤔 What Causes an Invalid REST Nonce?
- Expired editor session: A dashboard tab remained open while the associated authentication state changed.
- Stale cached output: A cache or optimization component reused an authentication token that no longer matches the active session.
- Domain mismatch: Requests are being made across different hosts, protocols, or origins without the correct authentication context.
- Plugin-generated requests: Custom frontend code sends an obsolete or incorrect nonce.
- Cross-site API calls: Code designed for the current WordPress installation reuses its nonce when contacting another WordPress site.
🤔 How to Fix the Nonce Failure
- Preserve any unsaved content before troubleshooting the editor.
- Reload the dashboard and authenticate again if the session has expired.
- Verify that the WordPress Address and Site Address are configured consistently with the intended HTTPS hostname.
- Review redirects between
wwwand non-wwwhostnames. - Inspect caching rules affecting logged-in pages and REST responses.
- Refresh or invalidate the relevant cached content using the controls provided by your caching system.
- For custom code, confirm that the nonce is generated for
wp_restand sent with the correct authenticated request.
🔗 The WordPress REST API Authentication Handbook explains how cookie authentication and REST nonces work together.
Developers should also review the 🔗 official apiFetch documentation. WordPress’s API middleware is intended for requests to the WordPress site on which it runs; indiscriminately reusing its nonce on another site’s API can cause authentication failures.
⚠️ Never solve nonce errors by globally removing REST authentication checks. Doing so changes the security model instead of repairing the session or request.
Fix 4: Check WordPress User Roles and Endpoint Permissions
Sometimes a 403 is the correct response because the authenticated user does not have permission to perform the requested operation.
WordPress separates authentication from authorization:
- Authentication: Which user, if any, is making the request?
- Authorization: Is that user allowed to perform this action on this resource?
Consider an editorial integration attempting to modify a post belonging to another author. Authenticating successfully does not automatically grant permission to edit that post.
The same applies to plugin settings, user management, private content, and custom REST API endpoints.
🤔 How to Diagnose a Permissions Problem
- Identify the exact REST route being called.
- Confirm which WordPress user the request authenticates as.
- Check the user’s role and relevant capabilities.
- Determine whether the requested resource has additional restrictions.
- Review the endpoint’s permission logic if custom code or a plugin implements it.
- Test again with an account that legitimately has the required capability.
A developer might implement an endpoint check using:
'permission_callback' => function () {
return current_user_can( 'edit_posts' );
}
This is an illustrative PHP fragment for a route registration, not a complete plugin or a command to paste into your live website. The correct capability depends on the resource and operation. For example, editing a particular post may require a post-specific capability check rather than this broad example.
The 🔗 WordPress custom-endpoint documentation explains how permission callbacks determine access.
💡 A useful diagnostic question is whether the request fails for every properly authenticated user or only for one role. That distinction can separate a missing capability from a broader service restriction.
Fix 5: Repair Authentication for External REST API Integrations
External applications cannot simply rely on the browser session of a WordPress administrator. They need an authentication mechanism supported by the website and appropriate for their use case.
For compatible integrations, WordPress provides Application Passwords, which allow API authentication without sharing the account’s primary login password.
📌 Test an Application Password Safely
In a supported HTTPS WordPress installation:
- Open Users → Profile.
- Locate the Application Passwords section, if available.
- Create a named credential for the intended integration.
- Store the generated secret securely.
- Use it to test a protected endpoint that the user has permission to access.
For example, on a system with cURL installed:
curl -i --user "YOUR_USERNAME" \
"https://example.com/wp-json/wp/v2/users/me"
This command is intended for a Unix-like shell. cURL normally prompts for the password when only the username is supplied; enter the generated Application Password. On Windows PowerShell, use curl.exe if necessary and keep the command on one line.
A successful authenticated request to /wp/v2/users/me should return information about the authenticated user. A failed response requires examination of its actual status and body.
Do not embed credentials in publicly accessible scripts, screenshots, URLs, or support tickets. Avoid entering secrets directly into commands that will be retained in shell history.
Consult the 🔗 official Application Passwords guide for creation, revocation, and security details.
🤔 What If the Credentials Are Correct but Access Still Fails?
Investigate whether the Authorization header reaches WordPress. Some web-server, proxy, or FastCGI configurations may fail to pass the header into PHP correctly.
The resulting request can appear anonymous even when the client supplied valid credentials.
Also verify that a security plugin is not rejecting the request independently and that the authenticated account has the capability required by the endpoint.
Ask your hosting provider to verify how the Authorization header is forwarded. Server-specific adjustments should be made only after the issue is confirmed.
⚠️ Application Passwords are credentials, not permission bypasses. They authenticate as the associated user and do not automatically make restricted operations available.
Fix 6: Check Permalinks and Server Rewrite Rules
Incorrect URL rewriting can interfere with REST routes, but permalink changes are not a universal fix for 403 errors.
This step is particularly useful when:
- The alternate
?rest_route=/format works. - The readable
/wp-json/URL returns 404 or redirects incorrectly. - The problem began after a migration or web-server configuration change.
📌 Refresh Permalink Rules
- Back up your website configuration if you plan to make server changes.
- Open Settings → Permalinks.
- Review the current permalink structure.
- Click Save Changes without unnecessarily changing your existing URL structure.
- Retest
/wp-json/and the specific failing route.
Saving permalink settings can refresh WordPress rewrite rules. However, it does not guarantee that Apache or Nginx will apply the correct routing configuration.
If the problem persists, review web-server rewrite rules with your host or server administrator.
On Apache, restrictions in .htaccess can affect access to REST paths. On Nginx, routing and access controls typically come from the server configuration rather than .htaccess.
Do not copy unrelated rewrite rules from forum posts into a production configuration without confirming the web-server environment and making a recoverable backup.
Fix 7: Identify Plugin Conflicts Without Breaking the Live Site
A plugin may add a REST authentication filter, modify route permissions, change headers, or interfere with a specific editor request.
That does not mean every plugin on the website should be disabled immediately.
The more reliable approach is controlled isolation.
✅ Recommended Diagnostic Procedure
- Create a staging copy where possible.
- Reproduce the same failing request before changing anything.
- Record the current plugin versions and relevant settings.
- Temporarily isolate suspected plugins or REST restrictions.
- Repeat the original request after each controlled change.
- Reintroduce components individually to identify the actual conflict.
- Resolve the issue through a supported setting, plugin update, or verified code correction.
WordPress also documents a 🔗 troubleshooting workflow using an administrator-specific troubleshooting mode that can help isolate plugin and theme conflicts without intentionally altering the configuration shown to ordinary visitors.
However, a staging environment remains preferable for risky operations, server-level changes, or websites processing live orders and transactions.
📌 A change should only be considered successful when the original failing request works again. An unrelated warning disappearing is not enough evidence.
Fix 8: Investigate REST API Errors in WordPress Site Health
WordPress includes a diagnostic screen under Tools → Site Health.
Its REST API availability test checks an authenticated editing-related request. This distinction matters because Site Health does not merely test whether the public API index is visible.
The 🔗 WordPress Site Health implementation shows that the REST availability test requests the post-type endpoint with editing context.
Consequently, your public REST API homepage might return valid JSON even when Site Health reports an authentication-related or internal-request failure.
📌 When Site Health Reports 403 but the Editor Still Works
Check whether the failed diagnostic request is affected by a different request context, cookie state, or firewall rule.
Useful comparisons include:
- Does the public API index return JSON?
- Can a logged-in administrator save a test draft?
- Does Site Health fail consistently across fresh sessions?
- Are firewall logs showing a corresponding blocked request?
- Does the issue affect only a site-originated request rather than normal browser traffic?
There are also edge cases involving the test itself. For example, 🔗 WordPress Trac ticket #65839 documents an issue involving cookies forwarded during the Site Health REST availability test that could produce a misleading 403 under certain conditions.
That ticket is evidence of a documented edge case, not proof that every Site Health error is a false positive or that a particular WordPress release has resolved it.
At Noxoric, the practical distinction is straightforward: evaluate the failed endpoint, authentication context, and user-facing functionality separately. A passing public API check and a failing authenticated diagnostic can both be accurate observations.
For related troubleshooting involving internal WordPress requests and background tasks, see our 🔗 guide to WordPress missed scheduled posts on Hostinger. REST API checks and WP-Cron use different endpoints, but both can be affected by hosting restrictions and incorrectly configured security controls.
⁉️ Which Fix Is Safest? Advantages and Disadvantages
Several troubleshooting methods may restore access, but they carry different operational risks. The best choice depends on the confirmed failure.
Recommendation: Match the remedy to the evidence. Use a narrow firewall correction for a confirmed false positive, an authentication correction for invalid credentials or nonces, and a permission correction when a legitimate user lacks the required capability.
Do not grant administrator privileges merely to make an integration work. Use a dedicated account with only the permissions required whenever the integration supports that approach.
How to Confirm the WordPress REST API 403 Error Is Fixed
Removing the warning from one screen is not enough. A complete verification should reproduce the original operation successfully without introducing an unnecessary security exception.
📌 Final Verification Checklist
- Retest the public endpoint: Confirm that the API index responds as intended for your site’s access policy.
- Repeat the failed operation: Save the draft, perform the application request, or reload the affected plugin interface.
- Inspect the Network response: Confirm that the original 403 has been replaced by the response the operation expects.
- Verify authenticated access: Confirm the correct user can perform the intended task.
- Verify unauthorized access remains restricted: Do not expose private operations to anonymous visitors.
- Restore security controls: Re-enable temporarily adjusted protection and keep only justified exceptions.
- Recheck Site Health: Review any remaining warning independently.
- Document the correction: Record the affected component, cause, and change for future maintenance.
For ongoing maintenance, repeat a targeted REST check after significant migrations, firewall configuration changes, security-plugin updates, or authentication-related modifications.
There is no need to run aggressive automated request floods to verify a normal REST endpoint. A small number of legitimate tests is generally more informative and avoids triggering rate limits.
Final Thoughts: Fix the Denial, Not Just the Error Message
A WordPress REST API 403 error is best understood as an authorization or access-control problem until the response evidence identifies the specific mechanism.
If the response contains rest_cookie_invalid_nonce, investigate the session and nonce lifecycle. If a protected endpoint rejects an authenticated account, inspect the relevant capabilities. If the response is generated by an upstream security layer, use request logs to identify the responsible rule. Reserve permalink repairs for evidence of routing problems.
The objective is not to make every REST endpoint publicly accessible. It is to restore legitimate communication while preserving the restrictions that protect private data and administrative actions.
🚀 Explore more practical WordPress troubleshooting articles, technical guides, and free digital tools at Noxoric.



