418 I'm a teapot

HTTP response status code ==418 I’m a teapot== is a client error that is returned by the server to indicate that this server has been requested to brew coffee, yet, it’s a teapot.

Usage

The ==418 I’m a teapot== error message was designed as one of the IETF April Fools’ jokes and the RFC states that any teapot that has been asked to brew coffee shall respond with this message. Specifically, it states that the resulting message body may be short and stout.

Funnily enough, although this status code is not used, it is supported by many HTTP libraries. Some time ago, there was an effort to have this error removed so that the number can be used in an official capacity. However, this was met with resistance and led to the creation of the Save 418 initiative. As such, the message and status code remain.

Note

Search engines like Google will not index a URL with 418 I’m a teapot response status, and consequently, URLs that have been indexed in the past but are now returning this HTTP status code will be removed from the search results.

Example

In the example, the client requests that coffee be brewed, but the teapot objects.

Request

BREW coffee HTTP/1.1
Host: www.example.re
Content-Type: message/coffeepot
Content-Length: 5

start

Response

HTTP/1.1 418 I’m a teapot
Content-Type: text/html
Content-Length: 146

<html>
  <head>
    <title>Beverage not supported</title>
  </head>
  <body>
   <p>I’m a teapot and I don’t support coffee.</p>
  </body>
</html>

Code references

.NET

StatusCodes.Status418ImATeapot

Rust

http::StatusCode::IM_A_TEAPOT

Go

http.StatusTeapot

Symfony

Response::HTTP_I_AM_A_TEAPOT

Python3.5+

http.HTTPStatus.IM_A_TEAPOT

Angular

@angular/common/http/HttpStatusCode.ImATeapot

Takeaway

The ==418 I’m a teapot== status code is a client error that was designed as an April Fools joke and will not likely be seen in production.

See also

Last updated: August 2, 2023