# Publish an Explain figure

> Make an Explain figure in your own coding agent, check it with a dry run, and upload it with an API key or the anyr CLI.


# Publish an Explain figure

[Explain](https://anyrouter.dev/apps/explain) is a collection of interactive isometric figures. Make one in your coding agent, check it, and upload it.

## Write the figure

Give your agent the prompt at `https://anyrouter.dev/apps/explain/prompt.md`. The figure is one JSON object matching `https://anyrouter.dev/apps/explain/schema.json`. A figure is refused if it breaks a rule:

- Build the real machine from at least 12 parts (a few slabs is unfinished work).
- Use the tone hierarchy: a "lo" base and at least one "hi" part for the reader to watch.
- Walk the machine through 3 to 6 steps.
- Each step lights 1 to 4 parts.
- The readout changes from step to step, like a live instrument.
- Every step has its own title.
- Plain text only: no HTML, entities, markdown fences or script URLs.
- No control, zero-width or bidi characters.
- No URLs or domains in the figure's text.
- No placeholder text (TODO, lorem ipsum, Part 1, ...).
- Short lines fit the figure on a phone: hint <= 40, readout <= 32, step title <= 48, part label <= 28 characters.
- Every part is big enough to see (at least 10px a side at the figure's size).
- The figure fits its frame, assembled and pulled apart.

## Check and upload with curl

Use an API key (`sk-ar-v1-...`) from the [dashboard](https://anyrouter.dev/dashboard/keys). Save the body as `body.json`; it wraps the figure:

```json
{ "payload": { "title": "..." }, "visibility": "unlisted" }
```

```sh
# check without saving; a valid figure returns {"valid": true}
curl -sS "https://anyrouter.dev/api/v1/apps/explain/submissions?validate_only=1" \
  -H "Authorization: Bearer $ANYROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  --data @body.json

# upload (the reply includes the figure's url)
curl -sS "https://anyrouter.dev/api/v1/apps/explain/submissions" \
  -H "Authorization: Bearer $ANYROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  --data @body.json
```

A refused figure returns HTTP 422 with `error.metadata.issues`, each having `path`, `code`, `message` and `fix`:

```json
{ "error": { "metadata": { "issues": [
  { "path": "steps", "code": "step_count", "message": "2 steps; use 3 to 6",
    "fix": "Merge or split steps so there are 3 to 6." }
] } } }
```

## anyr CLI

The file holds the figure itself, not the wrapper.

```sh
anyr publish explain figure.json --dry-run
anyr publish explain figure.json
```

## Figures built with the anatomy skill

Upload the standalone HTML from `node build.mjs` (plus its `--light` build), or one SVG from `figureSvg({ standalone: "dark" })`, up to 2 MB each. Use **Make one locally**, then **Upload an /anatomy figure** on the Explain page, or the endpoint:

```sh
jq -n --rawfile c figure.html --rawfile l figure-light.html \
  '{payload: {format: "anatomy-html", content: $c, content_light: $l}, visibility: "unlisted"}' > body.json
```

Send it with the same curl calls (`?validate_only=1` to check). Use `"format": "anatomy-svg"` for an SVG.

- A page needs its figure card, plate, drawing (`<svg class="iso-svg">` with a `viewBox`), title and hint. An SVG needs the `iso-svg iso` classes, a `viewBox` and an `aria-label` title.
- Everything must be inside the file. A `<script src>`, `<link>`, form, frame, external image or `url()`, or a script using the network, cookies or storage is refused; the error names each problem with a fix.
- The figure runs in a sandbox with no network. Inline scripts and WebGL work. An SVG is shown as a still image.

## Visibility

`visibility` is `private` (only you), `unlisted` (default; anyone with the link) or `public` (joins the Collection after review).


## Related

- [Errors](/docs/guides/errors.md)
- [AnyRouter CLI](/docs/cli.md)
