Scalar.AspNetCore 1.2.4

Scalar .NET API Reference Integration

This .NET package Scalar.AspNetCore provides an easy way to render a beautiful API reference based on an OpenAPI/Swagger. Made possible by the wonderful work of captainsafia on building the integration & docs written for the Scalar & .NET integration.

dotnet

🚀 Getting Started

  1. Install the package
dotnet add package Scalar.AspNetCore
  1. Add the using directive
using Scalar.AspNetCore;
  1. Configure your application

Add the following lines to your Program.cs for .NET 9:

builder.Services.AddOpenApi();

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

or for .NET 8 with Swashbuckle:

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

if (app.Environment.IsDevelopment())
{
    app.UseSwagger(options =>
    {
        options.RouteTemplate = "openapi/{documentName}.json";
    });
    app.MapScalarApiReference();
}

That's it! 🎉 Now you will see the Scalar UI when using the defaults by navigating to /scalar/v1 in your browser.

Configuration

The MapScalarApiReference method has an optional parameter that you can use to customize the behavior of the Scalar UI:

// Fluent api
app.MapScalarApiReference(options =>
{
    options
        .WithTitle("My custom API")
        .WithTheme(ScalarTheme.Mars)
        .WithSidebar(false)
        .WithDefaultHttpClient(ScalarTarget.CSharp, ScalarClient.HttpClient)
        .WithPreferredScheme("ApiKey")
        .WithApiKeyAuthentication(x => x.Token = "my-api-key");
});

// Object initializer
app.MapScalarApiReference(options =>
{
    options.Title = "My custom API";
    options.Theme = ScalarTheme.Mars;
    options.ShowSidebar = false;
    options.DefaultHttpClient = new(ScalarTarget.CSharp, ScalarClient.HttpClient);
    options.Authentication = new ScalarAuthenticationOptions
    {
        PreferredSecurityScheme = "ApiKey",
        ApiKey = new ApiKeyOptions
        {
            Token = "my-api-key"
        }
    };
});

For more possible options and their default values, check out the ScalarOptions.cs class.

It is also possible to configure the options via dependency injection, using the options pattern:

builder.Services.Configure<ScalarOptions>(options => options.Title = "My custom API");
// or
builder.Services.AddOptions<ScalarOptions>().BindConfiguration("Scalar");

[!NOTE]
Options which are set via the MapScalarApiReference method will take precedence over options set via dependency injection.

Building & Release

dotnet build
dotnet pack --configuration Release
# then ping marc until we set up ci auto release!

No packages depend on Scalar.AspNetCore.

.NET 8.0

  • No dependencies.

.NET 9.0

  • No dependencies.

Version Downloads Last updated
2.16.20 1 08/16/2026
2.16.19 1 08/16/2026
2.16.18 2 08/12/2026
2.16.17 2 08/12/2026
2.16.16 2 07/21/2026
2.16.15 2 07/21/2026
2.16.14 2 07/21/2026
2.16.13 2 07/21/2026
2.16.12 2 07/21/2026
2.16.11 3 07/11/2026
2.16.10 2 07/12/2026
2.16.9 2 07/12/2026
2.16.8 2 07/12/2026
2.16.7 1 07/12/2026
2.16.6 2 07/12/2026
2.16.5 2 07/12/2026
2.16.4 1 07/12/2026
2.16.3 1 07/12/2026
2.16.2 1 07/12/2026
2.16.1 2 07/12/2026
2.14.14 2 07/12/2026
2.14.13 2 07/12/2026
2.14.11 2 07/12/2026
2.14.10 2 07/12/2026
2.14.9 2 07/12/2026
2.14.8 2 07/12/2026
2.14.7 2 07/12/2026
2.14.6 2 07/12/2026
2.14.5 2 07/12/2026
2.14.4 2 07/12/2026
2.14.3 2 07/12/2026
2.14.2 1 07/12/2026
2.14.1 2 07/12/2026
2.14.0 2 07/12/2026
2.13.22 2 07/12/2026
2.13.21 2 07/12/2026
2.13.20 2 07/12/2026
2.13.19 2 07/12/2026
2.13.18 2 07/12/2026
2.13.17 2 07/12/2026
2.13.16 2 07/12/2026
2.13.15 2 07/12/2026
2.13.14 2 07/12/2026
2.13.13 2 07/12/2026
2.13.12 2 07/12/2026
2.13.11 2 07/12/2026
2.13.10 2 07/12/2026
2.13.9 2 07/12/2026
2.13.8 2 07/12/2026
2.13.7 1 07/12/2026
2.13.6 2 07/12/2026
2.13.5 2 07/12/2026
2.13.3 1 07/12/2026
2.13.2 1 07/12/2026
2.13.1 2 07/12/2026
2.13.0 2 07/12/2026
2.12.54 2 07/12/2026
2.12.53 2 07/12/2026
2.12.52 2 07/12/2026
2.12.51 2 07/12/2026
2.12.50 2 07/12/2026
2.12.49 2 07/12/2026
2.12.48 2 07/12/2026
2.12.47 2 07/12/2026
2.12.46 2 07/12/2026
2.12.45 2 07/12/2026
2.12.44 2 07/12/2026
2.12.43 2 07/12/2026
2.12.42 2 07/12/2026
2.12.41 2 07/12/2026
2.12.40 2 07/12/2026
2.12.39 2 07/12/2026
2.12.38 2 07/12/2026
2.12.37 2 07/12/2026
2.12.36 2 07/12/2026
2.12.35 2 07/12/2026
2.12.34 2 07/12/2026
2.12.33 2 07/12/2026
2.12.32 2 07/12/2026
2.12.31 2 07/12/2026
2.12.30 2 07/12/2026
2.12.29 2 07/12/2026
2.12.28 2 07/12/2026
2.12.27 2 07/12/2026
2.12.26 2 07/12/2026
2.12.25 2 07/12/2026
2.12.24 2 07/12/2026
2.12.23 2 07/12/2026
2.12.22 2 07/12/2026
2.12.21 1 07/12/2026
2.12.20 2 07/12/2026
2.12.19 2 07/12/2026
2.12.18 2 07/12/2026
2.12.17 2 07/12/2026
2.12.16 2 07/12/2026
2.12.15 2 07/12/2026
2.12.14 2 07/12/2026
2.12.13 2 07/12/2026
2.12.12 2 07/12/2026
2.12.11 2 07/12/2026
2.12.10 2 07/12/2026
2.12.9 2 07/12/2026
2.12.8 2 07/12/2026
2.12.7 2 07/12/2026
2.12.6 2 07/12/2026
2.12.5 2 07/12/2026
2.12.4 1 07/12/2026
2.12.3 1 07/12/2026
2.12.2 1 07/12/2026
2.12.1 2 07/12/2026
2.12.0 2 07/12/2026
2.11.10 2 07/12/2026
2.11.9 2 07/12/2026
2.11.8 2 07/12/2026
2.11.7 2 07/12/2026
2.11.6 2 07/12/2026
2.11.5 2 07/12/2026
2.11.4 2 07/12/2026
2.11.3 2 07/12/2026
2.11.2 1 07/12/2026
2.11.1 2 07/12/2026
2.11.0 2 07/12/2026
2.10.3 2 07/12/2026
2.10.1 2 07/12/2026
2.10.0 2 07/12/2026
2.9.0 1 07/12/2026
2.8.11 2 07/12/2026
2.8.10 2 07/12/2026
2.8.9 2 07/12/2026
2.8.8 1 07/12/2026
2.8.7 1 07/12/2026
2.8.6 2 07/12/2026
2.8.5 2 07/12/2026
2.8.4 1 07/12/2026
2.8.3 1 07/12/2026
2.8.2 1 07/12/2026
2.8.1 2 07/12/2026
2.8.0 1 07/12/2026
2.7.4 1 07/12/2026
2.7.3 1 07/12/2026
2.7.2 2 07/12/2026
2.7.1 1 07/12/2026
2.7.0 1 07/12/2026
2.6.9 1 07/12/2026
2.6.8 1 07/12/2026
2.6.7 1 07/12/2026
2.6.6 1 07/12/2026
2.6.5 1 07/12/2026
2.6.4 1 07/12/2026
2.6.3 1 07/12/2026
2.6.2 1 07/12/2026
2.6.1 2 07/12/2026
2.6.0 1 07/12/2026
2.5.6 1 07/12/2026
2.5.5 2 07/12/2026
2.5.3 1 07/12/2026
2.5.1 2 07/12/2026
2.5.0 1 07/12/2026
2.4.22 1 07/12/2026
2.4.21 2 07/12/2026
2.4.20 1 07/12/2026
2.4.19 1 07/12/2026
2.4.18 1 07/12/2026
2.4.17 2 07/12/2026
2.4.16 1 07/12/2026
2.4.15 2 07/12/2026
2.4.14 2 07/12/2026
2.4.13 1 07/12/2026
2.4.12 1 07/12/2026
2.4.11 2 07/12/2026
2.4.9 1 07/12/2026
2.4.8 1 07/12/2026
2.4.7 1 07/12/2026
2.4.6 1 07/12/2026
2.4.5 1 07/12/2026
2.4.4 1 07/12/2026
2.4.3 1 07/12/2026
2.4.2 2 07/12/2026
2.4.1 1 07/12/2026
2.3.1 1 07/12/2026
2.3.0 1 07/12/2026
2.2.7 2 07/12/2026
2.2.5 1 07/12/2026
2.2.4 2 07/12/2026
2.2.3 2 07/12/2026
2.2.2 1 07/12/2026
2.2.1 1 07/12/2026
2.2.0 2 07/12/2026
2.1.18 2 07/12/2026
2.1.17 2 07/12/2026
2.1.16 2 07/12/2026
2.1.15 2 07/12/2026
2.1.14 2 07/12/2026
2.1.13 2 07/12/2026
2.1.12 2 07/12/2026
2.1.11 2 07/12/2026
2.1.10 2 07/12/2026
2.1.9 2 07/12/2026
2.1.8 1 07/12/2026
2.1.7 1 07/12/2026
2.1.6 2 07/12/2026
2.1.5 2 07/12/2026
2.1.4 1 07/12/2026
2.1.3 1 07/12/2026
2.1.2 1 07/12/2026
2.1.1 2 07/12/2026
2.1.0 1 07/12/2026
2.0.36 1 07/12/2026
2.0.34 1 07/12/2026
2.0.33 2 07/12/2026
2.0.30 1 07/12/2026
2.0.29 2 07/12/2026
2.0.28 1 07/12/2026
2.0.27 2 07/12/2026
2.0.26 1 07/12/2026
2.0.25 2 07/12/2026
2.0.24 2 07/12/2026
2.0.23 2 07/12/2026
2.0.22 1 07/12/2026
2.0.21 2 07/12/2026
2.0.20 2 07/12/2026
2.0.19 2 07/12/2026
2.0.18 2 07/12/2026
2.0.17 2 07/12/2026
2.0.16 2 07/12/2026
2.0.15 2 07/12/2026
2.0.14 2 07/12/2026
2.0.12 2 07/12/2026
2.0.11 2 07/12/2026
2.0.10 2 07/12/2026
2.0.9 1 07/12/2026
2.0.8 1 07/12/2026
2.0.7 1 07/12/2026
2.0.6 1 07/12/2026
2.0.5 1 07/12/2026
2.0.4 1 07/12/2026
2.0.2 2 07/12/2026
2.0.1 1 07/12/2026
2.0.0 1 07/12/2026
1.2.76 1 07/12/2026
1.2.75 2 07/12/2026
1.2.74 2 07/12/2026
1.2.73 1 07/12/2026
1.2.72 2 07/12/2026
1.2.71 1 07/12/2026
1.2.70 2 07/12/2026
1.2.69 2 07/12/2026
1.2.68 2 07/12/2026
1.2.67 2 07/12/2026
1.2.66 2 07/12/2026
1.2.65 2 07/12/2026
1.2.64 2 07/12/2026
1.2.63 1 07/12/2026
1.2.61 2 07/12/2026
1.2.60 2 07/12/2026
1.2.59 2 07/12/2026
1.2.58 2 07/12/2026
1.2.57 2 07/12/2026
1.2.56 2 07/12/2026
1.2.55 2 07/12/2026
1.2.54 2 07/12/2026
1.2.53 2 07/12/2026
1.2.52 2 07/12/2026
1.2.51 2 07/12/2026
1.2.50 2 07/12/2026
1.2.49 2 07/12/2026
1.2.48 2 07/12/2026
1.2.47 2 07/12/2026
1.2.46 2 07/12/2026
1.2.45 2 07/12/2026
1.2.44 1 07/12/2026
1.2.43 2 07/12/2026
1.2.42 2 07/12/2026
1.2.41 2 07/12/2026
1.2.40 2 07/12/2026
1.2.39 2 07/12/2026
1.2.38 2 07/12/2026
1.2.37 2 07/12/2026
1.2.36 2 07/12/2026
1.2.35 2 07/12/2026
1.2.34 2 07/12/2026
1.2.33 2 07/12/2026
1.2.32 2 07/12/2026
1.2.31 2 07/12/2026
1.2.30 2 07/12/2026
1.2.29 2 07/12/2026
1.2.28 2 07/12/2026
1.2.27 2 07/12/2026
1.2.26 1 07/12/2026
1.2.25 2 07/12/2026
1.2.24 2 07/12/2026
1.2.23 2 07/12/2026
1.2.22 2 07/12/2026
1.2.21 2 07/12/2026
1.2.20 2 07/12/2026
1.2.19 2 07/12/2026
1.2.18 2 07/12/2026
1.2.17 2 07/12/2026
1.2.16 2 07/12/2026
1.2.15 2 07/12/2026
1.2.14 2 07/12/2026
1.2.13 2 07/12/2026
1.2.12 2 07/12/2026
1.2.11 2 07/12/2026
1.2.10 2 07/12/2026
1.2.9 2 07/12/2026
1.2.8 1 07/12/2026
1.2.7 1 07/12/2026
1.2.6 2 07/12/2026
1.2.5 2 07/12/2026
1.2.4 1 07/12/2026
1.2.3 1 07/12/2026
1.1.2 2 07/12/2026
1.1.1 2 07/12/2026
1.0.1 2 07/12/2026