HTTP 405 Method Not Allowed
The request method is known by the server but not supported for the target resource.
4xx Client Error
405
Method Not Allowed
Description
The 405 Method Not Allowed status code indicates that the method received in the request-line is known by the origin server but not supported by the target resource. The origin server must generate an Allow header field in a 405 response containing a list of the target resource's currently supported methods. A 405 response is cacheable by default. The client can inspect the Allow header to determine which methods are supported. For example, if a resource only supports GET and HEAD, sending a POST request would result in 405 with an Allow header listing the supported methods.
When Is It Used?
Returned when an HTTP method is not supported for the requested endpoint. For example, sending a DELETE request to a read-only API endpoint, or sending a POST to a resource that only accepts GET requests.
Example Response
HTTP/1.1 405 Method Not Allowed
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
{"error": "method_not_allowed", "message": "POST is not supported for this resource"}