What are HTTP status codes 200, 201, 400, 401, 404, 500, and 503 in APIs?
Status codes are a compact signal on the first line of the response. 2xx means success: 200 OK for many reads, 201 Created for successful creates with a resource. 4xx means the client (or the request) is wrong: 400 bad syntax or validation, 401 often unauthenticated, 403 forbidden, 404 not found. 5xx means the server failed: 500 generic error, 503 often unavailable. Your API should return a consistent error body, not just a code, so tools and humans can debug. Never rely on a single number alone for business success - read the body and design idempotent retries for safe operations.
HTTP/1.1 201 CreatedLocation: /api/orders/55
HTTP/1.1 400 Bad Request{ "error": "invalid email" }Start simple: try this concept in a tiny project before moving to advanced tools.
httpapierrors
Want to check this topic right now?
Check this question