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

> Fit an ECM to either an example dataset or an uploaded file.

Provide exactly one of ``example_id`` (query param) or ``file`` (multipart
upload). Returns model-vs-data traces and OCV/R0 parameter curves. RC-pair
parameters are included for superadmins and users in organizations with ECM
results access enabled via nav_config.

When ``fit_ocv`` is False and the data contains an
``Open-circuit voltage [V]`` column, the provided OCV is used directly
and only R0 + RC parameters are fitted.



## OpenAPI

````yaml https://api.ionworks.com/openapi.json post /ecm/fit
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://api.ionworks.com
    description: Production
security: []
paths:
  /ecm/fit:
    post:
      tags:
        - ecm
      summary: Fit Ecm
      description: >-
        Fit an ECM to either an example dataset or an uploaded file.


        Provide exactly one of ``example_id`` (query param) or ``file``
        (multipart

        upload). Returns model-vs-data traces and OCV/R0 parameter curves.
        RC-pair

        parameters are included for superadmins and users in organizations with
        ECM

        results access enabled via nav_config.


        When ``fit_ocv`` is False and the data contains an

        ``Open-circuit voltage [V]`` column, the provided OCV is used directly

        and only R0 + RC parameters are fitted.
      operationId: fit_ecm_ecm_fit_post
      parameters:
        - name: num_rcs
          in: query
          required: false
          schema:
            type: integer
            maximum: 5
            minimum: 0
            default: 2
            title: Num Rcs
        - name: example_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Example Id
        - 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
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_fit_ecm_ecm_fit_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Fit Ecm Ecm Fit Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    Body_fit_ecm_ecm_fit_post:
      properties:
        file:
          anyOf:
            - type: string
              contentMediaType: application/octet-stream
            - type: 'null'
          title: File
      type: object
      title: Body_fit_ecm_ecm_fit_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

````