---
title: "Validate Pybamm Model Config"
method: POST
path: "/discovery/pybamm_models/validate"
tags: ["discovery"]
---

# Validate Pybamm Model Config

`POST /discovery/pybamm_models/validate`

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.

## Request body

- ValidatePybammModelBody — Body for ``POST /discovery/pybamm_models/validate``.
  - `pybamm_model` string, required — Class name to instantiate, e.g. 'DFN', 'SPM', 'ECM'. Must be one of the names returned by GET /discovery/pybamm_models.
  - `module` string — PyBaMM submodule the class lives under ('lithium_ion' or 'lead_acid'). Ignored for ionworks-specific models.
  - `options` object — Options dict to pass to the model constructor.

## Response `200`

Successful Response

- object

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