TofuPilotTofuPilot
v1 ReferenceRuns

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 have full access to runs
StationLimitedStations can only access runs for procedures they are linked to

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"
      }
    }
  }
]
{
  "message": "Bad request",
  "code": "BAD_REQUEST",
  "issues": []
}
{
  "message": "Unauthorized",
  "code": "UNAUTHORIZED",
  "issues": []
}
{
  "message": "Forbidden",
  "code": "FORBIDDEN",
  "issues": []
}
{
  "message": "Not found",
  "code": "NOT_FOUND",
  "issues": []
}
{
  "message": "Internal server error",
  "code": "INTERNAL_SERVER_ERROR",
  "issues": []
}

How is this guide?