Generate a UML diagram

Describe code structure or behavior using a generated UML diagram.

{
    "title": "Generate a UML diagram",
    "description": "",
    "method": "POST",
    "baseUrl": "https://app.docuwriter.ai",
    "endpoint": "/api/generate-uml-diagram",
    "headers": [
        {
            "key": "Authorization",
            "value": "Bearer YOUR_API_TOKEN",
            "type": "string",
            "required": true
        },
        {
            "key": "Accept",
            "value": "application/json",
            "type": "string",
            "required": true
        },
        {
            "key": "Content-Type",
            "value": "application/json",
            "type": "string",
            "required": true
        }
    ],
    "queryParams": [],
    "pathParams": [],
    "bodyType": "json",
    "requestBody": "{\n  \"source_code\": \"class Payment { authorize() {} settle() {} }\",\n  \"filename\": \"Payment.js\",\n  \"diagram_type\": \"Class Diagrams\"\n}",
    "formData": [],
    "rawBody": "",
    "responses": {
        "200": {
            "description": "HTTP 200: success: true; data.generation contains generated text; data.generation_id is the numeric saved ID; data.version_number and data.definitive_version_number identify version metadata. The response also includes data.diagram_type. Output is Markdown containing a Mermaid code block. Render it with a Mermaid-compatible renderer; the endpoint does not return an image-download URL. Illustrative JSON example; sample values are fictional. Some optional or additional resource fields may be omitted.",
            "body": "{\n  \"success\": true,\n  \"data\": {\n    \"generation\": \"```mermaid\\nclassDiagram\\nclass Payment\\n```\",\n    \"generation_id\": 456,\n    \"version_number\": 1,\n    \"definitive_version_number\": 1,\n    \"diagram_type\": \"Class Diagrams\"\n  }\n}"
        },
        "401": {
            "description": "Missing or invalid account API token.Missing or invalid account API token. Example JSON response.",
            "body": "{\n  \"message\": \"Unauthenticated.\"\n}"
        },
        "400": {
            "description": "Example: supplied code exceeds the processing budget.",
            "body": "{\n  \"success\": false,\n  \"message\": \"The provided code is too large for processing. Please reduce the amount of code and try again.\"\n}"
        }
    }
}

Request fields

Field Requirement
source_code Required source_code: source-code string.
filename Required filename: filename string.
name Optional name: saved generation title, maximum 255 characters.
diagram_type Required diagram_type is exactly one of: Class Diagrams, Sequence Diagrams, Use Case Diagrams, Activity Diagrams, Component Diagrams, State Diagrams, Object Diagrams.

Usage notes

  • Generation is synchronous and may take time.
  • The account must satisfy the generator’s current plan/credit checks (403 if denied).
  • Invalid fields return 422; code exceeding the processing token budget returns 400; upstream or output failures can return 500.
  • There is no idempotency-key contract: inspect generation history after an uncertain timeout before retrying. Errors and retries.

API authentication.

Updated