TofuPilotTofuPilot
v2 Reference (Preview)/Units

Get unit

Retrieve a single unit by its serial number. Returns comprehensive unit data including part information, parent/child relationships, and test run history.

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 units
StationFullStations can get units

Endpoint

GET/v2/units/{serial_number}
AuthorizationBearer <token>

API key for authentication. Use format: Bearer YOUR_API_KEY

In: header

Path Parameters

serial_numberstring

Serial number of the unit to retrieve.

Response Body

from tofupilot.v2 import TofuPilot

# Initialize the TofuPilot client
client = TofuPilot()

# Execute the operation
result = client.units.get(
    serial_number="SN-001234"
)

# Handle response
print(result)
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "serial_number": "SN-2024-001234",
  "created_at": "2024-01-15T10:30:00Z",
  "created_by_user": {
    "id": "550e8400-e29b-41d4-a716-446655440001",
    "name": "John Doe",
    "image": "https://example.com/user-avatar.jpg"
  },
  "created_by_station": {
    "id": "550e8400-e29b-41d4-a716-446655440002",
    "name": "Assembly Station 01",
    "image": "https://example.com/station-01.jpg"
  },
  "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"
  },
  "parent": {
    "id": "550e8400-e29b-41d4-a716-446655440004",
    "serial_number": "SN-2024-001234",
    "part": {
      "id": "550e8400-e29b-41d4-a716-446655440003",
      "number": "PCB-MAIN-V2",
      "name": "Main PCB Assembly",
      "revision": {
        "id": "550e8400-e29b-41d4-a716-446655440002",
        "number": "Rev-A",
        "image": "https://example.com/revision-image.jpg"
      }
    }
  },
  "children": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440005",
      "serial_number": "SN-2024-001235",
      "part": {
        "id": "550e8400-e29b-41d4-a716-446655440006",
        "number": "PCB-SUB-V1",
        "name": "Sub Assembly PCB",
        "revision": {
          "id": "550e8400-e29b-41d4-a716-446655440007",
          "number": "Rev-B",
          "image": "https://example.com/child-revision-image.jpg"
        }
      }
    }
  ],
  "created_during": {
    "id": "550e8400-e29b-41d4-a716-446655440009",
    "created_at": "2024-01-15T10:20:00Z",
    "started_at": "2024-01-15T10:25:00Z",
    "outcome": "PASS",
    "duration": "PT5M30S",
    "procedure": {
      "id": "550e8400-e29b-41d4-a716-446655440011",
      "name": "PCB Assembly Procedure"
    }
  }
}
{
  "code": "NOT_FOUND",
  "message": "Procedure not found: {id}",
  "issues": []
}
{
  "code": "INTERNAL_SERVER_ERROR",
  "message": "Internal server error",
  "issues": []
}

How is this guide?