v1

latestOpenAPI 3.1.02026-07-13121824.2 KB
Diagrams

Save Diagram

Save a generated diagram to the database.

AUTHENTICATION REQUIRED - Must include valid JWT token in Authorization header.

Args: save_request: Diagram data to save db: Database session current_user: Authenticated user

Returns: DiagramResponse with saved diagram data including ID

post/api/diagrams

Request body

titlestring required

Diagram title

descriptionstring nullable

Original user description

mermaid_codestring required

Generated Mermaid syntax

diagram_type'flowchart' | 'sequence' | 'mindmap'

Type of diagram (flowchart, sequence, or mindmap)

diagram_jsonobject required

Complete diagram state: nodes, edges, layoutDirection, positions, customizations

Example request

{
  "title": "User Authentication Flow",
  "description": "User login process with OAuth2 authentication",
  "mermaid_code": "flowchart TB\n  start([Start])\n  finish([End])",
  "diagram_type": "flowchart",
  "diagram_json": {
    "edges": [],
    "layoutDirection": "TB",
    "nodes": []
  }
}

Response

Successful Response

idinteger required

Diagram ID

user_idinteger required

User ID who created the diagram

titlestring required

Diagram title

descriptionstring nullable

Original user description

mermaid_codestring required

Mermaid diagram syntax

diagram_typestring

Type of diagram (flowchart, sequence, or mindmap)

diagram_jsonobject required

Complete diagram state: nodes, edges, layoutDirection, positions, customizations

created_atstring required

Creation timestamp (ISO format)

updated_atstring required

Last update timestamp (ISO format)

Example response

{
  "created_at": "2025-01-01T00:00:00Z",
  "description": "User login process with OAuth2",
  "diagram_json": {
    "edges": [],
    "layoutDirection": "TB",
    "nodes": []
  },
  "diagram_type": "flowchart",
  "id": 1,
  "mermaid_code": "flowchart TB\n  start([Start])",
  "title": "User Authentication Flow",
  "updated_at": "2025-01-01T00:00:00Z",
  "user_id": 1
}