HTTP 405 Method Not Allowed vs 422 Unprocessable Content
Both HTTP 405 (Method Not Allowed) and 422 (Unprocessable Content) belong to the 4xx Client Error category. 405 indicates that the HTTP method is not allowed for the requested resource. The response includes an Allow header listing valid methods. Meanwhile, 422 means that the server understands the content type and syntax, but was unable to process the contained instructions. Common in API validation errors.
Description
The HTTP method is not allowed for the requested resource. The response includes an Allow header listing valid methods.
When You See It
When sending POST to a read-only endpoint, or DELETE to a non-deletable resource.
How to Fix
Check the Allow response header for supported methods. Use the correct HTTP method.
Description
The server understands the content type and syntax, but was unable to process the contained instructions. Common in API validation errors.
When You See It
When form validation fails — correct syntax but invalid data (e.g., email format wrong, date in the past).
How to Fix
Check the response body for specific validation errors and correct the input data.
Key Differences
HTTP 405: The HTTP method is not allowed for the requested resource. The response includes an Allow header listing valid methods.
HTTP 422: The server understands the content type and syntax, but was unable to process the contained instructions. Common in API validation errors.
You encounter 405 when when sending POST to a read-only endpoint, or DELETE to a non-deletable resource.
You encounter 422 when when form validation fails — correct syntax but invalid data (e.g., email format wrong, date in the past).
When to Use Which
For 405 (Method Not Allowed): Check the Allow response header for supported methods. Use the correct HTTP method. For 422 (Unprocessable Content): Check the response body for specific validation errors and correct the input data.