---
title: "Edit Diagram"
method: POST
path: "/api/ai/edit-diagram"
tags: ["ai"]
---

# Edit Diagram

`POST /api/ai/edit-diagram`

## Request

- Base URL: `https://board.noddle.dev` (the document declares no server; this is the origin it was published from)
- URL: `https://board.noddle.dev/api/ai/edit-diagram`
- Auth: none declared

Live co-editing: apply a chat instruction to the current board.

An optional ``model`` in the body selects the pool model for this chat
session; the service whitelists it (claude-*; legacy databricks-* values
are mapped) and otherwise falls back to the edit default.

``mode`` ("edit" default | "ask") picks co-editing vs consultant answers.
Both flow through the SAME up-front ✦ charge below (action
"edit_diagram", effort multiplier included) — ask mode must never become
a free bypass of the credit wallet.

## Request body

- EditDiagramBody: Request body for POST /api/ai/edit-diagram (live co-editing). ``history`` is the recent conversation (role user|assistant, text only — the CURRENT diagram is always sent fresh, never stale snapshots), so follow-ups like "change it to blue" resolve their referents.
  - `instruction` string, required
  - `diagram` object, required
  - `history` object[]
  - `mode` 'edit' | 'ask'
  - `palette` string
  - `doc_id` string
  - `image` string, nullable

## Response `200`

Successful Response

- object

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/noddle/apis/noddle-board.md) · [All operations](https://skmtc.dev/noddle/apis/noddle-board/llms.txt) · [OpenAPI document](https://skmtc.dev/noddle/apis/noddle-board/revisions/7f324e389516?raw)
