M

MooMermaid

API Reference

MooMermaid provides a high-performance REST API for validating Mermaid syntax and managing cloud-stored diagram flows. All endpoints use JSON for requests and responses.

Base URL
https://moomermaid.com

MooMermaid CLI (mmk)

The mmk terminal tool has been modernized to provide a professional developer experience with Rich-based UI components, syntax highlighting, and advanced command chaining.

Professional UI Features
  • Rich Terminal Output: All listings and results are rendered in beautiful, color-coded tables.
  • Live Status Spinners: Real-time visual feedback for all network and validation operations.
  • Syntax Highlighting: Mermaid code is automatically highlighted in the terminal for easy reading.
  • Interactive Prompts: Missing required arguments (like titles) will trigger an interactive input prompt.
Command Chaining & Piping

MooMermaid supports advanced piping for automated workflows. You can extract data from one command and pass it directly to another.

PIPE JSON TO VALIDATOR
mmk get ID --json | mmk validate

The validate command is "JSON-aware" and will automatically extract code from MooMermaid API responses when piped.

Global Flags
Flag Description
--json Suppresses UI elements and returns raw JSON (perfect for scripts/piping).
--debug Shows detailed error tracebacks and network logs.
--validate Used with save or update to trigger server-side syntax checks.
Example: Basic Workflow (Easy)
1. CREATE FROM LOCAL FILE
mmk save "Architecture V1" --file diag.mmd
2. QUICK LIST TO GET ID
mmk -l
3. DELETE WHEN DONE
mmk delete ID
Example: Power User Workflow (Advanced)
1. UPDATE TITLE AND CODE SIMULTANEOUSLY
mmk update ID --title "Final Version" --file new_code.mmd
2. TOGGLE VISIBILITY (MAKE PUBLIC)
mmk update ID --public
3. CHAINED VALIDATION (EXTRACT & CHECK)
mmk get ID --json | mmk validate

Pro Tip: Use --private to hide a diagram from public view while keeping the cloud sync active.

Quick Reference
LIST ALL (TABLE VIEW)
mmk -l
RE-VALIDATE EXISTING DIAGRAM
mmk update ID --validate
GET RAW CODE
mmk get ID --code

Authentication

Authenticate your requests by including your API key in the Authorization header as a Bearer token.

Authorization: Bearer YOUR_API_KEY

Quota & Limits

Every authenticated request (including failed ones) counts towards your API quota. You can track your usage in real-time via the response body.

Property Value
Standard Quota 5,000 Hits
Hit Trigger Any call to /api/validate or /api/codes
Body Field quota_remaining (returned in all responses)

Syntax Validation

POST /api/validate

Checks if the provided code is a valid Mermaid diagram. Supports all modern Mermaid types including Architecture and GitGraph.

Request Body
{
  "code": "graph TD\n  A --> B"
}
Success Response (200 OK)
{
  "ok": true,
  "valid": true,
  "quota_remaining": 4994
}

List Diagrams

GET /api/codes

Returns a list of all active (non-deleted) diagrams owned by the user.

Response Example
{
  "ok": true,
  "codes": [
    {
      "id": "abc123",
      "title": "Auth Flow",
      "views": 5,
      "is_live": 1,
      "url": "https://moomermaid.com/view/abc123"
    }
  ]
}

Create Diagram

POST /api/codes
Field Type Description
title string Req Diagram name (max 255)
code string Req Mermaid source code
is_live int 1 = Public, 0 = Private
Request Example
{
  "title": "New Design",
  "code": "graph LR\n  Start --> End",
  "is_live": 0
}

Check Quota

GET /api/quota

Returns detailed information about your API usage, including total hits, quota limit, and remaining requests.

Response Example
{
  "ok": true,
  "hits": 258,
  "quota": 5000,
  "remaining": 4742
}

Update Diagram

PATCH /api/codes/{id}

Partial update. Only include the fields you want to change (title, code, or is_live).

Request Example (Make Public)
{
  "is_live": 1
}

Soft Delete

DELETE /api/codes/{id}

Moves the diagram to the Trash. The item remains recoverable for 30 days via the dashboard.

Response Example
{
  "ok": true,
  "message": "Moved to trash."
}

OpenAPI Schema

Use this schema to connect MooMermaid to ChatGPT Custom GPTs or other AI agents.

Download Schema: https://moomermaid.com/api-settings

Error Codes

Status Meaning
400 Bad Request (missing fields)
401 Unauthorized (invalid API key)
403 Forbidden (Quota exceeded)
404 Not Found