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

# Validate Pybamm Model Config

> Try to instantiate a pybamm/ionworks model with the given options.

Lightweight check that catches bad combinations of model name + options
*before* a record is persisted. Builds the model in-process — same code
path ``ModelService.get_pybamm_model_from_config`` uses at simulation
time — and reports whether construction succeeded.

On failure the response carries the underlying exception's message
verbatim (typically a pybamm ``OptionError`` / ``ValueError``) so the
caller can act on it.

The model is built and dropped; nothing is written to the database.



## OpenAPI

````yaml https://api.ionworks.com/openapi.json post /discovery/pybamm_models/validate
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://api.ionworks.com
    description: Production
security: []
paths:
  /discovery/pybamm_models/validate:
    post:
      tags:
        - discovery
      summary: Validate Pybamm Model Config
      description: |-
        Try to instantiate a pybamm/ionworks model with the given options.

        Lightweight check that catches bad combinations of model name + options
        *before* a record is persisted. Builds the model in-process — same code
        path ``ModelService.get_pybamm_model_from_config`` uses at simulation
        time — and reports whether construction succeeded.

        On failure the response carries the underlying exception's message
        verbatim (typically a pybamm ``OptionError`` / ``ValueError``) so the
        caller can act on it.

        The model is built and dropped; nothing is written to the database.
      operationId: validate_pybamm_model_config_discovery_pybamm_models_validate_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/_ValidatePybammModelBody'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: >-
                  Response Validate Pybamm Model Config Discovery Pybamm Models
                  Validate Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    _ValidatePybammModelBody:
      properties:
        pybamm_model:
          type: string
          title: Pybamm Model
          description: >-
            Class name to instantiate, e.g. 'DFN', 'SPM', 'ECM'. Must be one of
            the names returned by GET /discovery/pybamm_models.
        module:
          type: string
          title: Module
          description: >-
            PyBaMM submodule the class lives under ('lithium_ion' or
            'lead_acid'). Ignored for ionworks-specific models.
          default: lithium_ion
        options:
          additionalProperties: true
          type: object
          title: Options
          description: Options dict to pass to the model constructor.
      type: object
      required:
        - pybamm_model
      title: _ValidatePybammModelBody
      description: Body for ``POST /discovery/pybamm_models/validate``.
    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

````