---
title: "Edit"
description: "Update the content or title of an existing Mermaid diagram."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.merfolk.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Edit

## Usage

```sh
merfolk diagrams edit <id> [flags]
```

## Arguments

| Argument | Description                       |
| -------- | --------------------------------- |
| `id`     | The diagram ID to edit (required) |

## Flags

| Flag                  | Description           |
| --------------------- | --------------------- |
| `--content <mermaid>` | New Mermaid source    |
| `--title <title>`     | New title             |
| `--json`              | Output result as JSON |

## Examples

```sh
# Update content
merfolk diagrams edit abc123 --content "graph TD\n  A --> B --> C"

# Update title only
merfolk diagrams edit abc123 --title "Updated architecture"

# Pipe content from a file
cat updated.mmd | merfolk diagrams edit abc123

# Update and confirm with JSON output
merfolk diagrams edit abc123 --content "graph TD\n  A --> B" --json
```

## Output

Default output confirms the update:

```
Updated diagram abc123
View at: https://app.merfolk.io/d/abc123
```

With `--json`:

```json
{
  "id": "abc123",
  "title": "My architecture",
  "updatedAt": "2024-01-15T11:00:00Z",
  "url": "https://app.merfolk.io/d/abc123"
}
```

## Exit codes

| Code | Meaning           |
| ---- | ----------------- |
| `0`  | Diagram updated   |
| `2`  | Not authenticated |
| `3`  | Diagram not found |
| `1`  | Update failed     |

Source: https://docs.merfolk.io/cli/diagrams/edit/index.mdx
