### Install with Setup Token Source: https://www.tofupilot.com/docs/access/setup-tokens The command generated by the dashboard to install the CLI and redeem the setup token. ```bash curl -fsSL https://tofupilot.sh/install | sh -s -- --token ``` -------------------------------- ### Install the station service Source: https://www.tofupilot.com/docs/frameworks/tofupilot/environments/station Executes the installation script using a single-use setup token from the dashboard to register the machine as a station. ```bash curl -fsSL https://tofupilot.sh/install | sh -s -- --token ``` -------------------------------- ### Register a Station via CLI Source: https://www.tofupilot.com/docs/station Use the provided install command on the test machine to register a station using a one-hour setup token. ```bash curl -fsSL https://tofupilot.sh/install | sh -s -- --token ``` ```powershell $p = "$env:TEMP\tp-install.ps1"; irm https://tofupilot.sh/install.ps1 -OutFile $p; powershell -ExecutionPolicy Bypass -File $p --token ; ri $p -EA 0 ``` -------------------------------- ### Install a system-level package Source: https://www.tofupilot.com/docs/station/system-packages Example command to install a native dependency on a Linux bench before enabling the System packages setting. ```terminal sudo apt install python3-yourdriver ``` -------------------------------- ### Install TofuPilot SDK Source: https://www.tofupilot.com/docs/sdk/python Install the package using pip. ```bash pip install tofupilot ``` -------------------------------- ### Redeem Setup Token via CLI Source: https://www.tofupilot.com/docs/access/setup-tokens The underlying command executed by the install script to authenticate the station. ```bash tofupilot login --token ``` -------------------------------- ### Install TofuPilot CLI Source: https://www.tofupilot.com/docs/cli One-line installation scripts for different operating systems. ```bash curl -fsSL https://tofupilot.sh/install | sh ``` ```powershell $p = "$env:TEMP\tp-install.ps1"; irm https://tofupilot.sh/install.ps1 -OutFile $p; powershell -ExecutionPolicy Bypass -File $p; ri $p -EA 0 ``` -------------------------------- ### Install TofuPilot and OpenHTF Source: https://www.tofupilot.com/docs/frameworks/openhtf Command to install the necessary packages for TofuPilot integration. ```bash pip install tofupilot openhtf ``` -------------------------------- ### Connection Verification Example Source: https://www.tofupilot.com/docs/frameworks/tofupilot/measurements/boolean Full example of verifying a device connection using YAML configuration and Python logic. ```yaml plugs: - key: device name: Device python: plugs.device:Device main: - name: Connection Test python: phases.verify_connection measurements: - name: Device Connected description: Verify USB connection to device validators: - operator: "==" expected_value: true ``` ```python def verify_connection(log, measurements, device): log.info("Checking device connection") connected = device.is_connected() measurements.device_connected = connected if not connected: log.error("Device not connected") ``` -------------------------------- ### Mode Check Example Source: https://www.tofupilot.com/docs/frameworks/tofupilot/measurements/json Full example of a mode check using both YAML configuration and Python logic. ```yaml main: - name: Mode Check python: phases.check_mode measurements: - name: Operating Mode description: Active operating mode reported by the device validators: - operator: "==" expected_value: mode: active power: high ``` ```python def check_mode(log, measurements): log.info("Reading operating mode") measurements.operating_mode = { "mode": "active", "power": "high", } ``` -------------------------------- ### Define Setup Phases in YAML Source: https://www.tofupilot.com/docs/frameworks/tofupilot/phases/setup-teardown Register setup phases in the procedure.yaml file to ensure prerequisites are met before the main execution. ```yaml setup: - name: Setup Phase 1 - name: Setup Phase 2 main: - name: Main Phase ``` -------------------------------- ### Install TofuPilot SDK Source: https://www.tofupilot.com/docs/sdk/rust Add the necessary dependencies to your Cargo.toml file. ```toml [dependencies] tofupilot = "2.10" tokio = { version = "1", features = ["full"] } ``` -------------------------------- ### Install TofuPilot MATLAB SDK Source: https://www.tofupilot.com/docs/sdk/matlab Clone the repository and add it to the MATLAB path. ```bash git clone https://github.com/tofupilot/matlab.git ``` ```matlab addpath('/path/to/matlab'); savepath; ``` -------------------------------- ### Configuration Snapshot Example Source: https://www.tofupilot.com/docs/frameworks/tofupilot/measurements/json Capturing a device configuration snapshot without validation. ```yaml plugs: - key: device name: Device python: plugs.device:Device main: - name: Capture Config python: phases.capture_config measurements: - name: Device Config description: Full configuration snapshot read from the device ``` ```python def capture_config(log, measurements, device): log.info("Reading device configuration") measurements.device_config = device.dump_config() ``` -------------------------------- ### Quickstart Run Creation Source: https://www.tofupilot.com/docs/sdk/python Create a run using the client context manager to ensure the HTTP session is closed. ```python import os from tofupilot.v2 import TofuPilot with TofuPilot(api_key=os.getenv("TOFUPILOT_API_KEY")) as client: run = client.runs.create( procedure_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", serial_number="SN001", part_number="PN001", outcome="PASS", ) print(f"Run created: {run.id}") ``` -------------------------------- ### Define a basic checklist component Source: https://www.tofupilot.com/docs/frameworks/tofupilot/operator-ui/checklist Example of a standard checklist configuration with text-based options. ```text Operator UI: Checklist (multi-choice) Label: Visual Inspection Checks (required) Options: No scratches | No dents Help: Select all checks that passed ``` ```yaml ui: components: - key: visual_checks type: checklist label: "Visual Inspection Checks" description: "Select all checks that passed" required: true options: - label: "No scratches" value: "no_scratches" - label: "No dents" value: "no_dents" ``` -------------------------------- ### Define Python functions for calibration Source: https://www.tofupilot.com/docs/frameworks/tofupilot/phases/python Example functions corresponding to the calibration phase configuration. ```python def calibrate(): pass # Default function - called by first phase def run_calibration(): pass # Custom function - called by second phase ``` -------------------------------- ### Manage plug phases Source: https://www.tofupilot.com/docs/frameworks/tofupilot/plugs Use setup and teardown phases for complex plug initialization and resource management. ```yaml plugs: - name: Power Supply python: instruments.rigol:RigolDP832 setup: - name: Connect Power Supply python: setup.connect_psu timeout: 30s ui: components: - key: status type: text label: "Connection Status" teardown: - name: Disconnect Power Supply python: teardown.disconnect_psu ``` ```python class RigolDP832: def __init__(self): # Minimal initialization self.socket = None def connect(self, ip, port=5555): # Complex connection logic called from phase self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.socket.connect((ip, port)) return True def disconnect(self): if self.socket: self.socket.close() ``` ```python def connect_psu(power_supply, phase, ui, log): ui.status = "Connecting to power supply..." if power_supply.connect("192.168.1.50"): log.info("Power supply connected successfully") else: phase.fail("Failed to connect to power supply") ``` -------------------------------- ### TofuPilot Client Initialization Source: https://www.tofupilot.com/docs/sdk/csharp How to instantiate the TofuPilot client using a static API key or a dynamic key provider. ```APIDOC ## TofuPilot Client Initialization ### Description Initializes the TofuPilot client to interact with the API. You can provide a static API key or a function to resolve the key dynamically. ### Usage ```csharp // Static API Key var client = new TofuPilot(apiKey: ""); // Dynamic API Key var client = new TofuPilot(apiKeySource: () => ReadKeyFromVault()); ``` ``` -------------------------------- ### Boolean Measurement Output Example Source: https://www.tofupilot.com/docs/frameworks/tofupilot/measurements/boolean Example of a failed boolean measurement evaluation. ```text Boolean Measurement: Device Connected Value: false Validator: x == true Outcome: FAIL (false != true) ``` -------------------------------- ### TofuPilot::new Source: https://www.tofupilot.com/docs/sdk/rust Initializes a new TofuPilot client instance using an API key. ```APIDOC ## TofuPilot::new ### Description Initializes the TofuPilot client with the provided API key. ### Signature `TofuPilot::new(api_key: &str) -> TofuPilot` ``` -------------------------------- ### Station API Response Examples Source: https://www.tofupilot.com/docs/api/rest-api/stations/get Examples of successful and error response bodies returned by the API. ```json { "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Assembly Station 1", "api_key": "550e8400...", "procedures": [ { "id": "550e8400-e29b-41d4-a716-446655440002", "name": "Assembly Test", "runs_count": 42, "deployment": { "deployed_at": "2026-01-22T10:00:00Z", "commit": { "sha": "a1b2c3d4e5f6", "message": "Update procedure", "branch": "main" }, "repository": { "owner": "tofupilot", "name": "procedures", "provider": "github", "gitlab_project_id": 12345 } } } ], "organization_slug": "my-org", "team": { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "name": "string" } } ``` ```json { "message": "Unauthorized", "code": "UNAUTHORIZED", "issues": [] } ``` ```json { "message": "Not found", "code": "NOT_FOUND", "issues": [] } ``` ```json { "message": "Internal server error", "code": "INTERNAL_SERVER_ERROR", "issues": [] } ``` -------------------------------- ### Multiple Boolean Checks Example Source: https://www.tofupilot.com/docs/frameworks/tofupilot/measurements/boolean Example of performing multiple boolean checks within a single phase. ```yaml plugs: - key: device name: Device python: plugs.device:Device main: - name: Error Check python: phases.check_errors measurements: - name: Error State Active description: Check if device is reporting errors validators: - operator: "!=" expected_value: true - name: System Ready description: Check if device is ready for testing validators: - operator: "==" expected_value: true ``` ```python def check_errors(log, measurements, device): log.info("Checking device error state") error_active = device.has_errors() measurements.error_state_active = error_active if error_active: log.error("Device reporting errors") ready = device.is_ready() measurements.system_ready = ready if not ready: log.warning("Device not ready") ``` -------------------------------- ### Measurement API Response Examples Source: https://www.tofupilot.com/docs/api/rest-api/measurements/list Examples of successful and error response bodies returned by the measurements endpoint. ```json { "data": [ { "id": "550e8400-e29b-41d4-a716-446655440000", "phase_name": "Power", "measurement_name": "Voltage", "started_at": "2024-01-15T10:30:00Z", "value": 3.3, "bool_value": true, "string_value": "OK", "units": "V", "measurement_outcome": "PASS", "run_id": "550e8400-e29b-41d4-a716-446655440001", "serial_number": "SN-2024-001234", "sample": null, "measurement_type": "numeric", "retry_count": 0, "is_final_attempt": true, "validators": [ { "outcome": "PASS", "operator": "<=", "expected_value": 3.6, "expression": "x <= 3.6", "is_decisive": true, "is_expression_only": false, "analytics_expression": "<= 3.6", "has_custom_expression": false } ] } ], "meta": { "has_more": true, "next_cursor": 50 } } ``` ```json { "message": "Bad request", "code": "BAD_REQUEST", "issues": [] } ``` ```json { "message": "Unauthorized", "code": "UNAUTHORIZED", "issues": [] } ``` ```json { "message": "Internal server error", "code": "INTERNAL_SERVER_ERROR", "issues": [] } ``` -------------------------------- ### Numeric Measurement Output Example Source: https://www.tofupilot.com/docs/frameworks/tofupilot/measurements/numeric Example of a failed numeric measurement output showing the value, validator, and outcome. ```text Numeric Measurement: Output Voltage Value: 4.5 V Validators: 4.8 <= x <= 5.2 Outcome: FAIL (4.5 < 4.8) ``` -------------------------------- ### Deploy TofuPilot instance Source: https://www.tofupilot.com/docs/self-hosting/deploy Execute the deployment script to validate configuration and start the required Docker containers. ```bash curl -fsSL https://tofupilot.sh/deploy | bash ``` -------------------------------- ### Deploy TofuPilot Source: https://www.tofupilot.com/docs/self-hosting/configure Run the deployment script to generate the initial .env configuration file. ```bash curl -fsSL https://tofupilot.sh/deploy | bash -s -- --license YOUR_LICENSE_KEY ``` -------------------------------- ### ATDF File Format Example Source: https://www.tofupilot.com/docs/import/atdf Example of the internal structure of an ATDF file, showing the FAR header and record lines. ```text FAR:A|4|2|U MIR:TP-DEMO-1|station-a|FT|operator|JOB1 |8:00:00 16-JAN-2025|8:00:12 16-JAN-2025|Demo PTR:1000|1|P|0|3.31|supply_voltage|V||||3.2|3.4 ``` -------------------------------- ### GET /api/v2/stations Source: https://www.tofupilot.com/docs/station Retrieves a list of stations. ```APIDOC ## GET /api/v2/stations ### Description Lists all stations associated with the account. ### Method GET ### Endpoint /api/v2/stations ### Response #### Success Response (200) - **data** (array) - List of station objects containing id, name, procedures, procedures_count, and team. - **meta.has_more** (boolean) - Indicates if there are more results. - **meta.next_cursor** (string) - Cursor for the next page of results. ``` -------------------------------- ### Install TofuPilot NuGet package Source: https://www.tofupilot.com/docs/sdk/csharp Use the .NET CLI to add the TofuPilot package to your project. ```terminal dotnet add package TofuPilot ``` -------------------------------- ### GET /api/v2/runs Source: https://www.tofupilot.com/docs/api/rest-api/runs/list Retrieves a list of test runs. ```APIDOC ## GET /api/v2/runs ### Description Retrieves a list of test runs, including metadata, user information, and associated procedure and unit details. ### Method GET ### Endpoint https://www.tofupilot.app/api/v2/runs ### Response #### Success Response (200) - **data** (array) - List of run objects - **meta** (object) - Pagination metadata including has_more and next_cursor #### Response Example { "data": [ { "id": "550e8400-e29b-41d4-a716-446655440000", "created_at": "2024-01-15T10:30:00Z", "started_at": "2024-01-15T10:35:00Z", "ended_at": "2024-01-15T10:37:30Z", "duration": "PT2M30S", "outcome": "PASS", "docstring": "Test run for production validation", "created_by_user": { "id": "550e8400-e29b-41d4-a716-446655440001", "name": "John Doe", "email": "john.doe@example.com" }, "created_by_station": { "id": "550e8400-e29b-41d4-a716-446655440002", "name": "Test Station 01" }, "operated_by": { "id": "550e8400-e29b-41d4-a716-446655440001", "name": "John Doe", "email": "john.doe@example.com" }, "procedure": { "id": "550e8400-e29b-41d4-a716-446655440003", "name": "PCB Functional Test", "version": { "id": "550e8400-e29b-41d4-a716-446655440010", "tag": "v2.1.0" } }, "unit": { "id": "550e8400-e29b-41d4-a716-446655440004", "serial_number": "SN-2024-001234", "sample": null, "part": { "id": "550e8400-e29b-41d4-a716-446655440007", "number": "PCB-MAIN-001", "name": "Main Control Board", "revision": { "id": "550e8400-e29b-41d4-a716-446655440006", "number": "REV-A" } }, "batch": { "id": "550e8400-e29b-41d4-a716-446655440005", "number": "BATCH-2024-Q1-001" } }, "metadata": { "vendor": "Acme", "lot_size": 500, "qualified": true } } ], "meta": { "has_more": true, "next_cursor": 100 } } ``` -------------------------------- ### Create a Run Source: https://www.tofupilot.com/docs/sdk/csharp Initialize the client using an environment variable and create a new run record. ```csharp 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 = "your-procedure-id", SerialNumber = "SN001", PartNumber = "PN001", Outcome = RunCreateOutcome.Pass, StartedAt = DateTime.UtcNow.AddMinutes(-5), EndedAt = DateTime.UtcNow, }); Console.WriteLine($"Run created: {run.Id}"); ``` -------------------------------- ### GET /v2/stations/current Source: https://www.tofupilot.com/docs/api/rest-api/stations/get_current Retrieves the details of the current station. ```APIDOC ## GET /v2/stations/current ### Description Retrieves the current station details, including linked procedures, organization, and team information. ### Method GET ### Endpoint /v2/stations/current ### Authorization - **Authorization** (header) - Required - Bearer ### Request Example ```bash curl -X GET "https://www.tofupilot.app/api/v2/stations/current" ``` ### Response #### Success Response (200) - **id** (string) - Station ID - **name** (string) - Station name - **api_key** (string) - Station API key - **procedures** (array) - List of linked procedures - **organization_slug** (string) - Organization slug - **team** (object) - Team information #### Response Example { "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Assembly Station 1", "api_key": "550e8400...", "procedures": [ { "id": "550e8400-e29b-41d4-a716-446655440002", "name": "Assembly Test", "runs_count": 42, "deployment": { "deployed_at": "2026-01-22T10:00:00Z", "commit": { "sha": "a1b2c3d4e5f6", "message": "Update procedure", "branch": "main" }, "repository": { "owner": "tofupilot", "name": "procedures", "provider": "github", "gitlab_project_id": 12345 } } } ], "organization_slug": "my-org", "team": { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "name": "string" } } ``` -------------------------------- ### GET /api/v2/stations/{id} Source: https://www.tofupilot.com/docs/station Retrieves details for a specific station. ```APIDOC ## GET /api/v2/stations/{id} ### Description Retrieves the full details of a specific station. ### Method GET ### Endpoint /api/v2/stations/{id} ### Response #### Success Response (200) - **id** (string) - Station ID - **name** (string) - Station name - **api_key** (string) - Station API key - **procedures** (array) - List of procedures with id, name, runs_count, and deployment - **organization_slug** (string) - Organization slug - **team** (string) - Team name ``` -------------------------------- ### Execute PhaseGroup with OpenHTF Source: https://www.tofupilot.com/docs/frameworks/openhtf Demonstrates the use of PhaseGroup to define setup, main, and teardown phases that guarantee teardown execution. ```python import openhtf as htf def power_on(test): ... def measure(test): ... def power_off(test): ... htf.Test(htf.PhaseGroup(setup=[power_on], main=[measure], teardown=[power_off])).execute() ``` -------------------------------- ### tofupilot stations get Source: https://www.tofupilot.com/docs/cli/stations Fetches a specific station by its ID. ```APIDOC ## tofupilot stations get ### Description Fetches a station by ID. ### Parameters #### Flags - **--id** (string) - Required - The ID of the station to fetch ### Example ```bash tofupilot stations get --id station_abc ``` ``` -------------------------------- ### Define and use a plug Source: https://www.tofupilot.com/docs/frameworks/openhtf Demonstrates creating a custom plug class and injecting it into a test phase. ```python import openhtf as htf class DMM(htf.plugs.BasePlug): def measure_voltage(self) -> float: return 5.03 @htf.plug(dmm=DMM) def measure(test, dmm): test.logger.info(f"voltage: {dmm.measure_voltage()}") ``` -------------------------------- ### tofupilot versions get Source: https://www.tofupilot.com/docs/cli/versions Fetches a specific version of a procedure. ```APIDOC ## tofupilot versions get ### Description Fetches a version of a procedure. ### Usage `tofupilot versions get --procedure-id --tag ` ### Parameters - **--procedure-id** (string) - Required - The ID of the procedure. - **--tag** (string) - Required - The version tag to fetch. ### Example `tofupilot versions get --procedure-id proc_abc --tag v1.0.0` ``` -------------------------------- ### Install TofuPilot SDK via CMake Source: https://www.tofupilot.com/docs/sdk/cpp Use FetchContent to include the TofuPilot library in your CMake project. ```cmake include(FetchContent) FetchContent_Declare( tofupilot GIT_REPOSITORY https://github.com/tofupilot/cpp.git GIT_TAG v2.5.0 GIT_SHALLOW TRUE ) FetchContent_MakeAvailable(tofupilot) target_link_libraries(your_target PRIVATE tofupilot) ``` -------------------------------- ### tofupilot procedures get Source: https://www.tofupilot.com/docs/cli/procedures Fetches a specific procedure by its ID. ```APIDOC ## tofupilot procedures get ### Description Fetches a procedure by ID. ### Parameters - **--id** (string) - Required - The ID of the procedure to fetch. ### Example `tofupilot procedures get --id proc_abc` ``` -------------------------------- ### Authenticate with API Key Source: https://www.tofupilot.com/docs/sdk/csharp Initialize the client by passing the API key directly to the constructor. ```csharp using TofuPilot; var client = new TofuPilot(apiKey: ""); ``` -------------------------------- ### tofupilot revisions get Source: https://www.tofupilot.com/docs/cli/revisions Fetches a specific part revision. ```APIDOC ## tofupilot revisions get ### Description The get subcommand fetches a revision. ### Parameters - **--part-number** (string) - Required - The part number associated with the revision. - **--revision-number** (string) - Required - The revision number to fetch. ### Example `tofupilot revisions get --part-number PCB01 --revision-number A` ``` -------------------------------- ### Get procedure Source: https://www.tofupilot.com/docs/cli/procedures Fetches details for a specific procedure by its ID. ```bash tofupilot procedures get --id proc_abc ``` -------------------------------- ### Deploy Procedure Source: https://www.tofupilot.com/docs/cli/deploy Uploads the linked procedure's source tree and builds it in the cloud, creating a preview deployment by default. ```bash tofupilot deploy ``` -------------------------------- ### tofupilot parts get Source: https://www.tofupilot.com/docs/cli/parts Fetches a specific part by its number. ```APIDOC ## tofupilot parts get ### Description Fetches a part by number. ### Parameters - **--number** (string) - Required - The part number to retrieve. ### Usage `tofupilot parts get --number PCB01` ``` -------------------------------- ### TofuPilot(api_key, server_url) Source: https://www.tofupilot.com/docs/sdk/python Initializes the TofuPilot client to connect to a self-hosted instance. ```APIDOC ## TofuPilot(api_key, server_url) ### Description Configures the client to target a self-hosted TofuPilot instance. The `server_url` should be the instance origin plus `/api`. ### Parameters - **api_key** (string) - Required - Your TofuPilot API key. - **server_url** (string) - Required - The base URL of your self-hosted instance (e.g., `https://your-instance.example.com/api`). ### Example ```python client = TofuPilot( api_key="your-api-key", server_url="https://your-instance.example.com/api", ) ``` ``` -------------------------------- ### Create Parts, Revisions, and Units via API Source: https://www.tofupilot.com/docs/inventory/parts Demonstrates initializing the TofuPilot client to create a new part, add a specific revision, and register a unit. ```python from tofupilot.v2 import TofuPilot client = TofuPilot() client.parts.create(number="PCB-001", name="Main PCB") client.parts.revisions.create(part_number="PCB-001", number="C") client.units.create(serial_number="SN-100", part_number="PCB-001", revision_number="C") ``` -------------------------------- ### tofupilot batches get Source: https://www.tofupilot.com/docs/cli/batches Fetches a specific batch by its number. ```APIDOC ## tofupilot batches get ### Description Fetches a batch by number. ### Parameters - **--number** (string) - Required - The batch number to retrieve. ### Example `tofupilot batches get --number BATCH-2026-05` ``` -------------------------------- ### Get batch Source: https://www.tofupilot.com/docs/cli/batches Fetches details for a specific batch by its number. ```bash tofupilot batches get --number BATCH-2026-05 ``` -------------------------------- ### Full Procedure Configuration Source: https://www.tofupilot.com/docs/frameworks/tofupilot/phases/setup-teardown Combine setup, main, and teardown sections within a single procedure definition. ```yaml name: Full Procedure version: 1.0.0 setup: - name: Setup Phase 1 - name: Setup Phase 2 main: - name: Main Phase teardown: - name: Teardown Phase 1 - name: Teardown Phase 2 ``` -------------------------------- ### Authenticate with TofuPilot Client Source: https://www.tofupilot.com/docs/sdk/cpp Initialize the client using an API key directly or via environment variables. ```cpp #include auto client = tofupilot::TofuPilot(""); ``` ```bash export TOFUPILOT_API_KEY="your-api-key" ``` ```cpp #include #include int main() { auto client = tofupilot::TofuPilot(std::getenv("TOFUPILOT_API_KEY")); auto run = client.runs().create() .procedure_id("your-procedure-id") .serial_number("SN001") .part_number("PN001") .outcome(tofupilot::Outcome::Pass) .send(); std::cout << "Run created: " << run.id << std::endl; } ``` -------------------------------- ### tofupilot update Source: https://www.tofupilot.com/docs/cli/update Checks for a newer CLI release and installs it in place. ```APIDOC ## tofupilot update ### Description The `update` command checks for a newer CLI release and installs it in place. The CLI also checks in the background and prompts when an update is available. ### Usage `tofupilot update` ``` -------------------------------- ### Configure client for self-hosted instance in C++ Source: https://www.tofupilot.com/docs/sdk/cpp Set the base URL to your self-hosted instance origin plus /api during client initialization. ```cpp auto client = tofupilot::TofuPilot( tofupilot::ClientConfig::with_api_key("your-api-key") .set_base_url("https://your-instance.example.com/api") ); ``` -------------------------------- ### tofupilot rollback Source: https://www.tofupilot.com/docs/cli/rollback Reverts the TofuPilot CLI to the previously installed version. ```APIDOC ## tofupilot rollback ### Description The `rollback` command reverts the TofuPilot CLI to the previously installed version. ### Usage ```bash tofupilot rollback ``` ``` -------------------------------- ### Define JSON measurement Source: https://www.tofupilot.com/docs/frameworks/tofupilot/measurements/json Example of a raw JSON object measurement. ```json { "mode": "active", "power": "high"} ``` -------------------------------- ### Configuring a Self-hosted Instance in C# Source: https://www.tofupilot.com/docs/sdk/csharp Set the serverUrl parameter to the instance origin followed by /api to target a self-hosted TofuPilot environment. ```csharp var client = new TofuPilot( apiKey: "your-api-key", serverUrl: "https://your-instance.example.com/api" ); ``` -------------------------------- ### tofupilot service start Source: https://www.tofupilot.com/docs/cli/service Runs the daemon in the foreground. This command is primarily used by systemd or launchd as the ExecStart target. ```APIDOC ## tofupilot service start ### Description Runs the daemon in the foreground. This command is used by systemd and launchd as the ExecStart target and is rarely called manually. ### Usage `tofupilot service start` ``` -------------------------------- ### Update station request Source: https://www.tofupilot.com/docs/api/rest-api/stations/update Example of a cURL request to update a station. ```bash curl -X PATCH "https://www.tofupilot.app/api/v2/stations/string" \ -H "Content-Type: application/json" \ -d '{}' ``` -------------------------------- ### tofupilot units get Source: https://www.tofupilot.com/docs/cli/units Fetches a single unit by its serial number. ```APIDOC ## tofupilot units get ### Description Fetches one unit by serial number. ### Example `tofupilot units get --serial-number SN-0001` ``` -------------------------------- ### Implement product variant selection Source: https://www.tofupilot.com/docs/frameworks/tofupilot/operator-ui/select Example of using a select component to allow operators to choose from various product hardware configurations. ```yaml main: - name: Select Variant ui: components: - key: product_variant type: select label: "Product Variant" required: true options: - label: "Standard - 8GB RAM" value: "std_8gb" - label: "Standard - 16GB RAM" value: "std_16gb" - label: "Pro - 16GB RAM" value: "pro_16gb" - label: "Pro - 32GB RAM" value: "pro_32gb" - label: "Enterprise - 64GB RAM" value: "ent_64gb" ``` -------------------------------- ### tofupilot runs get Source: https://www.tofupilot.com/docs/cli/runs Fetches a single run by its unique ID. ```APIDOC ## tofupilot runs get ### Description Fetches a single run by ID. ### Parameters - **--id** (string) - Required - The ID of the run to fetch ### Example `tofupilot runs get --id run_abc123` ``` -------------------------------- ### Configure SDK Client in MATLAB Source: https://www.tofupilot.com/docs/sdk/matlab Pass configuration parameters as name-value pairs during client initialization. ```matlab sdk = tofupilot.TofuPilot('your-api-key', ... 'BaseUrl', 'https://your-server.com/api', ... 'Timeout', 60, ... 'MaxRetries', 5); ``` -------------------------------- ### Deploy to Production Source: https://www.tofupilot.com/docs/cli/deploy Targets the production environment, ensuring all linked stations pick up the build once ready. ```bash tofupilot deploy --prod ``` -------------------------------- ### Get station Source: https://www.tofupilot.com/docs/cli/stations Fetches details for a specific station using its ID. ```bash tofupilot stations get --id station_abc ``` -------------------------------- ### tofupilot phases get Source: https://www.tofupilot.com/docs/cli/phases Fetches a single phase by its unique identifier. ```APIDOC ## tofupilot phases get ### Description Fetches the details of a single phase using its unique ID. ### Parameters - **--id** (string) - Required - The unique identifier of the phase. ### Example `tofupilot phases get --id phase_abc123` ``` -------------------------------- ### POST /uploads/initialize Source: https://www.tofupilot.com/docs/api/rest-api Initialize a file upload process to receive a pre-signed URL. ```APIDOC ## POST /uploads/initialize ### Description Get a pre-signed URL to upload a file. Returns the upload ID and URL. PUT the file to the URL, then call Finalize upload. ### Method POST ### Endpoint https://www.tofupilot.app/api/v2/uploads/initialize ``` -------------------------------- ### tofupilot measurements get Source: https://www.tofupilot.com/docs/cli/measurements Fetches a single measurement by its unique ID. ```APIDOC ## tofupilot measurements get ### Description Retrieves the details of a single measurement using its unique identifier. ### Parameters - **--id** (string) - Required - The unique ID of the measurement to fetch. ### Example tofupilot measurements get --id meas_abc123 ``` -------------------------------- ### Initialize an upload Source: https://www.tofupilot.com/docs/cli/attachments Initializes a new upload process. The --json flag is recommended to capture the upload ID and presigned URL for subsequent steps. ```bash tofupilot attachments initialize --name report.pdf --json ``` -------------------------------- ### Authenticate with TofuPilot SDK Source: https://www.tofupilot.com/docs/sdk/matlab Initialize the SDK using an API key passed directly or via environment variable. ```matlab sdk = tofupilot.TofuPilot(''); ``` ```bash export TOFUPILOT_API_KEY="your-api-key" ``` ```matlab sdk = tofupilot.TofuPilot(getenv('TOFUPILOT_API_KEY')); req.procedure_id = 'your-procedure-id'; req.serial_number = 'SN001'; req.part_number = 'PN001'; req.outcome = 'PASS'; run = sdk.Runs.create(req); fprintf('Run created: %s\n', run.id); ``` -------------------------------- ### GET /v2/stations Source: https://www.tofupilot.com/docs/api/rest-api/stations/list Retrieve a list of stations with optional filtering and pagination. ```APIDOC ## GET /v2/stations ### Description Retrieve a list of stations. Supports pagination via cursor and filtering by name or linked procedure IDs. ### Method GET ### Endpoint /v2/stations ### Parameters #### Query Parameters - **limit** (integer) - Optional - Number of stations to return per page (Default: 50, Range: 1-100) - **cursor** (integer) - Optional - Cursor for pagination - **search_query** (string) - Optional - Search query to filter stations by name - **procedure_ids** (array) - Optional - Filter stations by linked procedure IDs ### Response #### Success Response (200) - **data** (array) - List of station objects - **meta** (object) - Pagination metadata including has_more and next_cursor #### Response Example { "data": [ { "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Assembly Station 1", "procedures": [ { "id": "550e8400-e29b-41d4-a716-446655440001", "name": "Assembly Test" } ], "procedures_count": 5, "team": { "id": "550e8400-e29b-41d4-a716-446655440002", "name": "Assembly Team" } } ], "meta": { "has_more": true, "next_cursor": 2 } } ``` -------------------------------- ### Create and manage batches via API Source: https://www.tofupilot.com/docs/inventory/batches Demonstrates how to pre-allocate a batch and associate units with it using the TofuPilot Python client. ```python from tofupilot.v2 import TofuPilot client = TofuPilot() client.batches.create(number="BATCH-2026-04-12") client.units.create( serial_number="SN-200", part_number="PCB-V1", batch_number="BATCH-2026-04-12", ) client.units.list(batch_numbers=["BATCH-2026-04-12"]) ``` -------------------------------- ### GET /v2/phases/{id} Source: https://www.tofupilot.com/docs/api/rest-api/phases/get Retrieves the details of a specific phase by its ID. ```APIDOC ## GET /v2/phases/{id} ### Description Retrieves the details of a specific phase by its ID. ### Method GET ### Endpoint /v2/phases/{id} ### Parameters #### Path Parameters - **id** (string) - Required - ID of the phase to retrieve. ### Request Example ``` curl -X GET "https://www.tofupilot.app/api/v2/phases/string" ``` ### Response #### Success Response (200) - **id** (string) - Phase ID - **name** (string) - Phase name - **outcome** (string) - Phase outcome - **started_at** (string) - Start timestamp - **ended_at** (string) - End timestamp - **duration** (string) - Duration - **retry_count** (integer) - Retry count - **docstring** (string) - Documentation string - **measurements** (array) - List of measurements - **run** (object) - Associated run details - **procedure** (object) - Associated procedure details #### Response Example { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "name": "string", "outcome": "PASS", "started_at": "2019-08-24T14:15:22Z", "ended_at": "2019-08-24T14:15:22Z", "duration": "string", "retry_count": -9007199254740991, "docstring": "string", "measurements": [], "run": { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "serial_number": "string" }, "procedure": { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "name": "string" } } ``` -------------------------------- ### Initialize TofuPilot Client Source: https://www.tofupilot.com/docs/sdk/rust Authenticate by passing an API key directly or via environment variables. ```rust use tofupilot::TofuPilot; let client = TofuPilot::new(""); ``` ```bash export TOFUPILOT_API_KEY="your-api-key" ``` -------------------------------- ### GET /v2/parts/{number} Source: https://www.tofupilot.com/docs/api/rest-api/parts/get Retrieves a specific part by its part number. ```APIDOC ## GET /v2/parts/{number} ### Description Retrieves the details of a specific part identified by its part number. ### Method GET ### Endpoint /v2/parts/{number} ### Parameters #### Path Parameters - **number** (string) - Required - Part number of the part to retrieve. ### Response #### Success Response (200) - **id** (string) - Unique identifier of the part. - **number** (string) - The part number. - **name** (string) - The name of the part. - **created_at** (string) - ISO 8601 timestamp of creation. - **created_by_user** (object) - User who created the part. - **created_by_station** (object) - Station where the part was created. - **revisions** (array) - List of part revisions. #### Response Example { "id": "550e8400-e29b-41d4-a716-446655440000", "number": "PCB-MAIN-001", "name": "Main Control Board", "created_at": "2024-01-15T10:30:00Z", "created_by_user": { "id": "550e8400-e29b-41d4-a716-446655440001", "name": "John Doe" }, "created_by_station": { "id": "550e8400-e29b-41d4-a716-446655440002", "name": "Assembly Station 01" }, "revisions": [ { "id": "550e8400-e29b-41d4-a716-446655440003", "number": "REV-A", "created_at": "2024-01-15T10:30:00Z" } ] } ``` -------------------------------- ### Self-hosted configuration Source: https://www.tofupilot.com/docs/sdk/rust Instructions for configuring the SDK to communicate with a self-hosted TofuPilot instance. ```APIDOC ## Self-hosted ### Description To target a self-hosted instance, provide the instance origin URL followed by `/api` to the `base_url` parameter in `ClientConfig`. The SDK automatically appends the versioned path. ### Example ```rust use tofupilot::TofuPilot; use tofupilot::config::ClientConfig; let client = TofuPilot::with_config( ClientConfig::new("your-api-key") .base_url("https://your-instance.example.com/api"), ); ``` ``` -------------------------------- ### GET /v2/measurements Source: https://www.tofupilot.com/docs/api/rest-api/measurements/list Retrieve a filtered list of measurements for a specific procedure. ```APIDOC ## GET /v2/measurements ### Description Retrieve a list of measurements filtered by various criteria such as procedure ID, run metadata, unit information, and measurement values. ### Method GET ### Endpoint /v2/measurements ### Parameters #### Query Parameters - **procedure_id** (string) - Required - Procedure to list measurements for. - **phase_name** (string) - Optional - Pin results to a single phase by name. - **measurement_name** (string) - Optional - Pin results to a single measurement by name. - **phase_names** (array) - Optional - Restrict results to these phase names. - **outcomes** (array) - Optional - Filter measurements by the outcome of their run. - **ids** (array) - Optional - Filter measurements by run ID. - **duration_min** (string) - Optional - Filter measurements whose run lasted at least this ISO 8601 duration. - **duration_max** (string) - Optional - Filter measurements whose run lasted at most this ISO 8601 duration. - **deployment_ids** (array) - Optional - Filter measurements by the deployment ID. - **procedure_versions** (array) - Optional - Filter measurements by the procedure version tag. - **environments** (array) - Optional - Filter measurements by the deployment environment. - **serial_numbers** (array) - Optional - Filter measurements by unit serial number. - **part_numbers** (array) - Optional - Filter measurements by unit part number. - **revision_numbers** (array) - Optional - Filter measurements by unit revision number. - **batch_numbers** (array) - Optional - Filter measurements by unit batch number. - **operated_by_ids** (array) - Optional - Filter measurements by the operator user ID. - **created_by_station_ids** (array) - Optional - Filter measurements by the station ID. - **created_by_user_ids** (array) - Optional - Filter measurements by the user ID. - **started_after** (string) - Optional - Filter measurements whose run started after this date (inclusive). - **started_before** (string) - Optional - Filter measurements whose run started before this date (inclusive). - **exclude_retries** (boolean) - Optional - Exclude retried phase attempts (Default: true). - **value_min** (number) - Optional - Filter numeric measurements with a value at or above this number. - **value_max** (number) - Optional - Filter numeric measurements with a value at or below this number. - **value_bool** (boolean) - Optional - Filter boolean measurements by value. - **value_strings** (array) - Optional - Filter string measurements by value. - **measurement_outcomes** (array) - Optional - Filter by measurement outcome. - **measurement_types** (array) - Optional - Filter by measurement value type. - **sort_by** (string) - Optional - Field to sort results by (Default: "started_at"). - **sort_order** (string) - Optional - Sort order direction (Default: "desc"). - **limit** (integer) - Optional - Maximum number of measurements to return (1-100). - **cursor** (integer) - Optional - Cursor for pagination. ```