Minimal APIs overview

Minimal APIs are a simplified approach for building fast HTTP APIs with ASP.NET Core. You can build fully functioning REST endpoints with minimal code and configuration. Skip traditional scaffolding and avoid unnecessary controllers by fluently declaring API routes and actions. For example, the following code creates an API at the root of the web app that returns the text, "Hello World!".

var app = WebApplication.Create(args);

app.MapGet("/", () => "Hello World!");


Most APIs accept parameters as part of the route.

var builder = WebApplication.CreateBuilder(args);

var app = builder.Build();

    (int userId, int bookId) => $"The user id is {userId} and book id is {bookId}");


That's all it takes to get started, but it's not all that's available. Minimal APIs support the configuration and customization needed to scale to multiple APIs, handle complex routes, apply authorization rules, and control the content of API responses. A good place to get started is Tutorial: Create a minimal API with ASP.NET Core.

Want to see some code examples?

For a full list of common scenarios with code examples, see Minimal APIs quick reference.

Want to jump straight into your first project?

Build a minimal API app with our tutorial: Tutorial: Create a minimal API with ASP.NET Core.