---
name: validate-wireframe
description: Validate a WireframeStudio wireframe JSON via the hosted /api/validate endpoint, returning structural errors and unknown-type warnings. Use after generating or editing a wireframe to confirm it is well-formed before rendering or implementing.
version: 1.0.0
license: MIT
homepage: https://wireframe-studio.pages.dev
---

# validate-wireframe

Call the hosted `/api/validate` endpoint to check that a wireframe JSON is structurally valid
before you render or implement it.

## When to use

- You just generated or edited a wireframe and want to confirm it is well-formed.
- You want machine-readable errors (missing/empty screens, duplicate ids, components without a
  `type`, malformed nesting) and warnings (unknown component types).

Do NOT use for:
- Authoring the JSON in the first place — see the `wireframe-schema` skill.
- Pixel/visual validation — this checks structure, not appearance.

## Endpoint

```
POST https://wireframe-studio.pages.dev/api/validate
Content-Type: application/json
```

Body: the wireframe JSON object. CORS is open (`*`).

## Response

`200` when valid, `422` when invalid, `400` when the body is not JSON. Always returns:

```json
{ "valid": true, "errors": [], "warnings": [] }
```

- `errors`: structural problems that make it invalid (present only when `valid` is false).
- `warnings`: non-fatal notes, e.g. unknown component types.

## curl

```bash
curl -sX POST https://wireframe-studio.pages.dev/api/validate \
  -H 'Content-Type: application/json' \
  -d '{"screens":[{"id":"a","components":[{"type":"card","title":"X"}]}]}'
```

## JavaScript

```js
const res = await fetch("https://wireframe-studio.pages.dev/api/validate", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify(wireframe),
});
const { valid, errors, warnings } = await res.json();
if (!valid) throw new Error(errors.join(" "));
```

## Python

```python
import json, urllib.request
req = urllib.request.Request(
    "https://wireframe-studio.pages.dev/api/validate",
    data=json.dumps(wireframe).encode(),
    headers={"Content-Type": "application/json"},
)
result = json.load(urllib.request.urlopen(req, timeout=15))
```

## Constraints

- Stateless, no auth. Validation is structural and lenient (unknown component types warn, not fail).
- The endpoint only accepts `POST`; `OPTIONS` is supported for CORS preflight.
