501 Not Implemented

The server does not support what the request requires. Most often it has been sent an HTTP method it does not recognise and could not perform on any resource.

What 501 means

A 501 is a statement about the server's capabilities, not about one URL and not about a temporary state. The specification singles out one case as the proper use: the server does not recognise the request method and cannot support it for any resource.

It is a 5xx code because the limitation is on the server's side, but it is not a crash. Nothing went wrong; the server simply was not built to do this. That also explains a property it shares with few other errors: a 501 is cacheable by default, since the answer is not expected to change from one request to the next.

When you will see one

  • A misspelt or unusual method. Method names are case-sensitive, so get is not GET, and a typo such as PSOT is an unknown method. Apache answers 501 to methods it does not know.
  • A method the software does not implement, such as PATCH on an old or minimal server.
  • An unknown transfer coding. A server that receives a request body with a Transfer-Encoding it does not understand is expected to answer 501.
  • A stub. Some APIs return 501 from endpoints that are documented but not built yet, or from operations a particular storage backend lacks. That stretches the definition a little and is widely understood.
  • An intermediary. A proxy, gateway or firewall that does not handle a method may answer 501 itself, even though the origin would have accepted it.

What to do

As a client:

  • Check the method's spelling and case in the raw request (curl -v shows the request line).
  • Do not retry. Nothing will change until the server's software or configuration does.
  • If the API documents the method, find out what is between you and it. Call the origin directly if you can, to see whether a proxy is the one refusing.
  • Look for an alternative the server does support, such as PUT or POST where PATCH is refused.

As a server owner:

  • Use 501 only for things the server cannot do anywhere. If the method works on other URLs, the code for this one is 405 with an Allow header.
  • Do not use it for failures. An exception is a 500, and a feature switched off for now is a 503.
  • If you return 501 from an unfinished endpoint, send Cache-Control: no-store, so that a cached copy does not outlive the gap.

501 compared with 405, 500 and 503

CodeScopeWill it work later?
501 Not ImplementedThe server cannot do this for any resourceOnly after the software changes
405 Method Not AllowedThe server knows the method; this resource does not allow itNo, but another URL or method will
500 Internal Server ErrorThe server tried and failedPossibly
503 Service UnavailableThe server can do it, just not nowYes

Example 501 response

HTTP/1.1 501 Not Implemented
Content-Type: application/json
Content-Length: 88
Cache-Control: no-store

{"error":"not_implemented","message":"The PATCH method is not supported by this server"}

No Allow header is needed, unlike a 405. Cache-Control: no-store overrides the default cacheability in case support is added later.

Defined in RFC 9110, section 15.6.2.

Questions

What causes a 501 Not Implemented error?

The server received a request that needs something it does not support, usually an HTTP method it does not recognise. Typical triggers are a misspelt or lower-case method name, a method such as PATCH on older software, or a proxy that does not pass certain methods.

What is the difference between 501 and 405?

A 405 means the server understands the method but the specific URL does not allow it, and the Allow header lists what it does. A 501 means the server does not support the method for any URL.

Is 501 a client error or a server error?

It is in the 5xx class because the missing capability is on the server. The practical fix is often on the client side, though: use a method or feature the server does support.

Should I use 501 for an API endpoint that is not finished?

It is a common convention and clients will understand it. Mark the response as not cacheable, since 501 can be cached by default, and consider whether leaving the endpoint out until it works would serve callers better.