Docs
Schedule demo Open app

Update a diagram

PUT https://app.eraser.io/api/files/{fileId}/diagrams/{diagramId}

Example request

curl --location --request PUT 'https://app.eraser.io/api/files/abc123/diagrams/diag1' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $YOUR-TOKEN-HERE' \
--data '{
    "code": "A > C: Updated"
}'

Example response

{
  "id": "diag1",
  "diagramUrl": "https://app.eraser.io/workspace/abc123?diagram=diag1&layout=canvas",
  "diagramType": "sequence-diagram",
  "code": "A > C: Updated",
  "updatedAt": "2025-07-15T10:00:00.000Z"
}

Path parameters

fileId string requiredpath

ID of the file containing the diagram

diagramId string requiredpath

ID of the diagram to update

Request body

code string required

New Eraser DSL code for the diagram

Responses

200 – The updated diagram

id string required

Unique identifier for the diagram

diagramUrl string required

URL to view the diagram in the Eraser canvas

diagramType string required

Type of the diagram

  • sequence-diagram
  • entity-relationship-diagram
  • cloud-architecture-diagram
  • flowchart-diagram
  • bpmn-diagram
code string required

Eraser DSL code for the diagram

updatedAt string required

ISO 8601 timestamp of when the diagram was last updated

200 response
{
  "id": "string",
  "diagramUrl": "https://app.eraser.io/workspace/abc123?diagram=def456&layout=canvas",
  "diagramType": "sequence-diagram",
  "code": "string",
  "updatedAt": "2026-01-01T00:00:00Z"
}

400 – Invalid file ID, diagram ID, or missing code field

401 – Missing or invalid bearer token

403 – Unauthorized

404 – File or diagram not found

500 – Internal server error