# API04002: Unexpected Response Code

## What This Means[​](#what-this-means "Direct link to What This Means")

The server returned an HTTP status code that wasn't expected for this request. Common codes include 500 (server error), 403 (forbidden), 404 (not found), etc.

## Common Causes[​](#common-causes "Direct link to Common Causes")

* **500 Internal Server Error** — PHP crashed or encountered an error
* **403 Forbidden** — Access denied by security settings
* **404 Not Found** — The endpoint doesn't exist
* **502/503/504** — Server gateway or availability issues

## How to Fix[​](#how-to-fix "Direct link to How to Fix")

### For 500 Errors (Server Error)[​](#for-500-errors-server-error "Direct link to For 500 Errors (Server Error)")

1. Check PHP error logs
2. Increase PHP memory limit
3. Look for plugin conflicts
4. Check `wp-content/debug.log`

### For 403 Errors (Forbidden)[​](#for-403-errors-forbidden "Direct link to For 403 Errors (Forbidden)")

1. Check security plugin settings (Wordfence, Sucuri, etc.)
2. Whitelist the POS or your IP
3. Check `.htaccess` for blocking rules
4. Verify ModSecurity isn't blocking requests

### For 404 Errors (Not Found)[​](#for-404-errors-not-found "Direct link to For 404 Errors (Not Found)")

1. Verify the WCPOS plugin is active
2. Flush WordPress permalinks (Settings → Permalinks → Save)
3. Check if REST API is enabled
4. Verify URL configuration

### For 502/503/504 Errors (Gateway Issues)[​](#for-502503504-errors-gateway-issues "Direct link to For 502/503/504 Errors (Gateway Issues)")

1. Contact your hosting provider
2. Wait for server to recover
3. Check if site is under heavy load
4. Verify server is running

### General Troubleshooting[​](#general-troubleshooting "Direct link to General Troubleshooting")

1. Try accessing your site directly
2. Check hosting control panel for issues
3. Review server access logs
4. Contact hosting support if needed

## Related Errors[​](#related-errors "Direct link to Related Errors")

* [API04001](/error-codes/API04001.md) — Invalid Response Format
* [API01008](/error-codes/API01008.md) — Website Unavailable
