HTTP cheatsheet

HTTP: Status codes

15 common HTTP tasks.

200 OK

The request succeeded and the response has a body.

HTTP/1.1 200 OK

201 Created

A resource was created. Send its URL in a Location header.

HTTP/1.1 201 Created
Location: /users/43

204 No Content

The request succeeded and there is nothing to return, common for DELETE and PUT.

HTTP/1.1 204 No Content

301 and 308: permanent redirects

The resource has moved for good. 308 keeps the request method; browsers may change POST to GET on 301.

HTTP/1.1 301 Moved Permanently
Location: https://example.com/new

302 and 307: temporary redirects

The resource is temporarily elsewhere. 307 keeps the request method.

HTTP/1.1 302 Found
Location: /login

304 Not Modified

The cached copy is still valid, so no body is sent. It answers a conditional request.

HTTP/1.1 304 Not Modified

400 Bad Request

The request is malformed or invalid, for example bad JSON or a failed validation.

HTTP/1.1 400 Bad Request

401 Unauthorized

Authentication is missing or invalid. Despite the name, it means unauthenticated.

HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer

403 Forbidden

The server knows who you are but you are not allowed to do this.

HTTP/1.1 403 Forbidden

404 Not Found

No resource exists at this URL.

HTTP/1.1 404 Not Found

409 Conflict

The request conflicts with the current state, such as a duplicate or an edit conflict.

HTTP/1.1 409 Conflict

422 Unprocessable Content

The request is well-formed but its content failed validation. Many APIs use it for field errors.

HTTP/1.1 422 Unprocessable Content

429 Too Many Requests

The client is rate limited. Check Retry-After for when to try again.

HTTP/1.1 429 Too Many Requests
Retry-After: 30

500 Internal Server Error

The server hit an unexpected error. It is the server's fault, not the client's.

HTTP/1.1 500 Internal Server Error

502, 503 and 504

502: a gateway got a bad reply from upstream. 503: the service is unavailable or overloaded. 504: the gateway timed out waiting for upstream.

HTTP/1.1 503 Service Unavailable
Retry-After: 120

Was this page helpful?