API & MCP

Everything a person can do on Opsdeck ER Diagram from SQL DDL (SVG, Mermaid), a program or AI agent can do with the same inputs and get the identical result.

HTTP API

Opsdeck ER Diagram from SQL DDL (SVG, Mermaid)

Paste PostgreSQL, MySQL or SQLite DDL and get an entity-relationship diagram as SVG: tables with their columns and types, primary, foreign and unique keys, and relationships drawn in crow’s foot notation (one, zero-or-one, zero-or-many). Layered layout along foreign keys or a force-directed layout with a fixed seed, plus a Mermaid erDiagram and a text list of relationships. It is the diagram of the Opsdeck Database desk.

Inputs of Opsdeck ER Diagram from SQL DDL (SVG, Mermaid)
FieldTypeDefaultDescription
ddltextarea"-- Shop schema, version 2\nCREATE TABLE customers (\n id integer PRIMARY KEY,\Schema (DDL). CREATE TABLE (and CREATE INDEX / ALTER TABLE) statements.
dialectselect (postgresql, mysql, sqlite)"postgresql"SQL dialect
layoutselect (layered, force)"layered"Layout
seedinteger1Layout seed (force-directed). The same seed always gives the same picture; try another seed for another arrangement.
showTypesbooleantrueShow column types
titletext—Diagram title

Example request

Shop schema (PostgreSQL)

curl -X POST https://opsdeckerdiagram.usefulweb.site/api/v1/calculate -H 'content-type: application/json' -d '{"ddl":"-- Shop schema, version 2\nCREATE TABLE customers (\n  id integer PRIMARY KEY,\n  email varchar(120) NOT NULL UNIQUE,\n  full_name text,\n  phone varchar(40),\n  created_at timestamp DEFAULT CURRENT_TIMESTAMP,\n  country char(2) NOT NULL DEFAULT 'DE'\n);\n\nCREATE TABLE products (\n  sku varchar(32) PRIMARY KEY,\n  title text NOT NULL,\n  price numeric(10,2) NOT NULL CHECK (price >= 0)\n);\n\nCREATE TABLE orders (\n  id integer PRIMARY KEY,\n  customer_id integer NOT NULL REFERENCES customers (id) ON DELETE CASCADE,\n  total numeric(10,2) NOT NULL DEFAULT 0,\n  status varchar(20) NOT NULL DEFAULT 'new',\n  shipped_at timestamp\n);\nCREATE INDEX orders_status_idx ON orders (status, shipped_at);\n\nCREATE TABLE order_items (\n  order_id integer NOT NULL REFERENCES orders (id),\n  sku varchar(32) NOT NULL REFERENCES products (sku),\n  qty integer NOT NULL CHECK (qty > 0),\n  PRIMARY KEY (order_id, sku)\n);\n","dialect":"postgresql","layout":"layered","title":"Shop schema"}'

Every result contains

inputs (normalised, defaults applied), summary, result (validated against the published schema), units, assumptions, sources, warnings, computedAt and links.

MCP (Model Context Protocol)

{
  "mcpServers": {
    "opsdeck-er-diagram": { "type": "http", "url": "https://opsdeckerdiagram.usefulweb.site/mcp" }
  }
}