---
title: "Validate Code Execution"
method: POST
path: "/v3/workflow-editor/code/validate"
tags: ["workflow-editor"]
---

# Validate Code Execution

`POST /v3/workflow-editor/code/validate`

## Request

- Base URL: `https://api.mentium.io` (the document declares no server; this is the origin it was published from)
- URL: `https://api.mentium.io/v3/workflow-editor/code/validate`
- Auth: HTTP bearer

Validate Python code for a code-execution node.

Performs static analysis (AST + ruff) without executing the code.
Returns diagnostics, and suggestions for params/code/output_schema sync.

## Headers

- `mentium-workspace-id` string, nullable

## Request body

- CodeValidateRequest: Request to validate Python code for a code-execution node.
  - `code` string, required: Python source code to validate.
  - `params` object: Current config.params keys and their values/variable refs.
  - `output_schema` object, nullable: Current output schema (JSON schema) for the node.

## Response `200`

Successful Response

- CodeValidateResponse: Response from code validation.
  - `valid` boolean, required
  - `diagnostics` CodeValidateDiagnosticOut[]
    - `severity` 'error' | 'warning' | 'info', required
    - `message` string, required
    - `line` integer, nullable
    - `column` integer, nullable
    - `rule` string, nullable
  - `suggested_params` object, nullable
  - `suggested_code` string, nullable
  - `suggested_output_schema` object, nullable

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/mentium/apis/mentium-api.md) - [All operations](https://skmtc.dev/mentium/apis/mentium-api/llms.txt) - [OpenAPI document](https://skmtc.dev/mentium/apis/mentium-api/revisions/b4ed8e59432e?raw)
