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

# Serialize Ionworks Model

> Build an ionworks model and return its pybamm ``Serialise`` JSON.

Lets callers without the licensed ``ionworkspipeline`` package use
ionworks models (``ECM``, ``LumpedSPMR``, ``GITTModel``, ...): the JSON
loads with plain ``pybamm`` via ``Serialise.load_custom_model``. Standard
pybamm models are already usable directly, so requesting one returns 400.

Returned verbatim because the JSON may contain ``Infinity``/``NaN``
literals; Python's ``json`` (and the SDK) parse these fine.



## OpenAPI

````yaml https://api.ionworks.com/openapi.json post /discovery/ionworks_models/serialize
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://api.ionworks.com
    description: Production
security: []
paths:
  /discovery/ionworks_models/serialize:
    post:
      tags:
        - discovery
      summary: Serialize Ionworks Model
      description: >-
        Build an ionworks model and return its pybamm ``Serialise`` JSON.


        Lets callers without the licensed ``ionworkspipeline`` package use

        ionworks models (``ECM``, ``LumpedSPMR``, ``GITTModel``, ...): the JSON

        loads with plain ``pybamm`` via ``Serialise.load_custom_model``.
        Standard

        pybamm models are already usable directly, so requesting one returns
        400.


        Returned verbatim because the JSON may contain ``Infinity``/``NaN``

        literals; Python's ``json`` (and the SDK) parse these fine.
      operationId: serialize_ionworks_model_discovery_ionworks_models_serialize_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/_SerializeIonworksModelBody'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    _SerializeIonworksModelBody:
      properties:
        name:
          type: string
          title: Name
          description: >-
            Ionworks model class name to build and serialize, e.g. 'ECM',
            'LumpedSPMR', 'MSMRFullCellModel', 'GITTModel'. Must be one of the
            names returned under 'ionworks_models' by GET
            /discovery/pybamm_models.
        options:
          additionalProperties: true
          type: object
          title: Options
          description: Options dict to pass to the model constructor.
      type: object
      required:
        - name
      title: _SerializeIonworksModelBody
      description: Body for ``POST /discovery/ionworks_models/serialize``.
    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

````