Skip to content

TofuPilot now speaks C#

March 31, 2026

TofuPilot C# SDK code example showing how to create a test run with measurements from .NET

Python isn't the only language on the factory floor. Many hardware teams run .NET for TestStand sequences, LabVIEW integrations, or custom test executors. Until now, they had to wrap raw HTTP calls to use TofuPilot.

Our community member @Hylaean changed that. He built the first C# client from scratch, covering core endpoints with clean async patterns. It was great work, and teams started using it in production.

We took it one step further. Starting from his foundation, we auto-generated full V2 coverage from our OpenAPI spec, added typed models for every request and response, and wired up 131 xUnit tests that run on each deployment. The SDK is open source under MIT license on GitHub.

Install

You can install the SDK from NuGet:

dotnet add package TofuPilot

Create a run with measurements

You can create a run with phases, measurements, and limits in one call:

using TofuPilot;
using TofuPilot.Models.Requests;

var client = new TofuPilot(apiKey: Environment.GetEnvironmentVariable("TOFUPILOT_API_KEY")!);

var run = await client.Runs.CreateAsync(new RunCreateRequest
{
    ProcedureId = "FVT-001",
    SerialNumber = "SN-042",
    PartNumber = "PCB-V2",
    Outcome = RunCreateOutcome.Pass,
    StartedAt = DateTime.UtcNow.AddMinutes(-5),
    EndedAt = DateTime.UtcNow,
    Phases = new List<RunCreatePhases>
    {
        new()
        {
            Name = "Voltage Test",
            Outcome = RunCreatePhasesOutcome.Pass,
            StartedAt = DateTime.UtcNow.AddMinutes(-5),
            EndedAt = DateTime.UtcNow,
            Measurements = new List<RunCreateMeasurements>
            {
                new()
                {
                    Name = "Output Voltage",
                    Outcome = RunCreateMeasurementsOutcome.Pass,
                    MeasuredValue = 3.3,
                    Validators = new List<RunCreateValidators>
                    {
                        new() { Operator = ">=", ExpectedValue = RunCreateExpectedValue.CreateNumber(3.0) },
                        new() { Operator = "<=", ExpectedValue = RunCreateExpectedValue.CreateNumber(3.6) },
                    },
                },
            },
        },
    },
});

Upload files in one call

You can upload attachments without the usual init/PUT/finalize dance:

var id = await client.Attachments.UploadAsync("report.pdf");

Every V2 endpoint, fully typed

Runs, units, parts, revisions, procedures, batches, stations, attachments, users. Every resource has full CRUD with typed requests and responses.

Updated docs with C# examples

All dashboard documentation pages and every API reference endpoint now include C# code examples alongside Python. Both are generated from the OpenAPI spec, so they stay in sync as we ship new features.

What's next

We're working on a NI TestStand integration so .NET teams running TestStand sequences can push results to TofuPilot without custom scripts. If you're using TestStand or LabVIEW, we'd like to hear how you export test data today.

The SDK targets net10.0 LTS and is available on NuGet.

See what's new in action