---
title: "Validate Model Script"
method: POST
path: "/v1/models/validate"
tags: ["Models"]
---

# Validate Model Script

`POST /v1/models/validate`

## Request

- Base URL: `https://api.ensemble.markets` (the document declares no server; this is the origin it was published from)
- URL: `https://api.ensemble.markets/v1/models/validate`
- Auth: HTTP bearer

Check a model script against the contract without building it.

The same static checks a build with `script` runs first: the declared constants, the entry point, the harness imports, determinism, INPUTS, and that every entry in INPUTS.universe.default (or legacy UNIVERSE) resolves to the catalog or to one of your models. Answers 200 either way: `valid` with the derived `inputs_schema`, or `errors` naming the rule and the line. Nothing runs, nothing is stored, nothing is metered. Validation uses the versioned ENSEMBLE runtime contract.

## Request body

- ValidateRequest: A script to check against the contract.
  - `script` string, required: Your implementation. Checked statically against the contract (`GET /runtime/{kind}`) exactly as a build would check it, but never run and never stored

## Response `200`

Successful Response

- Validation: What a build would say about the script before running it.
  - `valid` boolean, required: True when a build with this script would pass validation
  - `errors` ValidationError[], required: Why not, in the order a build would report them; empty when valid
    - `type` string, required: Which rule rejected it: syntax, forbidden, price_source, nondeterministic, constants, entry_point, imports, inputs, members, universe, sources, metadata or other
    - `message` string, required: The rejection, written to teach the fix
    - `line` integer, nullable: The line named by the message, if any
  - `inputs_schema` object, nullable: The JSON Schema derived from INPUTS, when valid
  - `sources` string[], nullable: The tickers and model ids the script declares, when valid
  - `version` string, required: Harness version the script was checked against

## Other responses

- `4XX`: The request was refused; `error.type` says why
- `5XX`: The server failed; quote `X-Request-Id` when reporting it

---

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