Client Error · 4xx

405 Method Not Allowed

The HTTP method is not supported for this resource.

What 405 Method Not Allowed means

405 Method Not Allowed means the URL exists but does not accept the method you used. Trying to POST to a read-only endpoint, DELETE on a resource that does not support deletion, or PATCH on something that only accepts PUT all yield 405. The response must include an Allow header listing the methods the resource does support, so the client can self-correct without trial-and-error.

When servers should return it: Return 405 when the resource exists but the method is not supported. Always include an Allow header.

Common causes

How to fix 405 Method Not Allowed

Example response

curl -i -X DELETE https://api.example.com/health

HTTP/2 405
allow: GET, HEAD
content-type: application/json
{"error":"method not allowed"}

Related status codes

Frequently Asked Questions

Is 405 the same as 501?
No. 405 means the server understands the method generally but does not allow it on this resource. 501 means the server does not implement the method at all.
Why is the Allow header required?
It tells clients which methods to use without requiring a separate OPTIONS request. Skipping it is a spec violation and makes debugging harder.
Defined in: RFC 9110 · Class: 4xx Client Error

More references

For a one-page reference of all HTTP status codes, see the HTTP cheat sheet. For testing API responses, try the API Tester tool. For inspecting responses on the command line, the curl cheat sheet covers the most common flags.