HTTP 状态码参考
HTTP 状态码完整列表
1xx 1xx 信息
2xx 2xx 成功
3xx 3xx 重定向
4xx 4xx 客户端错误
5xx 5xx 服务器错误
关于此工具
HTTP 状态码可检索参考,按 1xx-5xx 分类列出,每条含正式名称和简短说明,快速回答 "422 到底什么意思" 或 "应该返 401 还是 403"。
使用方法
- Type a code (404), partial name (gateway), or keyword (auth) into the search box.
- Browse the filtered list grouped by status class.
- Read the canonical name and one-line description for the matching codes.
- Use the colour coding to quickly spot 4xx (client error) vs 5xx (server error).
- Reference the result in your API design, log analysis, or error handling code.
常见用例
- Choosing the right status code for a new REST API endpoint.
- Investigating a strange status code (e.g., 418, 451) you saw in a server log.
- Deciding between 401 Unauthorized and 403 Forbidden for an auth flow.
- Documenting expected error responses in an OpenAPI / Swagger spec.
- Understanding why a CDN returned 503 vs 504 during an outage.
- Mapping HTTP errors to user-facing error messages with consistent semantics.
常见问题
Q. When should I return 401 vs 403?
A. 401 means "not authenticated, present credentials"; 403 means "authenticated but not allowed". If the client has no valid session, send 401. If they are logged in but lack permission, send 403.
Q. Is 422 the same as 400?
A. Both are 4xx, but 400 means the request itself is malformed (bad JSON, missing header) while 422 means the request is well-formed but semantically invalid (validation failed).
Q. Should I always use 200 for successful POSTs?
A. 201 Created is more precise when you create a new resource and 204 No Content when you succeed but return no body. 200 is correct when you do return a representation.
Q. What does 429 mean for rate limiting?
A. 429 Too Many Requests signals the client should slow down. Pair it with a Retry-After header so clients know when to try again.