> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ionworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update a cell specification with nested component/material data

> Update an existing cell specification with nested component and material data.

Materials and components are automatically upserted based on uniqueness.
Only provided fields will be updated.

Example request body:
```json
{
    "capacity": 0.003,
    "anode": {
        "properties": {"diameter_mm": 16, "thickness_um": 25},
        "material": {"name": "Graphite", "manufacturer": "NewSupplier"}
    }
}
```



## OpenAPI

````yaml https://api.ionworks.com/openapi.json patch /cell_specifications/{cell_spec_id}
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://api.ionworks.com
    description: Production
security: []
paths:
  /cell_specifications/{cell_spec_id}:
    patch:
      tags:
        - Cell Specifications
      summary: Update a cell specification with nested component/material data
      description: >-
        Update an existing cell specification with nested component and material
        data.


        Materials and components are automatically upserted based on uniqueness.

        Only provided fields will be updated.


        Example request body:

        ```json

        {
            "capacity": 0.003,
            "anode": {
                "properties": {"diameter_mm": 16, "thickness_um": 25},
                "material": {"name": "Graphite", "manufacturer": "NewSupplier"}
            }
        }

        ```
      operationId: update_cell_specification_cell_specifications__cell_spec_id__patch
      parameters:
        - name: cell_spec_id
          in: path
          required: true
          schema:
            type: string
            title: Cell Spec Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCellSpecificationNested'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CellSpecificationWithComponents'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    UpdateCellSpecificationNested:
      properties:
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
          description: New name of the cell specification
        form_factor:
          anyOf:
            - type: string
            - type: 'null'
          title: Form Factor
          description: New form factor
        manufacturer:
          anyOf:
            - type: string
            - type: 'null'
          title: Manufacturer
          description: New manufacturer
        ratings:
          anyOf:
            - $ref: '#/components/schemas/Ratings'
            - type: 'null'
          description: New electrical ratings
        properties:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Properties
          description: New cell-level properties
        source:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Source
          description: New source/provenance info
        anode:
          anyOf:
            - $ref: '#/components/schemas/NestedComponentInput'
            - type: 'null'
          description: Anode component with material
        cathode:
          anyOf:
            - $ref: '#/components/schemas/NestedComponentInput'
            - type: 'null'
          description: Cathode component with material
        electrolyte:
          anyOf:
            - $ref: '#/components/schemas/NestedComponentInput'
            - type: 'null'
          description: Electrolyte component with material
        separator:
          anyOf:
            - $ref: '#/components/schemas/NestedComponentInput'
            - type: 'null'
          description: Separator component with material
        case:
          anyOf:
            - $ref: '#/components/schemas/NestedComponentInput'
            - type: 'null'
          description: Case component with material
        notes:
          anyOf:
            - type: string
            - type: 'null'
          title: Notes
          description: Notes
      type: object
      title: UpdateCellSpecificationNested
      description: >-
        Model for updating a cell specification with nested component/material
        data.


        Components and materials are upserted based on uniqueness constraints.

        All fields are optional for partial updates.
    CellSpecificationWithComponents:
      properties:
        name:
          type: string
          title: Name
          description: Name of the cell specification
        form_factor:
          anyOf:
            - type: string
            - type: 'null'
          title: Form Factor
          description: >-
            Physical form factor. Common values: '18650', '21700', 'R2032' (coin
            cell), 'pouch', 'prismatic', 'cylindrical'.
        manufacturer:
          anyOf:
            - type: string
            - type: 'null'
          title: Manufacturer
          description: Who assembled/manufactured the cell
        ratings:
          $ref: '#/components/schemas/Ratings'
          description: >-
            Electrical ratings from the spec sheet / design targets (rated
            capacity, voltage min/max, optional nominal voltage, energy, energy
            densities, max charge/discharge C-rates). See :class:`Ratings`.
        anode_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Anode Id
          description: ID of the anode component
        cathode_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Cathode Id
          description: ID of the cathode component
        electrolyte_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Electrolyte Id
          description: ID of the electrolyte component
        separator_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Separator Id
          description: ID of the separator component
        case_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Case Id
          description: ID of the case component
        properties:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Properties
          description: >-
            Other design-level properties that are not electrical ratings and
            not tied to a specific component — e.g. assembly method, overall
            cell dimensions, mass, target thickness. Numeric values must use the
            Quantity format ({'value': ..., 'unit': ...}).
        source:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Source
          description: >-
            Provenance of the design. Typical keys: 'doi', 'citation',
            'publication_date' (ISO 8601), 'license', 'creator_name',
            'creator_orcid'. Lives on the specification (not the instance)
            because it describes the published design.
        notes:
          anyOf:
            - type: string
            - type: 'null'
          title: Notes
          description: Free-text notes about the cell specification
        id:
          type: string
          title: Id
          description: Unique identifier for the cell specification
        organization_id:
          type: string
          title: Organization Id
          description: Organization ID of the cell specification
        created_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Created By
          description: User ID of the user who created this specification
        created_by_email:
          anyOf:
            - type: string
            - type: 'null'
          title: Created By Email
          description: Email of the user who created this specification
        instance_ids:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Instance Ids
          description: List of instance IDs associated with the cell specification
        anode:
          anyOf:
            - $ref: '#/components/schemas/CellComponentWithMaterial'
            - type: 'null'
          description: Anode component with material
        cathode:
          anyOf:
            - $ref: '#/components/schemas/CellComponentWithMaterial'
            - type: 'null'
          description: Cathode component with material
        electrolyte:
          anyOf:
            - $ref: '#/components/schemas/CellComponentWithMaterial'
            - type: 'null'
          description: Electrolyte component with material
        separator:
          anyOf:
            - $ref: '#/components/schemas/CellComponentWithMaterial'
            - type: 'null'
          description: Separator component with material
        case:
          anyOf:
            - $ref: '#/components/schemas/CellComponentWithMaterial'
            - type: 'null'
          description: Case component with material
      type: object
      required:
        - name
        - ratings
        - id
        - organization_id
      title: CellSpecificationWithComponents
      description: Cell specification with nested component information.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    Ratings:
      properties:
        capacity:
          $ref: '#/components/schemas/Quantity'
          description: 'Rated capacity, e.g., {''value'': 0.002, ''unit'': ''A.h''}'
        voltage_min:
          $ref: '#/components/schemas/Quantity'
          description: 'Minimum voltage, e.g., {''value'': 2.5, ''unit'': ''V''}'
        voltage_max:
          $ref: '#/components/schemas/Quantity'
          description: 'Maximum voltage, e.g., {''value'': 4.2, ''unit'': ''V''}'
        nominal_voltage:
          anyOf:
            - $ref: '#/components/schemas/Quantity'
            - type: 'null'
          description: 'Nominal voltage, e.g., {''value'': 3.6, ''unit'': ''V''}'
        energy:
          anyOf:
            - $ref: '#/components/schemas/Quantity'
            - type: 'null'
          description: 'Rated energy, e.g., {''value'': 7.2, ''unit'': ''mW.h''}'
        energy_density_gravimetric:
          anyOf:
            - $ref: '#/components/schemas/Quantity'
            - type: 'null'
          description: 'Gravimetric energy density, e.g., {value: 250, unit: ''W.h.kg-1''}'
        energy_density_volumetric:
          anyOf:
            - $ref: '#/components/schemas/Quantity'
            - type: 'null'
          description: 'Volumetric energy density, e.g., {''value'': 650, ''unit'': ''W.h.L-1''}'
        max_discharge_rate:
          anyOf:
            - $ref: '#/components/schemas/Quantity'
            - type: 'null'
          description: 'Max discharge C-rate, e.g., {''value'': 2, ''unit'': ''C''}'
        max_charge_rate:
          anyOf:
            - $ref: '#/components/schemas/Quantity'
            - type: 'null'
          description: 'Max charge C-rate, e.g., {''value'': 1, ''unit'': ''C''}'
      type: object
      required:
        - capacity
        - voltage_min
        - voltage_max
      title: Ratings
      description: Electrical ratings from spec sheet / design targets.
    NestedComponentInput:
      properties:
        properties:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Properties
          description: >-
            Application properties using Quantity format for numerics. Example:
            {'diameter': {'value': 14, 'unit': 'mm'}, 'binder': 'PVDF'}
        material:
          $ref: '#/components/schemas/NestedMaterialInput'
          description: Material for this component
      type: object
      required:
        - material
      title: NestedComponentInput
      description: Component data for nested cell spec creation. Used for upsert.
    CellComponentWithMaterial:
      properties:
        component_type:
          $ref: '#/components/schemas/ComponentType'
          description: Type of the component
        material_id:
          type: string
          title: Material Id
          description: ID of the material
        properties:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Properties
          description: >-
            Application properties using Quantity format for numerics. Example:
            {'diameter': {'value': 14, 'unit': 'mm'}, 'binder': 'PVDF'}
        id:
          type: string
          title: Id
          description: Unique identifier for the component
        organization_id:
          type: string
          title: Organization Id
          description: Organization ID of the component
        created_at:
          type: string
          format: date-time
          title: Created At
          description: Timestamp when the component was created
        updated_at:
          type: string
          format: date-time
          title: Updated At
          description: Timestamp when the component was last updated
        material:
          anyOf:
            - $ref: '#/components/schemas/Material'
            - type: 'null'
          description: The material for this component
      type: object
      required:
        - component_type
        - material_id
        - id
        - organization_id
        - created_at
        - updated_at
      title: CellComponentWithMaterial
      description: Cell component with nested material information.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    Quantity:
      properties:
        value:
          anyOf:
            - type: number
            - type: integer
          title: Value
        unit:
          type: string
          title: Unit
          description: >-
            Unit string in PyBaMM notation: '.'-separated atoms with signed
            integer exponents (e.g. 'A.h', 'mg.cm-2', 'W.h.kg-1'). Pint-style
            strings ('A*h', 'mg/cm**2') are also accepted and normalized to
            PyBaMM notation. Common units: V, A, A.h, W.h, degC, s, ohm.
      type: object
      required:
        - value
        - unit
      title: Quantity
      description: >-
        A numeric value with its physical unit.


        All numeric fields that carry physical meaning across the cell-data API

        (capacities, voltages, masses, temperatures, etc.) use this structured

        format rather than bare floats. That keeps the units on the wire so the

        server, clients, and downstream consumers cannot disagree about them.


        Canonical form:


        ```json

        {"value": 1.1, "unit": "A.h"}

        ```


        Common units used across the platform: ``V``, ``A``, ``A.h``, ``W.h``,

        ``degC``, ``s``, ``ohm``, ``mm``, ``g``, ``mg.cm-2``, ``C`` (C-rate).


        Units are stored in PyBaMM notation: ``.``-separated atoms with signed

        integer exponents and no ``*``/``/`` (``mg.cm-2``, ``A.h``,

        ``W.h.kg-1``). Pint-style strings (``mg/cm**2``, ``A*h``, ``W*h/kg``)
        are

        still accepted on input for backwards compatibility and are normalized
        to

        PyBaMM notation on construction. Either form parses correctly via

        :meth:`to_pint`.
    NestedMaterialInput:
      properties:
        name:
          type: string
          title: Name
          description: Name of the material
        definition:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Definition
          description: Material definition (formula)
        manufacturer:
          anyOf:
            - type: string
            - type: 'null'
          title: Manufacturer
          description: Manufacturer of the material
        product_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Product Id
          description: Supplier product ID
      type: object
      required:
        - name
      title: NestedMaterialInput
      description: Material data for nested cell spec creation. Used for upsert.
    ComponentType:
      type: string
      enum:
        - cathode
        - anode
        - electrolyte
        - separator
        - case
        - cell
      title: ComponentType
      description: Enum for cell component types.
    Material:
      properties:
        name:
          type: string
          title: Name
          description: Name of the material
        definition:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Definition
          description: Material definition (formula, type, constituents)
        manufacturer:
          anyOf:
            - type: string
            - type: 'null'
          title: Manufacturer
          description: Manufacturer of the material
        product_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Product Id
          description: Supplier product ID
        id:
          type: string
          title: Id
          description: Unique identifier for the material
        organization_id:
          type: string
          title: Organization Id
          description: Organization ID of the material
        created_at:
          type: string
          format: date-time
          title: Created At
          description: Timestamp when the material was created
        updated_at:
          type: string
          format: date-time
          title: Updated At
          description: Timestamp when the material was last updated
        property_count:
          type: integer
          title: Property Count
          description: Number of property datasets attached to this material
          default: 0
      type: object
      required:
        - name
        - id
        - organization_id
        - created_at
        - updated_at
      title: Material
      description: Model representing a material as returned by the API.

````