405 Method Not Allowed
Meaning
The request method is known by the server but is not supported for the target resource.
When to Use
When the client uses an HTTP method that the resource does not allow. The server should send an Allow header listing acceptable methods for that resource.
Example
Submitting a PUT request to an endpoint that only supports GET returns 405 Method Not Allowed, along with an Allow: GET, POST header to inform the client of allowed methods.
When Not to Use
Do not use for unknown or unrecognized HTTP methods (use 400 or 501 in those cases). Also avoid if the method is allowed but something else failed (that should yield a different 4xx or 5xx code).
Source
RFC 9110