---
title: "Fit From Measurements"
method: POST
path: "/ecm/fit-from-measurements"
tags: ["ecm-project"]
---

# Fit From Measurements

`POST /ecm/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).

## Request body

- FitFromMeasurementsRequest — Request body for fitting ECM from database measurements.
  - `measurements` FitMeasurementRequest[], required — One or more measurements to fit jointly.
    - `id` string, required — Measurement ID.
    - `start_step` integer, nullable — Optional inclusive start step for filtering.
    - `end_step` integer, nullable — Optional inclusive end step for filtering.
    - `initial_soc` number, nullable — 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` number, nullable — 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.
  - `ecm_options` FitECMOptions — ECM fitting hyperparameters shared across all measurements.
    - `num_rcs` integer — Number of RC pairs.
    - `fit_ocv` boolean — Whether to fit OCV or use provided.
    - `capacity` number, nullable — Known cell capacity in Ah. Estimated if not provided.
    - `regularization` number — Smoothness-prior strength on the R0 / RC parameter curves (never OCV). Maps to scale = 5 / regularization; 0 disables the prior. Defaults to 0 (off).
    - `ocv_soc_curve` OcvSocCurve — Open-circuit voltage as a function of state of charge.
      - `soc` number[], required — Strictly increasing SOC knot values in [0, 1].
      - `ocv` number[], required — OCV values in volts at each SOC knot.
    - `bounds_capacity` CapacityBounds — Search bounds for capacity fitting (Ah).
      - `lo` number, required — Lower bound (Ah).
      - `hi` number, required — Upper bound (Ah).
    - `num_knots` integer, nullable — Number of SOC knots for RC alpha + default beta resolution. Service default applies when None.
    - `num_knots_r0` integer, nullable — Number of SOC knots for R0(SoC). Service default applies when None.
    - `knot_schedule` integer[], nullable — Multi-resolution beta knot schedule (strictly increasing positive ints ending at num_knots). Auto-derived when None.
    - `clamp_boundary_knots` boolean — 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.
    - `clamp_max_ratio` number — 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.

## Response `202`

Successful Response

- unknown

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/ionworks/apis/fastapi.md) · [All operations](https://skmtc.dev/ionworks/apis/fastapi/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/ionworks/fastapi/revisions/7337a3cbdaf2/schema)
