What are the most important HTTP status codes in REST APIs?
Answer
HTTP status codes communicate the outcome of a request. 200 OK: success for GET/PUT/PATCH. 201 Created: resource created (POST), with a Location header pointing to the new resource. 204 No Content: success with no response body (DELETE). 400 Bad Request: client sent invalid data (missing required field, wrong type). 401 Unauthorized: authentication is required or credentials are invalid. 403 Forbidden: authenticated but not authorized to perform the action. 404 Not Found: resource does not exist. 409 Conflict: state conflict (duplicate email on creation). 422 Unprocessable Entity: request format is valid but contains semantic errors (validation failures). 429 Too Many Requests: rate limit exceeded. 500 Internal Server Error: unexpected server failure. 503 Service Unavailable: server temporarily unavailable (maintenance or overload).
Previous
What is idempotency and which HTTP methods are idempotent?
Next
What are REST resource naming conventions?
More REST API Design Questions
View all →- Beginner What is REST and what are its six architectural constraints?
- Beginner What are the main HTTP methods used in REST APIs and what do they do?
- Beginner What is idempotency and which HTTP methods are idempotent?
- Beginner What are REST resource naming conventions?
- Beginner What is the difference between path parameters and query parameters?