---
title: "Get"
description: "Fetch a diagram's Mermaid source by ID."
---

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

# Get

## Usage

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

## Arguments

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

## Flags

| Flag     | Description                       |
| -------- | --------------------------------- |
| `--json` | Output as JSON including metadata |

## Examples

```sh
# Print diagram source to stdout
merfolk diagrams get abc123

# Get diagram with metadata as JSON
merfolk diagrams get abc123 --json

# Pipe source to a file
merfolk diagrams get abc123 > diagram.mmd
```

## Output

Default output is the raw Mermaid source:

```
graph TD
  A[User] --> B[App]
  B --> C[Database]
```

With `--json`:

```json
{
  "id": "abc123",
  "title": "My architecture",
  "content": "graph TD\n  A[User] --> B[App]",
  "updatedAt": "2024-01-15T10:30:00Z",
  "url": "https://app.merfolk.io/d/abc123"
}
```

## Exit codes

| Code | Meaning           |
| ---- | ----------------- |
| `0`  | Success           |
| `2`  | Not authenticated |
| `3`  | Diagram not found |

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