418 I'm a teapot
Fault: Neither
TL;DR
April Fools' joke from 1998 Hyper Text Coffee Pot Control Protocol.
The server refuses to brew coffee because it is, permanently, a teapot.
What This Error Means
The server refuses to brew coffee because it is, permanently, a teapot.
April Fools' joke from 1998 Hyper Text Coffee Pot Control Protocol.
Common Causes
- HTCPCP protocol implementation
- Easter egg
- Joke response
How to Fix It (For Visitors)
- This is a joke status code
How to Fix It (For Developers/Admins)
- Don't use in production
- Fun for demonstrations
- Some APIs use it for rate limiting jokes
Code Examples
Here's how to return a 418 status code in various programming languages:
Python (Flask)
from flask import Flask, jsonify
app = Flask(__name__)
@app.route('/endpoint')
def endpoint():
return jsonify({"message": "I'm a teapot"}), 418
Node.js (Express)
const express = require('express');
const app = express();
app.get('/endpoint', (req, res) => {
res.status(418).json({ message: 'I'm a teapot' });
});
PHP
<?php
http_response_code(418);
header('Content-Type: application/json');
echo json_encode(['message' => 'I'm a teapot']);
?>
Go
package main
import (
"encoding/json"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(418)
json.NewEncoder(w).Encode(map[string]string{
"message": "I'm a teapot",
})
}
Java (Spring Boot)
@GetMapping("/endpoint")
public ResponseEntity<Map<String, String>> endpoint() {
Map<String, String> response = new HashMap<>();
response.put("message", "I'm a teapot");
return ResponseEntity.status(418).body(response);
}
Ruby (Sinatra)
get '/endpoint' do
status 418
json message: 'I'm a teapot'
end
Browser Compatibility
| Browser | Support | Notes |
|---|---|---|
| Chrome | ✓ Full Support | All versions |
| Firefox | ✓ Full Support | All versions |
| Safari | ✓ Full Support | All versions |
| Edge | ✓ Full Support | All versions |
Official Specification
This status code is defined in RFC 2324.