420 Enhance Your Calm / Method Failure
Two unrelated legacy meanings: rate limiting in the old Twitter API, and a failed method in early Spring versions.
Status
HTTP/1.1 420 Enhance Your Calm / Method Failure
Details
- Category: 4xx
- Status: Unofficial (Twitter API v1, Spring Framework). Not registered with IANA. A server, framework, or CDN convention.
- Specification: none, not defined by any RFC
- Cacheable: Not cacheable
- Response body: Allowed
- Retry: Retry after a delay
Twitter's version 1 API returned 420 Enhance Your Calm when a client exceeded its rate limit, a reference to the film Demolition Man. Later API versions replaced it with the standard 429.
Separately, older Spring Framework releases used 420 Method Failure as a Spring-specific error. Both meanings are obsolete, and any 420 in current traffic is coming from legacy software.
Common causes
- A client hitting rate limits on an old Twitter API endpoint.
- A legacy Spring application signalling an internal method failure.
How to fix it
As the client
- Back off as you would for a 429 and reduce request rate.
- Move to the current version of whichever API you are calling.
As the server
- Use 429 for rate limiting. It is standard, documented, and understood by client libraries.
Examples
GET /1/statuses/user_timeline.json HTTP/1.1 Host: api.twitter.com HTTP/1.1 420 Enhance Your Calm Retry-After: 60