4xx

405 Method Not Allowed

The HTTP method used is not supported for this URL.

What is HTTP 405?

This status code indicates that the server recognizes the request URL but the HTTP method used is not allowed for that resource. The response must include an Allow header listing the methods that are supported for the requested URL. For example, a read-only resource might accept GET and HEAD but reject POST, PUT, and DELETE. This helps clients understand which operations are valid for a given endpoint.

Defined in RFC 9110

Common Causes

  • Sending a POST request to an endpoint that only accepts GET requests
  • Attempting to DELETE a resource on a read-only API endpoint
  • Using PUT or PATCH on a URL that only supports POST for creation
  • API routing misconfiguration where the method is not mapped to a handler

How to Fix

  • Check the Allow header in the response to see which methods the endpoint supports
  • Review the API documentation to use the correct HTTP method for your operation
  • If you control the server, add the missing method handler to the route configuration
  • Verify your client is sending the intended method and not defaulting to an incorrect one