StateMind.AI Validate API
The Validate API from StateMind.AI — 1 operation(s) for validate.
The Validate API from StateMind.AI — 1 operation(s) for validate.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/statemind-ai:statemind-ai-validate-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: python-code-validator Validate API
description: 'Proves AI-generated Python does what you asked: syntax, lint, types, an AST security policy and a credential scan, then runs the code in a throwaway container against the examples you state and repairs it until they pass — returning a fix only when running it satisfies every one of them.'
version: 1.29.0
tags:
- name: Validate
paths:
/v1/validate:
post:
summary: Validate
operationId: validate_v1_validate_post
parameters:
- name: authorization
in: header
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Authorization
- name: x-api-key
in: header
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: X-Api-Key
- name: x-forwarded-for
in: header
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: X-Forwarded-For
- name: x-client
in: header
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: X-Client
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ValidateRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/ValidateResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
tags:
- Validate
components:
schemas:
AIReport:
properties:
consulted:
type: boolean
title: Consulted
default: false
backend:
type: string
title: Backend
default: ''
calls:
type: integer
title: Calls
default: 0
duration_ms:
type: integer
title: Duration Ms
default: 0
outcome:
type: string
title: Outcome
default: not-consulted
detail:
anyOf:
- type: string
- type: 'null'
title: Detail
type: object
title: AIReport
description: 'What the optional AI refinement backend contributed.
Absent from a response when no backend is configured. Present but with
``consulted=False`` when the deterministic fixers settled the code on their
own, so a caller can tell "the model was never needed" apart from "the
model was asked and came back empty-handed".'
Diagnostic:
properties:
severity:
$ref: '#/components/schemas/Severity'
rule:
type: string
title: Rule
message:
type: string
title: Message
line:
anyOf:
- type: integer
- type: 'null'
title: Line
column:
anyOf:
- type: integer
- type: 'null'
title: Column
type: object
required:
- severity
- rule
- message
title: Diagnostic
description: A correctness problem found in the code.
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
ValidateRequest:
properties:
code:
type: string
maxLength: 200000
minLength: 1
title: Code
description: 'The source to check, as a whole file where possible: diagnostics carry the line and column of the text you send, and a fragment hides the imports and definitions the type check needs. A deployment may accept fewer bytes than the 200000 here.'
language:
$ref: '#/components/schemas/Language'
description: The language of the code. A service that does not handle it refuses the request rather than guessing; the enum is shared across services, so it lists more than any one of them accepts.
default: python
mode:
$ref: '#/components/schemas/Mode'
description: How much work to do, cheapest first. Each mode contains the one before it, so repair also reports everything static found. Only execute runs the code, and only repair and execute can bill or change the source.
default: static
options:
$ref: '#/components/schemas/Options'
description: Tuning knobs. Most of them only take effect in the mode that does the corresponding work; see each field.
type: object
required:
- code
title: ValidateRequest
description: A validation job submitted by an agent.
Options:
properties:
timeout_s:
anyOf:
- type: number
maximum: 60.0
exclusiveMinimum: 0.0
- type: 'null'
title: Timeout S
description: Wall-clock budget for running the code. Omitted means the service's own default (MSVC_DEFAULT_TIMEOUT_S). Only execute mode runs anything; a deployment may cap this below the 60 the schema allows and refuses a larger value.
max_iterations:
type: integer
maximum: 10.0
minimum: 1.0
title: Max Iterations
description: How many fix/verify rounds the repair loop may take. Ignored in static mode, which changes nothing.
default: 3
transpile_to:
anyOf:
- type: string
- type: 'null'
title: Transpile To
description: Target language for a transpiled copy, e.g. 'javascript'. The copy is made from the code as it ends up, so in repair and execute mode it translates the repaired source rather than the submitted one.
expected_output:
anyOf:
- type: string
- type: 'null'
title: Expected Output
description: Exact stdout the code must produce in execute mode. A mismatch is an 'expected-output' diagnostic and makes the response invalid, even when the program exits cleanly. Ignored in the other modes, which produce no output.
examples:
anyOf:
- type: string
- type: 'null'
title: Examples
description: 'What the code is supposed to do, as doctest lines (''>>> f(2)'' on one line, ''4'' on the next) or as plain assertions (''assert f(2) == 4''). In execute mode they are run in the sandbox: an example that does not hold is a ''python:example-mismatch'' error and makes the response invalid, and repair searches for a single-token change that makes every one of them pass. This is the only way the service can tell code that runs from code that is right, so send it whenever you know what you asked for. Examples already written in the code (''>>> '' in any string) are used the same way without this option. Ignored in the other modes, which run nothing.'
optimize:
type: boolean
title: Optimize
description: 'Run constant folding / dead-code elimination. Off by default: the optimiser rewrites the program, and a rewrite is only returned when it provably keeps every effectful construct.'
default: false
type: object
title: Options
description: Per-request tuning knobs.
Severity:
type: string
enum:
- error
- warning
- info
title: Severity
description: Severity of a single finding.
Language:
type: string
enum:
- python
- javascript
- typescript
- html
- sql
- solidity
- other
title: Language
description: Source languages a validator can accept.
Mode:
type: string
enum:
- static
- repair
- execute
title: Mode
description: "How much work the service is allowed to do.\n\n``static``\n Never executes the submitted code. Parsing, linting and security\n scanning only. This is the default and the only mode that is safe to\n expose without a container sandbox.\n``repair``\n Static mode plus deterministic auto-fixes and refactors.\n``execute``\n Repair plus running the code inside a sandbox to prove it works."
RuntimeReport:
properties:
ran:
type: boolean
title: Ran
default: false
returncode:
anyOf:
- type: integer
- type: 'null'
title: Returncode
stdout:
type: string
title: Stdout
default: ''
stderr:
type: string
title: Stderr
default: ''
duration_ms:
anyOf:
- type: integer
- type: 'null'
title: Duration Ms
timed_out:
type: boolean
title: Timed Out
default: false
sandbox:
anyOf:
- type: string
- type: 'null'
title: Sandbox
type: object
title: RuntimeReport
description: Outcome of executing the code in a sandbox.
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError
SecurityFinding:
properties:
tool:
type: string
title: Tool
id:
type: string
title: Id
severity:
$ref: '#/components/schemas/Severity'
confidence:
anyOf:
- type: string
- type: 'null'
title: Confidence
message:
type: string
title: Message
line:
anyOf:
- type: integer
- type: 'null'
title: Line
cwe:
anyOf:
- type: string
- type: 'null'
title: Cwe
type: object
required:
- tool
- id
- severity
- message
title: SecurityFinding
description: A security problem reported by one of the scanners.
Meta:
properties:
service:
type: string
title: Service
version:
type: string
title: Version
api:
type: string
title: Api
default: v1
engine:
additionalProperties:
type: string
type: object
title: Engine
ai:
anyOf:
- $ref: '#/components/schemas/AIReport'
- type: 'null'
mode:
$ref: '#/components/schemas/Mode'
default: static
duration_ms:
type: integer
title: Duration Ms
default: 0
request_id:
anyOf:
- type: string
- type: 'null'
title: Request Id
type: object
required:
- service
- version
title: Meta
description: Provenance of a response, so results stay reproducible.
ValidateResponse:
properties:
valid:
type: boolean
title: Valid
score:
type: number
maximum: 1.0
minimum: 0.0
title: Score
diagnostics:
items:
$ref: '#/components/schemas/Diagnostic'
type: array
title: Diagnostics
security:
items:
$ref: '#/components/schemas/SecurityFinding'
type: array
title: Security
fixes:
items:
type: string
type: array
title: Fixes
fixed_code:
anyOf:
- type: string
- type: 'null'
title: Fixed Code
transpiled:
anyOf:
- type: string
- type: 'null'
title: Transpiled
runtime:
$ref: '#/components/schemas/RuntimeReport'
meta:
$ref: '#/components/schemas/Meta'
type: object
required:
- valid
- score
- meta
title: ValidateResponse
description: The result an agent gets back and pays for.