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

# Fit From File

`POST /ecm/fit-from-file`

Submit an ECM fit from an uploaded cycling data file.

Returns ``202 Accepted`` with the ``job_id``. Always includes RC-pair
parameters in the result. Optionally accepts known ``initial_soc`` /
``capacity``, or an ``ocv_soc_curve``; capacity is coulomb-count estimated
unless ``bounds_capacity`` is also given (opting in to capacity fitting).

## Query parameters

- `num_rcs` integer
- `fit_ocv` boolean
- `initial_soc` number, nullable
- `capacity` number, nullable
- `regularization` number — Smoothness-prior strength on R0/RC curves (never OCV). scale = 5 / regularization; 0 disables the prior. Defaults to 0 (off).
- `ocv_soc_curve` string, nullable — JSON-encoded OcvSocCurve, e.g. {"soc": [...], "ocv": [...]}. When provided OCV-fitting is skipped and OCV is interpolated from the curve.
- `bounds_capacity` string, nullable — JSON-encoded CapacityBounds, e.g. {"lo": 0.5, "hi": 5.0}. Providing this (with ocv_soc_curve and no capacity) opts in to fitting capacity; without it capacity is coulomb-count estimated.
- `num_knots` integer, nullable
- `num_knots_r0` integer, nullable
- `knot_schedule` string, nullable — JSON-encoded list[int], e.g. [2,4,8].
- `clamp_boundary_knots` boolean — Clamp boundary R0/alpha/beta knot values to interior neighbours. Set False when building R_rc symbolically downstream.
- `clamp_max_ratio` number

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