Skip to content
  1. Blog
  2. Learning

Controllers vs Minimal APIs in .NET 10: What to Choose and Why

TL;DR: Controllers and Minimal APIs can build the same web APIs in .NET (Microsoft’s developer platform), and Microsoft recommends Minimal APIs for new projects. Controllers offer built-in structure for large, long-term projects. Minimal APIs provide lean, explicit design suited for focused services if you enforce structure. Choose based on maintainability and team workflow, not performance claims.

This guide compares two ways to write Hypertext Transfer Protocol (HTTP) endpoints in ASP.NET Core, the .NET web framework named after Active Server Pages (ASP). Every sample was compiled and run on the .NET 10 software development kit (SDK), version 10.0.115, in November 2026.

Controller-based APIs, which use the [ApiController] attribute, are the strongest default for large, long-lived APIs. They ship with conventions, discoverability and mature extension points for shared policies.

Minimal APIs are a great fit for smaller or focused services, such as microservices and internal APIs. Choose them for an endpoint-first model, and enforce structure with route groups, endpoint filters and feature modules.

In most real workloads, this choice affects maintainability more than raw performance. Microsoft’s guides to controller-based web APIs and Minimal APIs cover each style.

Microsoft ended .NET 8 support on 10 November 2026, so this post targets .NET 10 and flags .NET 8 differences.

What’s the difference between controllers and Minimal APIs?

The minimal API vs controller based API difference is where your endpoint code lives. It also decides what the framework does for you by default.

In C#, the minimal API vs controllers choice changes how you organize code, not which HTTP features you can reach.

What are controllers in ASP.NET Core Web API terms?

Controllers map routes to action methods inside the Model-View-Controller (MVC) pipeline. That pipeline adds these parts for you, as Microsoft’s Web API documentation describes:

  • Controller discovery
  • Model binding conventions
  • MVC filters
  • Action results such as Ok() and NotFound()

What are Minimal APIs in ASP.NET Core terms?

Minimal APIs map routes directly to handlers with MapGet, MapPost and similar methods. They use the same building blocks as controllers: hosting, routing, dependency injection (DI), authentication and middleware.

You compose those blocks explicitly, per endpoint or per route group.

Which one does Microsoft recommend?

Microsoft’s APIs overview recommends Minimal APIs for new projects. It cites simpler syntax, less overhead and easier testing.

The same page suggests controllers when you need what they provide out of the box:

  • Custom model binders
  • Advanced validation through IModelValidator
  • Application parts or the application model
  • Open Data Protocol (OData) support

You make the dotnet minimal API vs controller choice when you create the project. dotnet new webapi creates a Minimal API project, and dotnet new webapi --use-controllers creates a controller project.

When should you choose controllers?

Pick controllers when most of these are true:

  • You expect many endpoints across multiple domains or resources.
  • You want conventions by default for routing, binding and action results.
  • You rely on MVC filters and want new developers to find things fast.
  • You need consistent responses, versioning and shared policies with less custom glue.
  • You need custom model binders, IModelValidator, application parts or OData.

Checkpoint: If your API will have lots of endpoints and lots of contributors, controllers reduce the amount of “team-invented framework.”

When should you choose Minimal APIs?

Pick Minimal APIs when most of these are true:

  • Your API is a focused service (microservice/edge/internal) with a smaller surface area.
  • You prefer configuring behavior fluently per endpoint or per route group.
  • You’ll keep handlers thin and enforce boundaries using feature modules and route groups.
  • You want endpoint-specific behavior through endpoint filters.
  • You plan to publish with native ahead-of-time (AOT) compilation, which MVC controllers do not support.

Checkpoint: If you choose Minimal APIs, commit to structure (route groups + modules). “Minimal” should mean less ceremony, not less discipline.

What pipeline mental model helps you compare them quickly?

How does a controller request flow?

Controllers: Routing → controller selection → MVC filters → action → result

MVC filters are the built-in extension point at each stage.

How does a Minimal API request flow?

Minimal APIs: Routing → handler → (optional) endpoint filters → result

Endpoint filters wrap the handler, so they can check its arguments before it runs.

How do you implement the same endpoint in both styles?

Below are equivalent “get widget by ID” examples. Both assume a Widget record and an IWidgetService registered with DI, for example builder.Services.AddScoped<IWidgetService, WidgetService>().

Task: Create the controller endpoint

using Microsoft.AspNetCore.Mvc;

[ApiController]
[Route("api/widgets")]
public class WidgetsController : ControllerBase
{
    private readonly IWidgetService _service;

    public WidgetsController(IWidgetService service) => _service = service;

    [HttpGet("{id:guid}")]
    public async Task<ActionResult<Widget>> Get(Guid id, CancellationToken ct)
    {
        var widget = await _service.GetAsync(id, ct);
        return widget is null ? NotFound() : Ok(widget);
    }
}

The controller also needs builder.Services.AddControllers() and app.MapControllers() in Program.cs.

Task: Create the Minimal API endpoint

app.MapGet("/api/min/widgets/{id:guid}", async (
    Guid id,
    IWidgetService service,
    CancellationToken ct) =>
    {
        var widget = await service.GetAsync(id, ct);
        return widget is null ? Results.NotFound() : Results.Ok(widget);
    });

One difference shows up when the widget is missing. The controller’s NotFound() returns 404 with a Problem Details JavaScript Object Notation (JSON) body, because [ApiController] adds one to error results. The Minimal API returns 404 with an empty body unless you register AddProblemDetails().

Checkpoint: The main architectural similarity: both should be thin HTTP layers calling services.

How do DI and testability compare between controllers and Minimal APIs?

Outcome: Both use the same DI container, so keep handlers and actions thin either way.

ASP.NET Core’s fundamentals apply equally to both styles.

  • Controllers commonly use constructor injection; this encourages thin controllers by default.
  • Minimal APIs commonly inject services through handler parameters.
  • In both styles, business logic belongs in services you can test without HTTP.

Checkpoint: If you can unit-test your business logic without HTTP, you’re doing it right.

How should you handle validation and consistent errors in each style?

How do controllers typically do validation?

Controllers commonly rely on model binding and validation conventions. Many teams also standardize error responses using Problem Details.

How do Minimal APIs typically enforce validation and consistent errors?

Minimal APIs can use the same validation approaches. Endpoint filters are especially useful to enforce one validation and error policy across a route group.

Task: Return ProblemDetails from a Minimal API validation filter (consistent error shape)

using Microsoft.AspNetCore.Http;

var group = app.MapGroup("/api/min/widgets");

group.MapPost("/", async (CreateWidgetRequest req, IWidgetService service, CancellationToken ct) =>
{
    await service.CreateAsync(req.Name, ct);
    return Results.Created("/api/min/widgets/...", null);
})
.AddEndpointFilter(async (context, next) =>
{
    var req = context.GetArgument<CreateWidgetRequest>(0);

    if (string.IsNullOrWhiteSpace(req.Name))
    {
        return Results.Problem(
            title: "Validation failed",
            detail: "Name is required.",
            statusCode: StatusCodes.Status400BadRequest,
            type: "https://www.rfc-editor.org/rfc/rfc9110"
        );
    }

    return await next(context);
});

Task: Turn on built-in validation in .NET 10

From .NET 10, Minimal APIs can validate DataAnnotations attributes for you. Call AddValidation, and a failed request gets 400 Bad Request with the errors (What’s new in ASP.NET Core in .NET 10).

using System.ComponentModel.DataAnnotations;

builder.Services.AddValidation();

// ...

app.MapPost("/api/min/widgets", (CreateWidgetRequest req) =>
    Results.Created($"/api/min/widgets/{Guid.NewGuid()}", null));

public record CreateWidgetRequest([Required, StringLength(100)] string Name);

AddValidation does not exist in .NET 8. On .NET 8, validate in the handler, in a filter or with a library.

Checkpoint: If consumers get the same error format from every endpoint, you’ve reduced client bugs and support costs.

What OpenAPI and Swagger setup do both styles need?

Both controllers and Minimal APIs can generate an OpenAPI document. From .NET 9, Microsoft’s Microsoft.AspNetCore.OpenApi package does it, and the .NET 10 webapi template already references it.

Task: Use the built-in OpenAPI document (.NET 9 and later)

builder.Services.AddOpenApi();

var app = builder.Build();

if (app.Environment.IsDevelopment())
{
    app.MapOpenApi();
}

The document is served at /openapi/v1.json and lists controller actions and Minimal API endpoints alike (What’s new in ASP.NET Core in .NET 9).

Controllers automatically expose metadata via MVC conventions. Minimal APIs expose metadata through endpoint mapping and attributes or fluent configuration.

Checkpoint: OpenAPI support is equal in capability. Controllers rely more on conventions; Minimal APIs rely more on explicit metadata.

How do you add a Swagger test page to either style?

The .NET 8 webapi template used the open-source Swashbuckle.AspNetCore package for a Swagger test page. The .NET 10 template no longer includes it.

Run dotnet add package Swashbuckle.AspNetCore before you use the code below on .NET 10. If the package is missing, the build fails with AddSwaggerGen not found.

builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

var app = builder.Build();

if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}
  • AddEndpointsApiExplorer() enables endpoint discovery (especially important for Minimal APIs).
  • AddSwaggerGen() generates the OpenAPI specification.
  • UseSwagger() and UseSwaggerUI() serve the document and the test page.

Use this setup instead of the built-in one, not alongside it. In our .NET 10 test, the two packages required conflicting versions of Microsoft.OpenApi.

How does authorization differ between controllers and Minimal APIs?

Outcome: Same underlying authorization system; different syntax.

ASP.NET Core authorization works the same underneath, as the authorization overview explains.

  • Controllers: use [Authorize] attributes.
  • Minimal APIs: use .RequireAuthorization() at endpoint or route-group level.
  • Minimal APIs also accept [Authorize] on the handler.

Checkpoint: Prefer policy at the highest sensible level (controller or route group), then override only where needed.

Our ASP.NET Core JSON Web Token (JWT) authentication guide shows how to issue and check the tokens behind those policies.

What does [ApiController] automatically do that Minimal APIs do not?

With [ApiController], ASP.NET Core turns on several behaviors by default. The ApiController attribute section of the docs lists them:

  • Attribute routing becomes a requirement for every action.
  • Model validation failures get an automatic 400 Bad Request in Problem Details format.
  • Binding sources such as [FromBody], [FromRoute] and [FromQuery] are inferred.
  • Error results with a status code of 400 or higher get a Problem Details body.

Example:

[ApiController]
[Route("api/widgets")]
public class WidgetsController : ControllerBase
{
    [HttpPost]
    public IActionResult Create(CreateWidgetRequest request)
    {
        // If ModelState is invalid,
        // framework automatically returns 400 with ProblemDetails
        return Ok();
    }
}

Minimal APIs enforce model validation only when you add it, in one of these ways:

  • Call AddValidation (.NET 10 and later).
  • Validate manually in the handler.
  • Use endpoint filters or a validation library.
  • Add custom middleware.

Checkpoint: Controllers provide governance by default. Minimal APIs require explicit enforcement.

What are the performance differences between Minimal API and traditional ASP.NET Core controllers?

Minimal APIs may reduce some framework overhead, and Microsoft lists reduced overhead as a reason to start with them. In many real APIs, though, most time goes to:

  • Database and network calls
  • Authentication
  • Serialization

The larger measurable gap is Native AOT. From .NET 8, Minimal APIs have partial Native AOT support, and MVC has none (ASP.NET Core support for Native AOT).

A Native AOT app can need less start-up time, memory and disk space. That matters for containers that start new instances often.

Checkpoint: If you haven’t measured p50/p95 latency and database round trips, you don’t yet know whether “API style” matters for your performance.

How do you keep Minimal APIs maintainable as the codebase grows?

Task: Use a route-group + feature-module pattern (avoid Program.cs sprawl)

A common maintainable pattern is: Program.cs wires things; feature modules map endpoints with route groups.

public static class WidgetEndpoints
{
    public static RouteGroupBuilder MapWidgetEndpoints(this IEndpointRouteBuilder app)
    {
        var group = app.MapGroup("/api/min/widgets")
            .RequireAuthorization();

        group.MapGet("/{id:guid}", GetById);
        group.MapPost("/", Create);

        return group;
    }

    private static async Task<IResult> GetById(Guid id, IWidgetService service, CancellationToken ct)
        => (await service.GetAsync(id, ct)) is { } w ? Results.Ok(w) : Results.NotFound();

    // Return a Location header that points to the new widget
    private static async Task<IResult> Create(CreateWidgetRequest req, IWidgetService service, CancellationToken ct)
    {
        var id = await service.CreateAsync(req.Name, ct);
        return Results.Created($"/api/min/widgets/{id}", null);
    }
}

Program.cs then needs one line: app.MapWidgetEndpoints();. RequireAuthorization() with no policy uses the default policy, so register an authentication scheme first.

Checkpoint: If you can find all “Widget” endpoints in one place without scrolling Program.cs, your Minimal API organization is working.

How can you make Minimal APIs Production-Grade in large codebases?

If you choose Minimal APIs, commit to structure. The module above already covers the first three habits:

  • Use route groups per feature
  • Move mappings into feature modules
  • Apply authorization at group level

These three keep behavior consistent across features:

  • Use endpoint filters consistently
  • Centralize error handling
  • Standardize response types

Our guide to ASP.NET Core Minimal APIs in production builds a full starter with these habits, plus OpenAPI and an integration test.

“Minimal” should mean less ceremony, not less discipline.

What practical decision matrix can help you choose quickly?

Use this table to decide when to use minimal API vs controller endpoints, then weigh your team’s habits.

Scenario Recommended Approach
Large enterprise API Controllers
Many teams contributing Controllers
Heavy use of filters Controllers
Strict governance requirements Controllers
Custom model binders, application parts or OData Controllers
Small microservice Minimal APIs
Focused internal API Minimal APIs
Explicit per-endpoint composition preferred Minimal APIs
Very lean edge service Minimal APIs
Native AOT publishing Minimal APIs

Both styles can build most APIs. The choice is about default structure vs explicit composition.

Conclusion: Should you choose Controllers or Minimal APIs in .NET 10?

Controllers and Minimal APIs are both fully supported, production-ready approaches in .NET 10. Microsoft recommends Minimal APIs for new projects, while controllers remain the better fit when you need their built-in MVC features or conventions.

Controllers provide conventions by default. They are a strong default for large, long-lived APIs with many contributors.

Minimal APIs offer explicit, endpoint-first composition. They work well for focused services, as long as you enforce structure through route groups, modules and shared policies.

Performance differences are usually small next to database, network and serialization costs, unless you need Native AOT. Controller vs Minimal API is also not a one-way choice, since both styles can run in the same app.

In short:

  • Choose Controllers when you want built-in structure and consistency.
  • Choose Minimal APIs when you want lean composition and are willing to design structure intentionally.
  • Choose by your team, domain complexity and long-term ownership model.

Where do you go next after choosing controllers vs Minimal APIs?

Pick the style, keep handlers thin, and then test your endpoints against a real API.

Frequently asked questions

Is a Minimal API still a REST API?

It can be. Representational state transfer (REST) is about design principles; Minimal APIs are an implementation model. For the design side, Microsoft's API design guide in the Azure Architecture Center is a solid baseline.

What is the difference between a minimal API vs controller based API?

The difference is where the endpoint code lives and what runs by default. A controller groups actions in a class and runs them through the MVC pipeline. A Minimal API maps each route to a handler and adds behavior per endpoint or route group.

Do Minimal APIs support OpenAPI/Swagger?

Yes, both styles can generate OpenAPI. From .NET 9, call AddOpenApi and MapOpenApi from the Microsoft.AspNetCore.OpenApi package. For a Swagger test page, add the Swashbuckle.AspNetCore package, which the .NET 10 webapi template no longer includes.

Should you migrate existing controllers to Minimal APIs?

Only with a clear reason, such as team preference, a better fit for your endpoints or a Native AOT target. Profile your API first, since speed alone rarely justifies a move. Both styles can run in the same app, so you can move one feature at a time.

Is .NET 8 still supported for new APIs?

No. Microsoft ended support for .NET 8 on 10 November 2026, according to the release index in the dotnet/core repository. .NET 10 is the current long-term support release, supported until 14 November 2028.

Do controllers and Minimal APIs use the same authorization?

Yes. Both use the same ASP.NET Core authorization policies. Controllers use the [Authorize] attribute. Minimal APIs use RequireAuthorization() on an endpoint or route group, or [Authorize] on the handler.

Are endpoint filters the same as MVC filters?

No. They solve similar cross-cutting concerns, but they're different mechanisms designed for different pipeline shapes. When both styles need the same logic, you can attach an endpoint filter to controller actions with AddEndpointFilter.

Which features still need controllers?

Microsoft names four areas where controllers help out of the box. They are custom model binders, advanced validation through IModelValidator, application parts and OData support. You can rebuild most of them in Minimal APIs with your own code.

Priya Vinayagam

Priya Vinayagam is a Product Manager at BoldSign and an active full-stack developer at Syncfusion, with four years of hands-on experience across .NET and JavaScript. She writes practical, performance-focused technical articles that help developers tackle real-world challenges. Known for looking beyond the obvious, Priya brings a builder’s mindset to every post—breaking down complex problems into clear, actionable solutions. Connect with her on LinkedIn.

More posts by Priya Vinayagam
Get started

Sign up for your free trial today!

Start free trial
  • 30-day free trial
  • No credit card required