C# .NET 8

C# .NET 8 is a fully supported runtime. Create sessions with language: "csharp" and languageVersion: "8.0". No published NuGet package exists yet; use the REST API directly or generate a typed client from the OpenAPI spec.

Warning
Memory requirement. The .NET runtime reserves a large amount of virtual address space at startup. For workloads that run multiple consecutive dotnet build or dotnet test operations in a single session, use small (2 GB) or larger. The micro size (1 GB) can run out of memory during intensive build or test cycles.

Create a session via REST

curl
curl -X POST https://api.mudbase.dev/api/sandboxes/projects/PROJECT_ID \
  -H "x-api-key: API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"language":"csharp","languageVersion":"8.0","timeoutSeconds":300}'
curl -X POST https://api.mudbase.dev/api/sandboxes/projects/PROJECT_ID \
  -H "x-api-key: API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"language":"csharp","languageVersion":"8.0","timeoutSeconds":300}'

Run a command

curl
curl -N -X POST https://api.mudbase.dev/api/sandboxes/projects/PROJECT_ID/sessions/SESSION_ID/exec \
  -H "x-api-key: API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"cmd":["dotnet","--version"],"timeoutMs":30000}'
curl -N -X POST https://api.mudbase.dev/api/sandboxes/projects/PROJECT_ID/sessions/SESSION_ID/exec \
  -H "x-api-key: API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"cmd":["dotnet","--version"],"timeoutMs":30000}'

Call the API with HttpClient

No package is required. The standard System.Net.Http.HttpClient covers the full REST API.

C#
using System.Net.Http.Json;
using System.Text.Json;

var apiKey = Environment.GetEnvironmentVariable("CELLS_API_KEY")!;
var projectId = Environment.GetEnvironmentVariable("CELLS_PROJECT_ID")!;

using var http = new HttpClient();
http.DefaultRequestHeaders.Add("x-api-key", apiKey);
http.BaseAddress = new Uri("https://api.mudbase.dev");

// Create a C# .NET 8 session
var body = new { language = "csharp", languageVersion = "8.0", timeoutSeconds = 300 };
var created = await http.PostAsJsonAsync($"/api/sandboxes/projects/{projectId}", body);
var session = await created.Content.ReadFromJsonAsync<JsonElement>();
var sessionId = session.GetProperty("sessionId").GetString()!;

Console.WriteLine($"Session: {sessionId}");
using System.Net.Http.Json;
using System.Text.Json;

var apiKey = Environment.GetEnvironmentVariable("CELLS_API_KEY")!;
var projectId = Environment.GetEnvironmentVariable("CELLS_PROJECT_ID")!;

using var http = new HttpClient();
http.DefaultRequestHeaders.Add("x-api-key", apiKey);
http.BaseAddress = new Uri("https://api.mudbase.dev");

// Create a C# .NET 8 session
var body = new { language = "csharp", languageVersion = "8.0", timeoutSeconds = 300 };
var created = await http.PostAsJsonAsync($"/api/sandboxes/projects/{projectId}", body);
var session = await created.Content.ReadFromJsonAsync<JsonElement>();
var sessionId = session.GetProperty("sessionId").GetString()!;

Console.WriteLine($"Session: {sessionId}");

Generate a typed client from the spec

The Cells OpenAPI spec is available at /openapi.yaml. Use Kiota or NSwag to generate a typed C# client in one command.

Note
Both generators read the spec directly from the hosted URL. No local copy needed. The generated client covers all Cells endpoints and includes the full request and response types.

Option 1: Kiota

Kiota
# Install Kiota (requires .NET 8 SDK)
dotnet tool install --global Microsoft.OpenApi.Kiota

# Generate a C# client from the Cells OpenAPI spec
kiota generate \
  --openapi https://docs.cells.mudbase.dev/openapi.yaml \
  --language csharp \
  --class-name CellsApiClient \
  --namespace-name Mudbase.Cells \
  --output ./CellsClient
# Install Kiota (requires .NET 8 SDK)
dotnet tool install --global Microsoft.OpenApi.Kiota

# Generate a C# client from the Cells OpenAPI spec
kiota generate \
  --openapi https://docs.cells.mudbase.dev/openapi.yaml \
  --language csharp \
  --class-name CellsApiClient \
  --namespace-name Mudbase.Cells \
  --output ./CellsClient

Option 2: NSwag

NSwag
# Install NSwag CLI
dotnet tool install --global NSwag.ConsoleCore

# Generate a C# client
nswag openapi2csclient \
  /input:https://docs.cells.mudbase.dev/openapi.yaml \
  /classname:CellsApiClient \
  /namespace:Mudbase.Cells \
  /output:CellsApiClient.cs
# Install NSwag CLI
dotnet tool install --global NSwag.ConsoleCore

# Generate a C# client
nswag openapi2csclient \
  /input:https://docs.cells.mudbase.dev/openapi.yaml \
  /classname:CellsApiClient \
  /namespace:Mudbase.Cells \
  /output:CellsApiClient.cs

REST API reference

Every endpoint is documented in the API Reference, including request and response schemas, error codes, and interactive examples.