TofuPilotTofuPilot
v1 Reference/Runs

List runs by serial number

Retrieve all test runs associated with a specific unit identified by serial number. Returns comprehensive run data including metadata, phases, and measurements.

Access

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

Endpoint

GET/v1/runs
AuthorizationBearer <token>

API key for authentication. Use format: Bearer YOUR_API_KEY

In: header

Query Parameters

serial_numberstring

Unique serial number of the unit to retrieve test runs for. Returns all runs associated with this specific unit.

Lengthlength <= 255

Response Body

from tofupilot.v1 import TofuPilotClient

client = TofuPilotClient()
result = client.get_runs(
    serial_number={"value":"SN-2024-001234"}
)

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"
      }
    }
  }
]
{
  "code": "BAD_REQUEST",
  "message": "Part number is required but not provided and no automatic parsing is configured. Provide a part_number parameter or configure serial number parsing in organization settings.",
  "issues": []
}
{
  "code": "UNAUTHORIZED",
  "message": "Authorization not provided",
  "issues": []
}
{
  "code": "FORBIDDEN",
  "message": "Part creation failed.; Revision creation failed.; Batch creation failed.; Unit creation failed.; Version creation failed.; Plan upgrade required.; Monthly limit exceeded.",
  "issues": []
}
{
  "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?