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

# Edit Diagram

`POST /api/ai/edit-diagram`

## Request

- Base URL: `https://draw.noddle.dev` (the document declares no server; this is the origin it was published from)
- URL: `https://draw.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 Databricks serving-endpoint
for this chat session (pool mode only); the service whitelists it (must
start with ``databricks-``) and otherwise falls back to the default
endpoint.

## 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'
  - `image` string, nullable

## Response `200`

Successful Response

- object

## Other responses

- `422`: Validation Error

---

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