> ## 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.

# Fit From Measurements

> Submit an ECM fit using measurements stored in the platform.

Returns ``202 Accepted`` with ``{"job_id": ..., "status": ...}``. Poll
``GET /jobs/{job_id}`` for the result. Always includes RC-pair
parameters in the result (authenticated endpoint).



## OpenAPI

````yaml https://api.ionworks.com/openapi.json post /ecm/fit-from-measurements
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://api.ionworks.com
    description: Production
security: []
paths:
  /ecm/fit-from-measurements:
    post:
      tags:
        - ecm-project
      summary: Fit From Measurements
      description: |-
        Submit an ECM fit using measurements stored in the platform.

        Returns ``202 Accepted`` with ``{"job_id": ..., "status": ...}``. Poll
        ``GET /jobs/{job_id}`` for the result. Always includes RC-pair
        parameters in the result (authenticated endpoint).
      operationId: fit_from_measurements_ecm_fit_from_measurements_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FitFromMeasurementsRequest'
        required: true
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    FitFromMeasurementsRequest:
      properties:
        measurements:
          items:
            $ref: '#/components/schemas/FitMeasurementRequest'
          type: array
          minItems: 1
          title: Measurements
          description: One or more measurements to fit jointly.
        ecm_options:
          $ref: '#/components/schemas/FitECMOptions'
      type: object
      required:
        - measurements
      title: FitFromMeasurementsRequest
      description: Request body for fitting ECM from database measurements.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    FitMeasurementRequest:
      properties:
        id:
          type: string
          title: Id
          description: Measurement ID.
        start_step:
          anyOf:
            - type: integer
            - type: 'null'
          title: Start Step
          description: Optional inclusive start step for filtering.
        end_step:
          anyOf:
            - type: integer
            - type: 'null'
          title: End Step
          description: Optional inclusive end step for filtering.
        initial_soc:
          anyOf:
            - type: number
              maximum: 1
              minimum: 0
            - type: 'null'
          title: Initial Soc
          description: >-
            Known initial SOC (0–1) at the start of this measurement. When None
            and an ``ocv_soc_curve`` is provided in ``ecm_options``, soc0 is
            auto-seeded by inverting V[s] = OCV(soc0) − I[s]·R0(soc0) after a
            warm-up fit. Falls back to coulomb-count for single-measurement runs
            without an OCV curve.
        capacity:
          anyOf:
            - type: number
              exclusiveMinimum: 0
            - type: 'null'
          title: Capacity
          description: >-
            Known cell capacity in Ah for this measurement. When provided for
            every measurement, the per-measurement values are used; otherwise
            the shared ``ecm_options.capacity`` (or an estimate) applies.
            Per-measurement capacity is all-or-none across measurements.
      type: object
      required:
        - id
      title: FitMeasurementRequest
      description: One measurement to include in an ECM fit.
    FitECMOptions:
      properties:
        num_rcs:
          type: integer
          maximum: 5
          minimum: 0
          title: Num Rcs
          description: Number of RC pairs.
          default: 2
        fit_ocv:
          type: boolean
          title: Fit Ocv
          description: Whether to fit OCV or use provided.
          default: true
        capacity:
          anyOf:
            - type: number
              exclusiveMinimum: 0
            - type: 'null'
          title: Capacity
          description: Known cell capacity in Ah. Estimated if not provided.
        regularization:
          type: number
          minimum: 0
          title: Regularization
          description: >-
            Smoothness-prior strength on the R0 / RC parameter curves (never
            OCV). Maps to scale = 5 / regularization; 0 disables the prior.
            Defaults to 0 (off).
          default: 0
        ocv_soc_curve:
          anyOf:
            - $ref: '#/components/schemas/OcvSocCurve'
            - type: 'null'
          description: >-
            Open-circuit voltage curve as (soc, ocv) arrays. When provided,
            OCV-fitting is skipped and OCV is interpolated from the curve.
            Mutually exclusive with measurement Open-circuit voltage [V]
            columns.
        bounds_capacity:
          anyOf:
            - $ref: '#/components/schemas/CapacityBounds'
            - type: 'null'
          description: >-
            Search bounds (Ah) for capacity fitting. Providing this (with
            ocv_soc_curve and no capacity) opts in to fitting capacity; without
            it capacity is coulomb-count estimated.
        num_knots:
          anyOf:
            - type: integer
              maximum: 64
              minimum: 1
            - type: 'null'
          title: Num Knots
          description: >-
            Number of SOC knots for RC alpha + default beta resolution. Service
            default applies when None.
        num_knots_r0:
          anyOf:
            - type: integer
              maximum: 64
              minimum: 1
            - type: 'null'
          title: Num Knots R0
          description: Number of SOC knots for R0(SoC). Service default applies when None.
        knot_schedule:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          title: Knot Schedule
          description: >-
            Multi-resolution beta knot schedule (strictly increasing positive
            ints ending at num_knots). Auto-derived when None.
        clamp_boundary_knots:
          type: boolean
          title: Clamp Boundary Knots
          description: >-
            When True (default), clamp boundary R0/alpha/beta knot values to
            within ``clamp_max_ratio`` of their interior neighbour. Set False if
            you build R_rc(soc)=alpha(soc)/beta(soc) symbolically downstream —
            the ratio is well behaved even at unobserved boundary knots and
            clamping costs fit quality.
          default: true
        clamp_max_ratio:
          type: number
          exclusiveMinimum: 1
          title: Clamp Max Ratio
          description: >-
            Cap boundary knot values at ``clamp_max_ratio`` × their interior
            neighbour (only when ``clamp_boundary_knots`` is True). Larger
            values preserve more SoC variation; smaller values are stricter
            against R_rc=alpha/beta blow-ups that destabilise pybamm forward
            simulations. Default 10.
          default: 10
      type: object
      title: FitECMOptions
      description: ECM fitting hyperparameters shared across all measurements.
    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
    OcvSocCurve:
      properties:
        soc:
          items:
            type: number
          type: array
          minItems: 2
          title: Soc
          description: Strictly increasing SOC knot values in [0, 1].
        ocv:
          items:
            type: number
          type: array
          minItems: 2
          title: Ocv
          description: OCV values in volts at each SOC knot.
      type: object
      required:
        - soc
        - ocv
      title: OcvSocCurve
      description: Open-circuit voltage as a function of state of charge.
    CapacityBounds:
      properties:
        lo:
          type: number
          exclusiveMinimum: 0
          title: Lo
          description: Lower bound (Ah).
        hi:
          type: number
          exclusiveMinimum: 0
          title: Hi
          description: Upper bound (Ah).
      type: object
      required:
        - lo
        - hi
      title: CapacityBounds
      description: Search bounds for capacity fitting (Ah).

````