TofuPilotTofuPilot
v2 Reference (Preview)/Batches

Get batch

Retrieve a single batch by its number. Returns comprehensive batch data including associated units.

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

Endpoint

GET/v2/batches/{number}
AuthorizationBearer <token>

API key for authentication. Use format: Bearer YOUR_API_KEY

In: header

Path Parameters

numberstring

Number of the batch to retrieve.

Response Body

from tofupilot.v2 import TofuPilot

# Initialize the TofuPilot client
client = TofuPilot()

# Execute the operation
result = client.batches.get(
    number="BATCH-2024-001"
)

# Handle response
print(result)
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "number": "BATCH-2024-001",
  "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"
  },
  "units": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "serial_number": "SN-2024-001234",
      "created_at": "2024-01-15T10:30:00Z",
      "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"
        }
      }
    }
  ]
}
{
  "code": "NOT_FOUND",
  "message": "Procedure not found: {id}",
  "issues": []
}
{
  "code": "INTERNAL_SERVER_ERROR",
  "message": "Internal server error",
  "issues": []
}

How is this guide?