---
title: "Create"
description: "Create a new Mermaid diagram in your Merfolk account."
---

> 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.

# Create

## Usage

```sh
merfolk diagrams create [flags]
```

## Flags

| Flag                  | Description               |
| --------------------- | ------------------------- |
| `--title <title>`     | Title for the new diagram |
| `--content <mermaid>` | Initial Mermaid source    |
| `--json`              | Output result as JSON     |

## Examples

```sh
# Create an empty diagram
merfolk diagrams create --title "My diagram"

# Create with initial content
merfolk diagrams create --title "Auth flow" --content "sequenceDiagram\n  User->>App: Login"

# Pipe content from a file
cat auth.mmd | merfolk diagrams create --title "Auth flow"

# Create and capture the ID
ID=$(merfolk diagrams create --title "My diagram" --json | jq -r '.id')
```

## Output

Default output prints the new diagram ID and a link to view it:

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

With `--json`:

```json
{
  "id": "abc123",
  "title": "My diagram",
  "url": "https://app.merfolk.io/d/abc123",
  "createdAt": "2024-01-15T10:30:00Z"
}
```

## Exit codes

| Code | Meaning           |
| ---- | ----------------- |
| `0`  | Diagram created   |
| `2`  | Not authenticated |
| `1`  | Creation failed   |

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