[ApiController]

An attribute that switches on web API conventions for a controller, including automatic 400 responses for invalid models and inferred binding sources.

In more detail

It is placed on the controller class, or once on an assembly for every controller in it. With it, validation failures become a Problem Details response before the action body runs, with no if statement in every action.

Related terms

Taught in

References