TofuPilotTofuPilot
v2 Reference (Preview)/Runs

Get run

Retrieve a single test run by its ID. Returns comprehensive run data including metadata, phases, measurements, and logs.

API v2 Preview

The TofuPilot API v2.0 is currently in public preview and is subject to change as we stabilize until release (planned for Aug 2025).

Access

API KeyAccess LevelDescription
UserFullUsers can get runs from any procedure
StationLimitedStations can only get runs from procedures to which they are currently linked

Endpoint

GET/v2/runs/{id}
AuthorizationBearer <token>

API key for authentication. Use format: Bearer YOUR_API_KEY

In: header

Path Parameters

idstring

ID of the run to retrieve.

Formatuuid

Response Body

from tofupilot.v2 import TofuPilot

# Initialize the TofuPilot client
client = TofuPilot()

# Execute the operation
result = client.runs.get(
    id="550e8400-e29b-41d4-a716-446655440000"
)

# Handle response
print(result)
{
  "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",
    "image": "https://example.com/user-avatar.jpg"
  },
  "created_by_station": {
    "id": "550e8400-e29b-41d4-a716-446655440002",
    "name": "Test Station 01",
    "image": "https://example.com/station-01.jpg"
  },
  "operated_by": {
    "id": "550e8400-e29b-41d4-a716-446655440001",
    "name": "John Doe",
    "email": "john.doe@example.com",
    "image": "https://example.com/operator-avatar.jpg"
  },
  "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",
    "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",
        "image": "https://example.com/revision-image.jpg"
      }
    },
    "batch": {
      "id": "550e8400-e29b-41d4-a716-446655440005",
      "number": "BATCH-2024-Q1-001"
    }
  },
  "phases": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440008",
      "name": "Power On Test",
      "outcome": "PASS",
      "started_at": "2024-01-15T10:35:00Z",
      "ended_at": "2024-01-15T10:36:30Z",
      "duration": "PT1M30S",
      "docstring": "Verifies that the board powers on correctly and all voltage rails are within spec.",
      "measurements": [
        {}
      ]
    }
  ],
  "attachments": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440011",
      "name": "test-results.pdf",
      "size": 1048576,
      "content_type": "application/pdf",
      "is_report": false,
      "download_url": "https://s3.amazonaws.com/bucket/file?X-Amz-Algorithm=..."
    }
  ],
  "logs": [
    {
      "id": "string",
      "level": "DEBUG",
      "timestamp": "2019-08-24T14:15:22Z",
      "message": "string",
      "source_file": "string",
      "line_number": 0
    }
  ],
  "sub_units": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "serial_number": "SN-SUB-001"
    },
    {
      "id": "550e8400-e29b-41d4-a716-446655440001",
      "serial_number": "SN-SUB-002"
    }
  ]
}
{
  "code": "NOT_FOUND",
  "message": "Operator with email {operated_by} does not exist. Create the user first in the app.; Procedure with ID {id} does not exist. Create the procedure first in the app.",
  "issues": []
}
{
  "code": "INTERNAL_SERVER_ERROR",
  "message": "Internal server error",
  "issues": []
}

How is this guide?