# Endpoint Filter

Code that runs around specific minimal API handlers.

## What is **Endpoint Filter**?

An **endpoint filter** runs code before and after a minimal API handler, for checks like validation or logging on just some endpoints.

```csharp
app.MapPost("/recipes", Create)
   .AddEndpointFilter(async (ctx, next) =>
   {
       var recipe = ctx.GetArgument<NewRecipe>(0);
       return string.IsNullOrWhiteSpace(recipe.Title) ? Results.BadRequest("Title is required") : await next(ctx);
   });
```

Level: Journeyman · [More ASP.NET Core terms at this level](https://www.ask-codey.com/glossary?category=aspnet-core&level=3)

Updated: September 27, 2026

Source: https://www.ask-codey.com/glossary/endpoint-filter
