HTTP status code, method and header reference

Status codes, methods and headers — searchable, no tab-switching to MDN.

100Continue

Client should continue with the request body.

101Switching Protocols

Server is switching protocols per the Upgrade header.

103Early Hints

Preload hints sent before the final response.

200OK

Request succeeded; response body carries the result.

201Created

Resource created — return its URI in the Location header.

202Accepted

Accepted for processing, but not yet completed.

204No Content

Success with no response body. Common for DELETE/PUT.

206Partial Content

Range request satisfied; partial body returned.

301Moved Permanently

Resource permanently moved; clients should update links.

302Found

Temporary redirect (method may change to GET).

303See Other

Redirect to a GET on another URI, typically post-POST.

304Not Modified

Cached copy is still valid (ETag/If-None-Match).

307Temporary Redirect

Temporary redirect preserving the original method.

308Permanent Redirect

Permanent redirect preserving the original method.

400Bad Request

Malformed syntax or invalid request framing.

401Unauthorized

Authentication required or failed. (Really "unauthenticated".)

403Forbidden

Authenticated but not permitted to access the resource.

404Not Found

No resource matches the URI.

405Method Not Allowed

Method not supported — respond with an Allow header.

409Conflict

State conflict, e.g. a duplicate or version mismatch.

410Gone

Resource intentionally removed and will not return.

412Precondition Failed

A conditional request header evaluated false.

415Unsupported Media Type

Content-Type not supported by the endpoint.

418I'm a teapot

Short and stout. From RFC 2324, an April Fools spec.

422Unprocessable Content

Syntactically valid but semantically invalid — validation errors.

429Too Many Requests

Rate limited; pair with Retry-After.

500Internal Server Error

Unhandled server-side failure.

501Not Implemented

Server does not support the functionality required.

502Bad Gateway

Invalid response from an upstream server.

503Service Unavailable

Temporarily overloaded or down for maintenance.

504Gateway Timeout

Upstream server did not respond in time.

About the HTTP reference

How it works in 4 steps · 4 common use cases · 3 questions answered

How it works

  1. 1.Type into the filter to search across status codes, methods and headers at once.
  2. 2.Codes are grouped by class — 2xx success, 3xx redirect, 4xx client error, 5xx server error.
  3. 3.Methods list whether they are safe and idempotent, which is what decides if a client may retry.
  4. 4.Headers give what each one is for rather than a restatement of its name.

Common use cases

  • •Deciding between 400, 409 and 422 for a validation failure
  • •Checking whether PUT or PATCH is the idempotent choice for a retryable write
  • •Looking up what Retry-After expects when rate-limiting a client
  • •Settling whether a redirect should be 301, 302, 307 or 308

FAQ

409 or 422 — which should I return?

409 Conflict means the request clashes with the current state of the resource, such as a duplicate key or a stale version. 422 Unprocessable Content means the request was well-formed but its contents failed validation. If retrying the same request unchanged could succeed later, it is usually 409.

What does idempotent actually guarantee?

That making the same request twice leaves the server in the same state as making it once. It says nothing about the response body being identical, and it is why a client may safely retry PUT or DELETE but not POST.

When is 307 or 308 the right redirect?

When the method must be preserved. Historically 301 and 302 caused clients to turn a POST into a GET; 308 and 307 are the permanent and temporary equivalents that forbid that rewrite.