Automatic 400 responses let an ASP.NET Core API reject invalid model data before the controller action runs. Applying [ApiController] adds a filter that checks model validation and returns Bad Request automatically. section 20.4
Using [ApiController] also supplies related API conventions:
- Attribute routing is required. section 20.4
- Complex action parameters are inferred from the request body, so JSON input typically needs no explicit [FromBody]. section 20.4
- Error responses can use ProblemDetails for consistent error data. section 20.4
Manual validation versus automatic validation
Without [ApiController], an action checks ModelState.IsValid and returns BadRequest(new ValidationProblemDetails(ModelState)). With [ApiController], that validation code can be removed; an invalid UpdateModel containing a missing required Name receives a 400 response automatically.
