Scalar.AspNetCore 1.2.5

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.8.4 2 09/19/2025
2.8.3 2 09/18/2025
2.8.2 2 09/18/2025
2.8.1 2 09/19/2025
2.8.0 2 09/19/2025
2.7.4 2 09/18/2025
2.7.3 2 09/18/2025
2.7.2 2 09/18/2025
2.7.1 2 09/19/2025
2.7.0 2 09/19/2025
2.6.9 2 09/19/2025
2.6.8 2 09/19/2025
2.6.7 2 09/19/2025
2.6.6 2 09/18/2025
2.6.5 2 09/18/2025
2.6.4 3 07/31/2025
2.6.3 3 07/31/2025
2.6.2 2 09/18/2025
2.6.1 2 09/19/2025
2.6.0 2 09/19/2025
2.5.6 2 09/19/2025
2.5.5 2 09/18/2025
2.5.3 2 09/18/2025
2.5.1 2 09/19/2025
2.5.0 2 09/18/2025
2.4.22 3 07/31/2025
2.4.21 3 07/31/2025
2.4.20 3 07/31/2025
2.4.19 3 07/31/2025
2.4.18 3 07/31/2025
2.4.17 3 07/31/2025
2.4.16 3 07/31/2025
2.4.15 3 07/31/2025
2.4.14 3 07/31/2025
2.4.13 3 07/31/2025
2.4.12 3 07/31/2025
2.4.11 3 07/31/2025
2.4.9 2 09/19/2025
2.4.8 2 09/18/2025
2.4.7 3 06/03/2025
2.4.6 2 06/03/2025
2.4.5 3 06/03/2025
2.4.4 3 06/03/2025
2.4.3 3 06/03/2025
2.4.2 3 06/03/2025
2.4.1 3 06/03/2025
2.3.1 3 06/03/2025
2.3.0 3 06/03/2025
2.2.7 3 06/03/2025
2.2.5 3 06/03/2025
2.2.4 3 06/03/2025
2.2.3 3 06/03/2025
2.2.2 3 06/03/2025
2.2.1 3 06/03/2025
2.2.0 3 06/03/2025
2.1.18 4 06/04/2025
2.1.17 4 06/04/2025
2.1.16 4 06/04/2025
2.1.15 4 06/04/2025
2.1.14 4 06/04/2025
2.1.13 4 06/04/2025
2.1.12 4 06/04/2025
2.1.11 4 06/04/2025
2.1.10 4 06/04/2025
2.1.9 3 06/03/2025
2.1.8 3 06/03/2025
2.1.7 3 06/03/2025
2.1.6 3 06/03/2025
2.1.5 3 06/03/2025
2.1.4 3 06/03/2025
2.1.3 3 06/03/2025
2.1.2 3 06/03/2025
2.1.1 3 06/03/2025
2.1.0 3 06/03/2025
2.0.36 4 06/04/2025
2.0.34 4 06/04/2025
2.0.33 4 06/04/2025
2.0.30 5 06/04/2025
2.0.29 4 06/04/2025
2.0.28 4 06/04/2025
2.0.27 4 06/04/2025
2.0.26 4 06/04/2025
2.0.25 4 06/04/2025
2.0.24 4 06/04/2025
2.0.23 4 06/04/2025
2.0.22 4 06/04/2025
2.0.21 4 06/04/2025
2.0.20 4 06/04/2025
2.0.19 4 06/04/2025
2.0.18 5 02/25/2025
2.0.17 5 02/25/2025
2.0.16 5 02/25/2025
2.0.15 5 02/25/2025
2.0.14 5 02/25/2025
2.0.12 6 02/09/2025
2.0.11 5 02/25/2025
2.0.10 5 02/25/2025
2.0.9 4 02/25/2025
2.0.8 4 02/25/2025
2.0.7 4 02/25/2025
2.0.6 4 02/25/2025
2.0.5 4 02/25/2025
2.0.4 4 02/25/2025
2.0.2 4 02/25/2025
2.0.1 4 02/25/2025
2.0.0 4 02/25/2025
1.2.76 5 02/25/2025
1.2.75 6 02/25/2025
1.2.74 5 02/25/2025
1.2.73 5 02/25/2025
1.2.72 5 02/25/2025
1.2.71 5 02/25/2025
1.2.70 5 02/25/2025
1.2.69 5 02/25/2025
1.2.68 5 02/25/2025
1.2.67 5 02/25/2025
1.2.66 5 02/25/2025
1.2.65 5 02/25/2025
1.2.64 5 02/25/2025
1.2.63 5 02/25/2025
1.2.61 5 02/25/2025
1.2.60 5 02/25/2025
1.2.59 5 02/25/2025
1.2.58 5 02/25/2025
1.2.57 5 02/25/2025
1.2.56 5 02/25/2025
1.2.55 5 02/25/2025
1.2.54 5 02/25/2025
1.2.53 5 02/25/2025
1.2.52 5 02/25/2025
1.2.51 5 02/25/2025
1.2.50 5 02/25/2025
1.2.49 5 02/25/2025
1.2.48 5 02/25/2025
1.2.47 5 02/25/2025
1.2.46 4 06/04/2025
1.2.45 5 02/25/2025
1.2.44 5 02/25/2025
1.2.43 5 02/25/2025
1.2.42 6 02/25/2025
1.2.41 5 02/25/2025
1.2.40 5 02/25/2025
1.2.39 5 02/25/2025
1.2.38 5 02/25/2025
1.2.37 5 02/25/2025
1.2.36 5 02/25/2025
1.2.35 5 02/25/2025
1.2.34 5 02/25/2025
1.2.33 6 02/25/2025
1.2.32 5 02/25/2025
1.2.31 5 02/25/2025
1.2.30 5 02/25/2025
1.2.29 5 02/25/2025
1.2.28 5 02/25/2025
1.2.27 5 02/25/2025
1.2.26 5 02/25/2025
1.2.25 5 02/25/2025
1.2.24 5 02/25/2025
1.2.23 5 02/25/2025
1.2.22 5 02/25/2025
1.2.21 5 02/25/2025
1.2.20 5 02/25/2025
1.2.19 5 02/25/2025
1.2.18 5 02/25/2025
1.2.17 5 02/25/2025
1.2.16 5 02/25/2025
1.2.15 5 02/25/2025
1.2.14 5 02/25/2025
1.2.13 5 02/25/2025
1.2.12 6 02/25/2025
1.2.11 5 02/25/2025
1.2.10 5 02/25/2025
1.2.9 4 02/25/2025
1.2.8 4 02/25/2025
1.2.7 4 02/25/2025
1.2.6 4 02/25/2025
1.2.5 4 02/25/2025
1.2.4 4 02/25/2025
1.2.3 4 02/25/2025
1.1.2 4 02/25/2025
1.1.1 4 02/25/2025
1.0.1 4 02/25/2025