{ ILoveJS }

HTTP Status Codes Cheatsheet

http

HTTP status codes reference for API developers.

7 sections · 27 items

1xx Informational

Continue
100 Continue

Server received request headers and client should proceed to send the body

typescript
Client sends: Expect: 100-continue
Server responds: HTTP/1.1 100 Continue
Switching Protocols
101 Switching Protocols

Server is switching to a different protocol as requested by the client

typescript
Upgrade: websocket
HTTP/1.1 101 Switching Protocols

2xx Success

OK
200 OK

Request succeeded and response contains the requested data

typescript
GET /api/users/123
Response: { "id": 123, "name": "John" }
Created
201 Created

Request succeeded and a new resource was created

typescript
POST /api/users
Response: 201 Created
Location: /api/users/456
Accepted
202 Accepted

Request accepted for processing but not yet completed

typescript
POST /api/reports/generate
Response: 202 Accepted
{ "jobId": "abc123" }
No Content
204 No Content

Request succeeded but there is no content to return

typescript
DELETE /api/users/123
Response: 204 No Content
Partial Content
206 Partial Content

Server is delivering only part of the resource due to range header

typescript
Range: bytes=0-1023
Response: 206 Partial Content
Content-Range: bytes 0-1023/5000

3xx Redirection

Moved Permanently
301 Moved Permanently

Resource has permanently moved to a new URL and clients should update bookmarks

typescript
GET /old-endpoint
Response: 301 Moved Permanently
Location: /api/v2/new-endpoint
Found
302 Found

Resource temporarily located at a different URL

typescript
GET /api/download
Response: 302 Found
Location: https://cdn.example.com/file.zip
Not Modified
304 Not Modified

Resource has not been modified since the last request and cached version can be used

typescript
If-None-Match: "abc123"
Response: 304 Not Modified
Temporary Redirect
307 Temporary Redirect

Temporary redirect that preserves the HTTP method

typescript
POST /api/submit
Response: 307 Temporary Redirect
Location: /api/v2/submit
Permanent Redirect
308 Permanent Redirect

Permanent redirect that preserves the HTTP method

typescript
POST /old-api/data
Response: 308 Permanent Redirect
Location: /new-api/data

4xx Client Errors - Authentication & Authorization

Bad Request
400 Bad Request

Server cannot process the request due to malformed syntax or invalid data

typescript
POST /api/users { "email": "invalid" }
Response: 400 Bad Request
{ "error": "Invalid email format" }
Unauthorized
401 Unauthorized

Authentication is required and has failed or not been provided

typescript
GET /api/profile (no token)
Response: 401 Unauthorized
WWW-Authenticate: Bearer
Forbidden
403 Forbidden

Server understood the request but refuses to authorize it

typescript
DELETE /api/admin/users (as regular user)
Response: 403 Forbidden
{ "error": "Admin access required" }

4xx Client Errors - Resource & Method Issues

Not Found
404 Not Found

Requested resource does not exist on the server

typescript
GET /api/users/99999
Response: 404 Not Found
{ "error": "User not found" }
Method Not Allowed
405 Method Not Allowed

HTTP method is not supported for the requested resource

typescript
DELETE /api/config
Response: 405 Method Not Allowed
Allow: GET, PUT
Request Timeout
408 Request Timeout

Server timed out waiting for the client request

typescript
Client connection stalled
Response: 408 Request Timeout
Conflict
409 Conflict

Request conflicts with the current state of the resource

typescript
PUT /api/users/123 (duplicate email)
Response: 409 Conflict
{ "error": "Email already exists" }
Gone
410 Gone

Resource has been permanently deleted and will not be available again

typescript
GET /api/deprecated/v1/users
Response: 410 Gone
{ "error": "API v1 discontinued" }

4xx Client Errors - Validation & Rate Limiting

Unprocessable Entity
422 Unprocessable Entity

Request syntax is correct but semantic errors prevent processing

typescript
POST /api/orders { "quantity": -5 }
Response: 422 Unprocessable Entity
{ "error": "Quantity must be positive" }
Too Many Requests
429 Too Many Requests

Client has sent too many requests in a given time period

typescript
GET /api/search (rate limited)
Response: 429 Too Many Requests
Retry-After: 60

5xx Server Errors

Internal Server Error
500 Internal Server Error

Generic server error when an unexpected condition was encountered

typescript
GET /api/data (unhandled exception)
Response: 500 Internal Server Error
{ "error": "Something went wrong" }
Not Implemented
501 Not Implemented

Server does not support the functionality required to fulfill the request

typescript
PATCH /api/legacy-resource
Response: 501 Not Implemented
{ "error": "PATCH not supported" }
Bad Gateway
502 Bad Gateway

Server acting as gateway received an invalid response from upstream server

typescript
GET /api/external-data
Response: 502 Bad Gateway
{ "error": "Upstream service unavailable" }
Service Unavailable
503 Service Unavailable

Server is temporarily unable to handle requests due to maintenance or overload

typescript
GET /api/users (during deploy)
Response: 503 Service Unavailable
Retry-After: 120
Gateway Timeout
504 Gateway Timeout

Server acting as gateway did not receive a timely response from upstream

typescript
GET /api/slow-query
Response: 504 Gateway Timeout
{ "error": "Request timed out" }

Related Content