What does HTTP status code 405 mean?
The 405 Method Not Allowed status code indicates that the resource exists at the given URI, but the server does not support the HTTP method used in the request.
When to use it in APIs
Returned automatically by route engines when a client attempts to POST to a GET-only endpoint. Must include an Allow header listing supported methods.
How it compares to other codes
- 404 Not Found: Used when the route does not exist at all, whereas 405 indicates the route exists but is restricted to other methods.