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



## OpenAPI

````yaml https://api.ionworks.com/openapi.json post /ecm/fit-from-file
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://api.ionworks.com
    description: Production
security: []
paths:
  /ecm/fit-from-file:
    post:
      tags:
        - ecm-project
      summary: Fit From File
      description: >-
        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).
      operationId: fit_from_file_ecm_fit_from_file_post
      parameters:
        - name: num_rcs
          in: query
          required: false
          schema:
            type: integer
            maximum: 5
            minimum: 0
            default: 2
            title: Num Rcs
        - name: fit_ocv
          in: query
          required: false
          schema:
            type: boolean
            default: true
            title: Fit Ocv
        - name: initial_soc
          in: query
          required: false
          schema:
            anyOf:
              - type: number
                maximum: 1
                minimum: 0
              - type: 'null'
            title: Initial Soc
        - name: capacity
          in: query
          required: false
          schema:
            anyOf:
              - type: number
                exclusiveMinimum: 0
              - type: 'null'
            title: Capacity
        - name: regularization
          in: query
          required: false
          schema:
            type: number
            minimum: 0
            description: >-
              Smoothness-prior strength on R0/RC curves (never OCV). scale = 5 /
              regularization; 0 disables the prior. Defaults to 0 (off).
            default: 0
            title: Regularization
          description: >-
            Smoothness-prior strength on R0/RC curves (never OCV). scale = 5 /
            regularization; 0 disables the prior. Defaults to 0 (off).
        - name: ocv_soc_curve
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              JSON-encoded OcvSocCurve, e.g. {"soc": [...], "ocv": [...]}. When
              provided OCV-fitting is skipped and OCV is interpolated from the
              curve.
            title: Ocv Soc Curve
          description: >-
            JSON-encoded OcvSocCurve, e.g. {"soc": [...], "ocv": [...]}. When
            provided OCV-fitting is skipped and OCV is interpolated from the
            curve.
        - name: bounds_capacity
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              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.
            title: Bounds Capacity
          description: >-
            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.
        - name: num_knots
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
                maximum: 64
                minimum: 1
              - type: 'null'
            title: Num Knots
        - name: num_knots_r0
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
                maximum: 64
                minimum: 1
              - type: 'null'
            title: Num Knots R0
        - name: knot_schedule
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: JSON-encoded list[int], e.g. [2,4,8].
            title: Knot Schedule
          description: JSON-encoded list[int], e.g. [2,4,8].
        - name: clamp_boundary_knots
          in: query
          required: false
          schema:
            type: boolean
            description: >-
              Clamp boundary R0/alpha/beta knot values to interior neighbours.
              Set False when building R_rc symbolically downstream.
            default: true
            title: Clamp Boundary Knots
          description: >-
            Clamp boundary R0/alpha/beta knot values to interior neighbours. Set
            False when building R_rc symbolically downstream.
        - name: clamp_max_ratio
          in: query
          required: false
          schema:
            type: number
            exclusiveMinimum: 1
            default: 10
            title: Clamp Max Ratio
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_fit_from_file_ecm_fit_from_file_post'
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    Body_fit_from_file_ecm_fit_from_file_post:
      properties:
        file:
          type: string
          contentMediaType: application/octet-stream
          title: File
      type: object
      required:
        - file
      title: Body_fit_from_file_ecm_fit_from_file_post
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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

````