418 I'm a teapot

A joke status code from 1998: the server is a teapot and declines to brew coffee. It is not part of HTTP, but it is so widely recognised that the number has been set aside for good.

Where 418 comes from

RFC 2324, published on 1 April 1998, defines the Hyper Text Coffee Pot Control Protocol (HTCPCP), a parody extension of HTTP for controlling and monitoring coffee pots. Among a BREW method and an Accept-Additions header for milk and sugar, it has one rule about teapots: an attempt to brew coffee with one should result in the error 418 I'm a teapot, and the response body "MAY be short and stout".

A follow-up on 1 April 2014, RFC 7168, extended the protocol to tea. There, a pot that can make tea but is not set up for coffee may answer either 503 or 418, with 418 standing for the more permanent condition of being a teapot.

Its status today

418 has never been an HTTP status code. HTCPCP is a separate, fictional protocol, and neither RFC is a standard. But enough software implemented the joke that the number became unusable for anything serious.

The current HTTP specification deals with this directly. RFC 9110, section 15.5.19 is titled "418 (Unused)": the code is reserved in the IANA registry and cannot be assigned to another meaning for now, though it could be reclaimed if the 4xx range ever ran out.

Many HTTP libraries ship a named constant for it, among them Go (http.StatusTeapot), Python (HTTPStatus.IM_A_TEAPOT) and Node.js.

Should you ever send it?

For an Easter egg on a hobby project, nobody will mind. In anything other people integrate with, no:

  • A client that does not recognise a status code has to treat it as the generic code of its class, so 418 is handled as a 400. You gain no behaviour by sending it.
  • It tells the caller nothing about what to change. If you are refusing a request, 403 says so; if you are rate limiting, 429 does; if the method is wrong, 405.
  • Monitoring and alerting rules written for real codes will not know what to do with it.

If you receive a 418 from a production service, read it as a deliberate refusal. Some sites send it to traffic they have classified as automated. Retrying unchanged is unlikely to help; look at the response body, your User-Agent and your request rate.

418 next to the real codes

CodeDefined inMeaning
418 I'm a teapotRFC 2324 (HTCPCP), an April Fools' documentThe pot cannot brew coffee because it is a teapot
403 ForbiddenHTTPThe server refuses the request
501 Not ImplementedHTTPThe server does not support the functionality at all, which is what a real teapot asked for coffee should arguably say

Example 418 response

HTTP/1.1 418 I'm a teapot
Content-Type: text/plain; charset=utf-8
Content-Length: 30

I'm a teapot: short and stout.

The capitalisation "I'm a teapot" follows RFC 2324. Libraries differ, and it makes no difference to clients.

Defined in RFC 2324, section 2.3.2.

Questions

Is 418 a real HTTP status code?

Not officially. It was defined in RFC 2324, an April Fools' document describing a coffee pot control protocol, not in HTTP. The current HTTP specification lists 418 as unused and reserved, so it will not be given another meaning in the foreseeable future.

Why does 418 I'm a teapot exist?

It was a joke in a 1998 April Fools' RFC that poked fun at the ways HTTP was being stretched. Developers liked it enough to implement it in servers and libraries, and it has stayed as a piece of internet folklore.

Can I use 418 in my API?

You can, and clients will treat it as a generic 400-class error, but it communicates nothing useful. Use 403 for refused requests, 429 for rate limits and 400 or 422 for bad input, and keep 418 for jokes.

What does it mean if a website returns 418 to my script?

The site has chosen an unusual way of refusing the request, often for traffic it believes is automated. Treat it like a 403: check the response body, send an honest User-Agent, slow down, and use the official API if there is one.