Cell Batch¶
Client for managing cell batches (manufacturing lots of one cell specification).
For usage examples and guides, see Data API on docs.ionworks.com.
Cell batch client for managing manufacturing lots.
This module provides the CellBatchClient for creating, reading,
updating, and deleting cell batches. A batch is a manufacturing lot — one
production run of one cell specification — that cell instances join through
their batch_id.
- class ionworks.api.cell_batch.CellBatchClient(client: Any)[source]¶
Bases:
objectClient for managing cell batches (manufacturing lots).
- __init__(client: Any) None[source]¶
Initialize the CellBatchClient.
- Parameters:
client (Any) – The HTTP client instance used for API calls.
- list(cell_spec_id: str, limit: int | None = None, offset: int | None = None, *, name: str | None = None, name_exact: str | None = None) PaginatedList[CellBatch][source]¶
List the batches of a cell specification.
Always returns a
PaginatedListwhich behaves like a regularlist. Uselimitandoffsetto control the page.- Parameters:
cell_spec_id (str) – The ID of the cell specification whose batches to list.
limit (int | None, optional) – Maximum number of batches to return per page.
offset (int | None, optional) – Number of batches to skip for pagination.
name (str | None, optional) – Case-insensitive substring match on batch name.
name_exact (str | None, optional) – Exact match on batch name. Takes precedence over
name.
- Returns:
One page of batches belonging to the specification, with
.totalfor the full count.- Return type:
- create(cell_spec_id: str, data: dict[str, Any]) CellBatch[source]¶
Create a new batch under a cell specification.
- Parameters:
cell_spec_id (str) – The ID of the cell specification the lot was manufactured to.
data (dict[str, Any]) – Batch fields.
nameis required and must be unique within the specification (compared case-insensitively). Optional:notes(str),date_manufactured(ISO date,"YYYY-MM-DD"), andproperties(dict; numeric values use the Quantity format{"value": ..., "unit": ...}).
- Returns:
The newly created batch.
- Return type:
- Raises:
IonworksError – With
error_code == "CONFLICT"(HTTP 409) if the specification already has a batch of that name;detail["existing_id"]names it. Usecreate_or_get()to resolve that automatically.
Examples
Create a lot, then file a new cell under it:
batch = client.cell_batch.create( spec.id, {"name": "LOT-2025-Q1", "date_manufactured": "2025-01-15"}, ) client.cell_instance.create( spec.id, {"name": "Cell 001", "batch_id": batch.id} )
- create_or_get(cell_spec_id: str, data: dict[str, Any]) CellBatch[source]¶
Create a new batch, or get the existing one on a name conflict.
- Parameters:
- Returns:
The batch (newly created or existing).
- Return type:
- Raises:
ValueError – If the create reported a duplicate but the existing batch could not be found by id or name.