The HTTP status code returned by a DELETE API depends on the outcome of the operation. In RESTful applications, the most commonly used status code is 204 No Content when the resource is successfully deleted and no response body is returned. Other status codes may be used based on specific business requirements and API design.
Common DELETE Response Status Codes
1. 204 No Content
@DeleteMapping("/{id}")
public ResponseEntity<Void> deleteEmployee(
@PathVariable Long id) {
employeeService.delete(id);
return ResponseEntity.noContent()
.build();
}HTTP/1.1 204 No Content
This is considered the preferred RESTful approach.
2. 200 OK
@DeleteMapping("/{id}")
public ResponseEntity<String> deleteEmployee(
@PathVariable Long id) {
employeeService.delete(id);
return ResponseEntity.ok(
"Employee deleted successfully");
}HTTP/1.1 200 OK
{
message": "Employee deleted successfully
}
3. 404 Not Found
@DeleteMapping("/{id}")
public ResponseEntity<String> deleteEmployee(
@PathVariable Long id) {
throw new EmployeeNotFoundException(
"Employee not found");
}HTTP/1.1 404 Not Found
{
message": "Employee not found
}
4. 403 Forbidden
HTTP/1.1 403 Forbidden
5. 401 Unauthorized
HTTP/1.1 401 Unauthorized
How DELETE Request Processing Works
Client Sends DELETE Request
|
Resource Found?
/ \
Yes No
| |
Delete Resource Return 404
|
Return 204 or 200
The status code should accurately represent the outcome of the operation.
DELETE /employees/101
Employee exists.
204 No Content
Employee exists and confirmation message is returned.
200 OK
{
message": "Employee deleted successfully
}
Employee does not exist.
404 Not Found
{
message": "Employee not found
}
Best Practice
This follows standard REST conventions and keeps APIs predictable.
A concise interview answer is
The most appropriate status code for a successful DELETE operation is 204 No Content when no response body is returned. If a confirmation message or additional information is included, 200 OK can be used. If the resource does not exist, 404 Not Found is typically returned.
Last updated: 11 November 2026
Previous question: What is ResponseEntity used for in Spring Boot?
Next question: What is Swagger?