Kaya.ApiExplorer 2.3.0

dotnet add package Kaya.ApiExplorer --version 2.3.0
                    
NuGet\Install-Package Kaya.ApiExplorer -Version 2.3.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Kaya.ApiExplorer" Version="2.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Kaya.ApiExplorer" Version="2.3.0" />
                    
Directory.Packages.props
<PackageReference Include="Kaya.ApiExplorer" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Kaya.ApiExplorer --version 2.3.0
                    
#r "nuget: Kaya.ApiExplorer, 2.3.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Kaya.ApiExplorer@2.3.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Kaya.ApiExplorer&version=2.3.0
                    
Install as a Cake Addin
#tool nuget:?package=Kaya.ApiExplorer&version=2.3.0
                    
Install as a Cake Tool

Kaya API Explorer

A lightweight, Swagger-like API documentation tool for .NET applications that automatically scans your HTTP endpoints and displays them in a beautiful, interactive UI.

Features

  • Automatic Discovery - Scans controllers, Minimal API endpoints, and routes using reflection
  • Interactive UI - Test endpoints directly from the browser with real-time responses
  • Authentication - Support for Bearer tokens, API keys, OAuth 2.0, and cookies
  • SignalR Debugging - Real-time hub testing with method invocation and event monitoring
  • XML Documentation - Automatically reads and displays your code comments
  • Code Export - Generate request snippets in multiple programming languages
  • Performance Metrics - Track request duration and response size
  • Request History - Save and reload previous requests from the UI for faster retesting
  • Data Annotations - Validation constraints from model attributes surfaced in the UI
  • Multiple Response Codes - Full [ProducesResponseType] support with per-status-code schemas

Quick Start

1. Install the Package

dotnet add package Kaya.ApiExplorer

2. Configure Your Application

Add Kaya API Explorer to your Program.cs:

using Kaya.ApiExplorer.Extensions;

var builder = WebApplication.CreateBuilder(args);

// Add services
builder.Services.AddControllers();
builder.Services.AddKayaApiExplorer(); 

var app = builder.Build();

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

app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();

app.Run();

3. Access the UI

Navigate to http://localhost:5000/kaya (or your app's URL) to view your API documentation.

Demo Project

This repository includes a demo project (Demo.WebApi) that showcases the API Explorer with sample endpoints for users and products.

To run the demo:

cd src/Demo.WebApi
dotnet run

Then navigate to http://localhost:5121/kaya to see the API Explorer in action.

How It Works

Kaya API Explorer uses .NET reflection to scan your application's endpoints at runtime. It:

  1. Discovers Endpoints: Finds all ControllerBase controllers and Minimal API routes (MapGet, MapPost, etc.)
  2. Analyzes Actions: Examines public methods, their HTTP attributes, and [ProducesResponseType] declarations
  3. Extracts Metadata: Gathers parameters, return types, routing, and Data Annotations validation constraints
  4. Generates Documentation: Creates a fully valid OpenAPI 3.0 JSON representation of your API
  5. Serves UI: Provides a beautiful web interface to explore the documentation and interact with the endpoints

API Information Captured

For each endpoint, Kaya captures:

  • HTTP Method (GET, POST, PUT, DELETE, etc.)
  • Route Path with parameters
  • Controller and Action Names (or delegate name for Minimal APIs)
  • Parameters with types, sources (query, body, route, header, cookie), and requirements
  • Data Annotation Constraints ([Required], [Range], [StringLength], [EmailAddress], etc.)
  • Response Types and descriptions per status code
  • Status Codes declared via [ProducesResponseType]

Configuration

You can customize Kaya API Explorer in several ways:

Basic Configuration

// Use default settings (route: "/kaya", theme: "light")
builder.Services.AddKayaApiExplorer();

// Customize route prefix and theme
builder.Services.AddKayaApiExplorer(routePrefix: "/api-explorer", defaultTheme: "dark");

Documentation Metadata

Configure options.Documentation to customise the metadata shown in the UI and in the exported OpenAPI spec. All fields are optional.

builder.Services.AddKayaApiExplorer(options =>
{
    options.Documentation.Title = "Acme Orders API";
    options.Documentation.Version = "v3";
    options.Documentation.Description = "Manages orders, line items, and fulfilment workflows.";
    options.Documentation.TermsOfService = "https://acme.com/terms";

    options.Documentation.Contact = new ContactOptions
    {
        Name = "Acme API Support",
        Email = "api@acme.com",
        Url = "https://acme.com/support"
    };

    options.Documentation.License = new LicenseOptions
    {
        Name = "MIT",
        Url = "https://opensource.org/licenses/MIT"
    };

    options.Documentation.Servers =
    [
        new ServerOptions { Url = "https://api.acme.com/v3", Description = "Production" },
        new ServerOptions { Url = "http://localhost:5000",   Description = "Local" }
    ];
});

These values are written directly into the OpenAPI info, contact, license, termsOfService, and servers objects, producing a fully valid OpenAPI 3.0 spec.

Advanced Configuration with SignalR Debugging

using Kaya.ApiExplorer.Extensions;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddSignalR(); // If using SignalR

builder.Services.AddKayaApiExplorer(options =>
{
    options.Middleware.RoutePrefix = "/kaya";
    options.Middleware.DefaultTheme = "light";
    
    // Enable SignalR debugging (optional)
    options.SignalRDebug.Enabled = true;
    options.SignalRDebug.RoutePrefix = "/signalr-debug";
});

var app = builder.Build();

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

// Map your SignalR hubs

app.Run();

SignalR Debugging

The SignalR Debug Tool provides:

  • Hub Connection Management: Connect/disconnect from SignalR hubs with authentication support
  • Method Invocation: Execute hub methods with parameters and see real-time responses
  • Event Handlers: Register custom event handlers to receive server-sent messages
  • Real-time Logging: Monitor all hub activity including connections, method calls, and incoming events
  • Interactive Testing: Test your SignalR implementation without writing client code

XML Documentation Support

Kaya API Explorer automatically reads XML documentation comments from your code to provide better descriptions in the UI. To enable this feature, add the following to your project file (.csproj):

<PropertyGroup>
  <GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

If XML documentation is not available, the explorer falls back to generating default descriptions.

Embedded UI Architecture

The UI is built with embedded HTML, CSS, and JavaScript files that are compiled into the assembly. This ensures:

  • Reliable deployment: No external file dependencies
  • Fast loading: Resources are served from memory
  • Consistent experience: UI works the same across all environments

The middleware integrates seamlessly into your ASP.NET Core pipeline, serving the API Explorer at your specified route without any external dependencies or separate processes.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.3.0 641 4/5/2026
2.2.0 108 3/8/2026
2.1.0 1,936 2/18/2026
2.0.2 1,074 1/3/2026
2.0.1 172 11/23/2025
2.0.0 235 11/16/2025
1.2.2 161 9/21/2025
1.2.1 162 9/21/2025
1.2.0 209 9/20/2025
1.1.0 213 8/30/2025
1.0.0 201 8/24/2025

Version 2.3.0: Added request history and TTL support for local storage. Fixes include selectable response textarea, improved examples for ushort and related numeric types, a single shared theme key between API Explorer and SignalR Debug, and clear values behavior improvements.