← Back to Developer Tools
📡

HTTP Response Codes — With Code Snippets for JS, Python & nginx

All 34 status codes · Search · Filter · Snippets · cURL Tester · Favorites

💡

HTTP response codes reference with production-ready code snippets. Every status code includes examples in JavaScript fetch, Axios, Express.js, Python Flask, and nginx configuration. Use the snippet tabs in the detail panel to copy the exact code for your stack.

1xx4
2xx5
3xx5
4xx13
5xx7
🌐 Live Status Checker
CORS-safe — works for public APIs and your own endpoints
100
Continue
Server received request headers, client should proceed
Upload
101
Switching Protocols
Server is switching to the protocol specified in Upgrade header
WebSocket
102
Processing
Server has received and is processing the request (WebDAV)
REST
103
Early Hints
Server sends preliminary hints for browser to preload resources
Cache
200
OK
Request succeeded — standard success response
RESTSuccess📦 Cacheable
201
Created
Request succeeded and a new resource was created
RESTSuccess
202
Accepted
Request accepted but processing not yet complete
REST
204
No Content
Request succeeded but no response body
RESTSuccess
206
Partial Content
Server is delivering only part of the resource (range request)
UploadCache📦 Cacheable
301
Moved Permanently
Resource permanently moved to new URL — use Location header
RedirectCache📦 Cacheable
302
Found
Resource temporarily at different URL — method may change
Redirect
304
Not Modified
Resource not changed since last request — use cached version
Cache📦 Cacheable
307
Temporary Redirect
Temporary redirect — HTTP method preserved
Redirect
308
Permanent Redirect
Permanent redirect — HTTP method preserved
RedirectCache📦 Cacheable
400
Bad Request
Server cannot process request due to client error
RESTError
401
Unauthorized
Client must authenticate to get the requested response
AuthError↺ Retryable
403
Forbidden
Client is authenticated but not authorized for this resource
AuthError
404
Not Found
Server cannot find the requested resource
RESTError📦 Cacheable
405
Method Not Allowed
HTTP method not allowed for this resource
RESTError
408
Request Timeout
Server timed out waiting for the request
Error↺ Retryable
409
Conflict
Request conflicts with current state of the server
RESTError↺ Retryable
410
Gone
Resource permanently deleted — unlike 404, this is intentional
RESTErrorCache📦 Cacheable
411
Length Required
Server requires Content-Length header
UploadError
413
Content Too Large
Request body exceeds server size limit
UploadError
415
Unsupported Media Type
Server rejects request due to unsupported Content-Type
RESTError
422
Unprocessable Content
Request is well-formed but has semantic errors (validation failed)
RESTError
429
Too Many Requests
Client has sent too many requests (rate limited)
AuthErrorREST↺ Retryable
500
Internal Server Error
Server encountered unexpected error
Error↺ Retryable
501
Not Implemented
Server does not support the functionality required
Error📦 Cacheable
502
Bad Gateway
Upstream server returned invalid response
Error↺ Retryable
503
Service Unavailable
Server temporarily unavailable — overloaded or down for maintenance
Error↺ Retryable
504
Gateway Timeout
Upstream server did not respond in time
Error↺ Retryable
507
Insufficient Storage
Server unable to store the representation (WebDAV)
UploadError↺ Retryable
511
Network Authentication Required
Client needs to authenticate to gain network access (captive portal)
AuthError↺ Retryable
📡

Click any status code to see full details, code snippets, and usage guide

NavigateEsc CloseCtrl+F Search
Ctrl+F Focus search Navigate codesEsc Close detailCtrl+L Clear filters

Frequently Asked Questions

How do I handle different HTTP status codes in JavaScript fetch?

fetch() does not throw on 4xx/5xx — check response.ok (true for 200–299) or response.status directly. Use: if (!response.ok) { const err = await response.json(); throw new Error(err.message); }. For specific handling: if (response.status === 401) { redirect to login } else if (response.status === 429) { wait Retry-After, then retry }.

How do I return a specific HTTP status in Express.js?

Use res.status(code).json(body): res.status(200).json({data}), res.status(201).json({created}), res.status(204).send(), res.status(400).json({error}), res.status(404).json({message: "Not found"}). For async error handling, use next(err) with a global error handler that maps error types to status codes.

How do I return HTTP status codes in Python Flask?

Return a tuple: return jsonify({"data": result}), 200. Or use abort(): from flask import abort; abort(404). Or use make_response: response = make_response(jsonify(data), 201). For error handlers: @app.errorhandler(404) def not_found(e): return jsonify({"error": "Not found"}), 404.

How do I configure redirect status codes in nginx?

For 301: return 301 https://new-domain.com$request_uri; For 302: return 302 /new-path; For custom error pages: error_page 404 /404.html; error_page 500 502 503 504 /50x.html; For proxy pass error handling: proxy_intercept_errors on; error_page 502 @fallback.

How do I check an HTTP status code with curl command line?

Use curl -I (HEAD request) or curl -o /dev/null -w "%{http_code}" URL. For full verbose output: curl -v URL. For following redirects: curl -L URL. For timeout: curl --max-time 10 URL. Example: curl -o /dev/null -s -w "%{http_code}" https://api.example.com/endpoint — prints just the status code.

How do I test HTTP status codes in Postman or Thunder Client?

In Postman, the status code appears in the top-right of the response panel. Use Tests tab to assert: pm.response.to.have.status(200). In Thunder Client (VS Code), status shows in response header. For automated testing, use Jest + supertest: expect(response.status).toBe(201), or Cypress: cy.request("/api").its("status").should("eq", 200).

You might also like

Related Tools