<!-- enhance-docs page=reference/mcp/canvas-inserthtml -->
<!-- enhance-docs release-sha256=3ac27d37b28bb9b2d75c6cbc6f1e88b94b3709b5b961b9ffdc1e2caf89c6167e -->

# canvas.insertHtml

<span class="reference-badge">mutation</span> <span class="reference-badge">write</span>

Use when the requested change exactly matches canvas.insertHtml; read the current state first when a version or identifier may have changed.

## Before calling

- Authenticate as the accountable Enhance person.
- Use only resource identifiers returned by an earlier capability result or supplied by the person.
- Reuse clientToken only when retrying this exact mutation input.

## Input

<details class="reference-schema">
<summary>Show complete JSON Schema</summary>

```json
{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"canvasRef":{"type":"string","minLength":1},"baseVersion":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"destination":{"type":"object","properties":{"parentNodeId":{"type":"string","minLength":1,"description":"Existing editable container, or root for top-level insertion. Preserve page and selection scope."}},"required":["parentNodeId"],"additionalProperties":false},"html":{"type":"string","minLength":1,"description":"One populated, safe HTML/CSS visual group. Use authored positioning in the HTML for placement. The canonical compiler assigns fresh IDs."},"waitMs":{"default":1500,"description":"Additional polling after the initial server call; this does not bound initial compilation time.","type":"integer","minimum":0,"maximum":5000}},"required":["canvasRef","baseVersion","destination","html"],"additionalProperties":false}
```
</details>

### Example

<details class="reference-schema">
<summary>Show example input</summary>

```json
{
 "canvasRef": "00000000-0000-4000-8000-000000000010",
 "baseVersion": 1,
 "destination": {
  "parentNodeId": "root"
 },
 "html": "<div style=\"width:400px;height:200px\">Hello</div>",
 "waitMs": 1500
}
```
</details>

## Result

Returns a typed canvas.insertHtml result from the Enhance API without transport-specific prose.

## Recovery

- BAD_REQUEST: correct the named fields and call again.
- UNAUTHORIZED: restore Enhance authentication, then retry once.
- FORBIDDEN or NOT_FOUND: check the supplied resource and selection; do not substitute unrelated content. Ask for corrected access or scope if needed.
- CONFLICT: read the current resource, merge the intended change, and retry with its version.
- INTERNAL: run Enhance diagnostics, report the failure, and stop repeating the call.

## Continue with

- Read the affected canvas resource to confirm the result.

Compatibility: `3b1c4d5d7f46f97399ed4f4f7a0f0cc8c2526d395e3796e138eef96ae54ba3f1`.
