TofuPilotTofuPilot
API Reference (v2)Runs

Get run

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

Access

API KeyAccess LevelDescription
UserFullUsers can read runs
StationLimitedStations cannot read runs

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.

Response Body

from tofupilot.v2 import TofuPilot

# Initialize the TofuPilot client
client = TofuPilot()

# Execute the operation
result = client.runs.get(
    id="string"
)

# 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"
  },
  "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",
    "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"
    }
  },
  "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",
      "retry_count": 0,
      "docstring": "Verifies that the board powers on correctly and all voltage rails are within spec.",
      "measurements": [
        {
          "id": "550e8400-e29b-41d4-a716-446655440009",
          "name": "Input Voltage",
          "outcome": "PASS",
          "units": "V",
          "validators": [
            {
              "outcome": "PASS",
              "operator": ">=",
              "expected_value": 3,
              "expression": "x >= 3.0",
              "is_decisive": true,
              "is_expression_only": true,
              "analytics_expression": "string",
              "has_custom_expression": true
            }
          ],
          "aggregations": [
            {
              "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
              "type": "MEAN",
              "outcome": "PASS",
              "value": 42.5,
              "unit": "V",
              "validators": [
                {
                  "outcome": "PASS",
                  "operator": ">=",
                  "expected_value": 3,
                  "expression": "x >= 3.0",
                  "is_decisive": true,
                  "is_expression_only": true,
                  "analytics_expression": "string",
                  "has_custom_expression": true
                }
              ]
            }
          ],
          "measured_value": 12.05,
          "data_series": [
            {
              "data": [
                0
              ],
              "units": "string",
              "validators": [
                {
                  "outcome": "PASS",
                  "operator": ">=",
                  "expected_value": 3,
                  "expression": "x >= 3.0",
                  "is_decisive": true,
                  "is_expression_only": true,
                  "analytics_expression": "string",
                  "has_custom_expression": true
                }
              ],
              "aggregations": [
                {
                  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
                  "type": "MEAN",
                  "outcome": "PASS",
                  "value": 42.5,
                  "unit": "V",
                  "validators": [
                    {
                      "outcome": "PASS",
                      "operator": ">=",
                      "expected_value": 3,
                      "expression": "x >= 3.0",
                      "is_decisive": true,
                      "is_expression_only": true,
                      "analytics_expression": "string",
                      "has_custom_expression": true
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ],
  "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": -9007199254740991
    }
  ],
  "sub_units": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "serial_number": "SN-SUB-001",
      "part_number": "PART-001",
      "part_name": "Motor Assembly"
    },
    {
      "id": "550e8400-e29b-41d4-a716-446655440001",
      "serial_number": "SN-SUB-002",
      "part_number": "PART-002",
      "part_name": null
    }
  ]
}
{
  "message": "Bad request",
  "code": "BAD_REQUEST",
  "issues": []
}
{
  "message": "Unauthorized",
  "code": "UNAUTHORIZED",
  "issues": []
}
{
  "message": "Not found",
  "code": "NOT_FOUND",
  "issues": []
}
{
  "message": "Internal server error",
  "code": "INTERNAL_SERVER_ERROR",
  "issues": []
}

How is this guide?