# TraconEndpointRouteBuilderExtensions

> Tracon documentation. Tracon is a .NET package family that adds a control
> plane on Microsoft Agent Framework, published as NuGet packages that run
> inside your own ASP.NET Core application.
>
> Page: https://tracon.dev/api/tracon.traconendpointroutebuilderextensions/
> Summary: TraconEndpointRouteBuilderExtensions: Extensions that connect Tracon's HTTP surface to the application.

<div class="api-provenance">Namespace Tracon · Assembly <code>Tracon.AspNetCore.dll</code></div>

Extensions that connect Tracon's HTTP surface to the application.

```csharp
public static class TraconEndpointRouteBuilderExtensions
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.traconendpointroutebuilderextensions/">TraconEndpointRouteBuilderExtensions</a></dd><dt>Inherited Members</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a></dd></dl>

## Fields

### <a id="Tracon_TraconEndpointRouteBuilderExtensions_DefaultPrefix"></a> DefaultPrefix

Default path prefix.

```csharp
public const string DefaultPrefix = "/tracon"
```

#### Field Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)

## Methods

### <a id="Tracon_TraconEndpointRouteBuilderExtensions_MapTracon_Microsoft_AspNetCore_Routing_IEndpointRouteBuilder_System_String_System_Action_Tracon_TraconEndpointOptions__"></a> MapTracon\(IEndpointRouteBuilder, string, Action<TraconEndpointOptions\>?\)

Connects the Tracon management API and the OpenAI-compatible run
endpoints.

```csharp
public static IEndpointConventionBuilder MapTracon(this IEndpointRouteBuilder endpoints, string prefix = "/tracon", Action<TraconEndpointOptions>? configure = null)
```

#### Parameters

`endpoints` [IEndpointRouteBuilder](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.routing.iendpointroutebuilder)

The application's routing builder.

`prefix` [string](https://learn.microsoft.com/dotnet/api/system.string)

Path prefix. Default is `/tracon`.

`configure` [Action](https://learn.microsoft.com/dotnet/api/system.action\-1)<[TraconEndpointOptions](/api/tracon.traconendpointoptions/)\>?

Hook that mutates access and streaming settings.

#### Returns

 [IEndpointConventionBuilder](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.builder.iendpointconventionbuilder)

The convention builder for the protected endpoints. Every convention
added **only** applies to the protected endpoints.

#### Remarks

Endpoints fall into two groups. `{prefix}/api/meta` is reachable
without authentication; it is needed for the UI to learn which
authentication method to use and returns no sensitive data. Every other
endpoint passes through the three-layer protection.

The returned builder represents **only the protected group**.
This is deliberate: if the meta endpoint were also locked when the
caller writes `MapTracon(...).RequireAuthorization`, the UI
could never learn the authentication method and could never open a
session.

```csharp
app.MapTracon("/tracon", options =>
{
    options.RequireAuthorization("TraconAdmin");
});
```

#### Exceptions

 [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

`endpoints` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).

 [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception)

`prefix` is empty.

 [InvalidOperationException](https://learn.microsoft.com/dotnet/api/system.invalidoperationexception)

`AddTracon` has not been called.
