{"openapi":"3.0.3","info":{"title":"DocMorph Studio AI Tools Engine","description":"High-performance document processing, Mermaid diagram rendering, Markdown outline extraction, and PDF compilation tools for AI Agents (ChatGPT, Claude, Cursor, Dify, Coze).","version":"1.0.0","contact":{"name":"DocMorph Studio Team","url":"https://docmorph.com"}},"servers":[{"url":"https://docmorph.dev","description":"DocMorph Studio API Server"}],"paths":{"/api/v1/tools/flowchart/render":{"post":{"operationId":"renderMermaidDiagram","summary":"Render Mermaid diagram syntax into styled SVG vector image","description":"Converts Mermaid chart code (flowcharts, sequence diagrams, class diagrams, state diagrams, gantt charts, pie charts) into clean, styled SVG vector XML and node metadata.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["syntax"],"properties":{"syntax":{"type":"string","description":"The Mermaid diagram syntax code (e.g. 'graph TD; A-->B;')","example":"graph TD;\n  A[User Order] --> B{In Stock?};\n  B -->|Yes| C[Process Payment];\n  B -->|No| D[Out of Stock Alert];"},"title":{"type":"string","description":"Optional title for the diagram header","example":"Order Processing Flow"},"theme":{"type":"string","enum":["default","neutral","dark","forest","corporate"],"default":"default","description":"Color palette theme for the rendered diagram"}}}}}},"responses":{"200":{"description":"Diagram rendered successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"chartType":{"type":"string"},"nodeCount":{"type":"integer"},"edgeCount":{"type":"integer"},"svg":{"type":"string","description":"Complete SVG vector XML string"},"dataUri":{"type":"string","description":"Base64 data URI of the SVG image"}}}}}}}}},"/api/v1/tools/markdown/extract-toc":{"post":{"operationId":"extractMarkdownToc","summary":"Extract Table of Contents and structural outline from Markdown","description":"Parses a Markdown document to extract hierarchical headings, section anchors, word counts, reading time, and an indented outline.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["markdown"],"properties":{"markdown":{"type":"string","description":"The full Markdown document text"}}}}}},"responses":{"200":{"description":"TOC extracted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"title":{"type":"string"},"headings":{"type":"array","items":{"type":"object","properties":{"level":{"type":"integer"},"text":{"type":"string"},"slug":{"type":"string"},"line":{"type":"integer"}}}},"stats":{"type":"object","properties":{"wordCount":{"type":"integer"},"charCount":{"type":"integer"},"estimatedReadingTimeMinutes":{"type":"integer"},"headingCount":{"type":"integer"}}},"summaryOutline":{"type":"string"}}}}}}}}},"/api/v1/tools/pdf/convert":{"post":{"operationId":"convertMarkdownToPdf","summary":"Compile Markdown text into publication-ready PDF document","description":"Transforms Markdown text into a formatted PDF file with customizable theme, typography, automatic pagination, headers, and page numbers.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["markdown"],"properties":{"markdown":{"type":"string","description":"Markdown text to compile into PDF"},"title":{"type":"string","description":"Optional document title"},"theme":{"type":"string","enum":["default","neutral","dark","forest","corporate"],"default":"default","description":"Styling theme for the output PDF"}}}}}},"responses":{"200":{"description":"PDF compiled successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"title":{"type":"string"},"pageCount":{"type":"integer"},"fileSize":{"type":"integer"},"pdfBase64":{"type":"string","description":"Base64 encoded PDF binary data"},"dataUri":{"type":"string","description":"Data URI for instant download or embedding"}}}}}}}}},"/api/v1/tools/pdf/parse":{"post":{"operationId":"parsePdfToMarkdown","summary":"Extract and convert PDF binary into clean structured Markdown using AI OCR","description":"Extracts text, tables, LaTeX formulas, and structure from a base64 encoded PDF document and returns clean Markdown.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["base64Pdf"],"properties":{"base64Pdf":{"type":"string","description":"Base64 encoded PDF file content"},"fileName":{"type":"string","description":"Original name of the file"},"targetLanguage":{"type":"string","description":"Optional target translation language (original, zh, en, ja, etc.)"}}}}}},"responses":{"200":{"description":"PDF parsed into Markdown successfully"}}}},"/api/v1/tools/ocr/recognize":{"post":{"operationId":"recognizeImageOcr","summary":"Multimodal AI Vision OCR - High Precision Text & Table Extraction","description":"Extracts text, complex headings, formulas, tables, and typography from images (photos, screenshots, memes, invoices, documents) across 100+ languages.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["base64Image"],"properties":{"base64Image":{"type":"string","description":"Base64 encoded image string (or data URL)"},"mimeType":{"type":"string","default":"image/png","description":"MIME type (image/png, image/jpeg, image/webp)"},"language":{"type":"string","default":"auto","description":"Language hint (auto, zh, en, ja, ko, etc.)"},"mode":{"type":"string","enum":["general","table","handwriting","meme_scene","formula"],"default":"general","description":"Specialized OCR recognition mode"}}}}}},"responses":{"200":{"description":"Text extracted and structured successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"rawText":{"type":"string"},"markdown":{"type":"string"},"detectedLanguage":{"type":"string"},"tableData":{"type":"array","items":{"type":"array","items":{"type":"string"}}},"stats":{"type":"object","properties":{"charCount":{"type":"integer"},"wordCount":{"type":"integer"},"lineCount":{"type":"integer"}}}}}}}}}}},"/api/v1/tools/ocr/assist":{"post":{"operationId":"assistOcrText","summary":"AI Assistant for OCR Text (Translate, Proofread, Summarize)","description":"Applies AI translation, spelling/grammar proofreading, or executive summary to extracted OCR text.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["text"],"properties":{"text":{"type":"string","description":"Extracted OCR text content"},"action":{"type":"string","enum":["translate","proofread","summarize"],"default":"proofread","description":"AI enhancement action to perform"},"targetLang":{"type":"string","default":"English","description":"Target language for translation"}}}}}},"responses":{"200":{"description":"AI enhancement completed successfully"}}}},"/api/v1/tools/media/inspect":{"post":{"operationId":"inspectMediaSecurity","summary":"Deep inspection of Image, Video & Audio privacy metadata (GPS, Device, Timestamps)","description":"Inspects images (EXIF/GPS/XMP), videos (MP4/MOV ISO-BMFF atoms), and audio (MP3/WAV/M4A ID3/RIFF/BWF) for sensitive hardware tags and physical location leaks.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["base64Data"],"properties":{"base64Data":{"type":"string","description":"Base64 encoded media payload or data URL"},"mediaType":{"type":"string","enum":["auto","image","video","audio"],"default":"auto"},"fileName":{"type":"string","description":"Optional filename"}}}}}},"responses":{"200":{"description":"Inspection details returned successfully"}}}},"/api/v1/tools/media/sanitize":{"post":{"operationId":"sanitizeMediaSecurity","summary":"Permanently wipe privacy metadata from Image, Video & Audio with zero quality loss","description":"Strips EXIF/GPS from images, wipes udta/timestamps from MP4/MOV videos, and removes ID3/RIFF/BWF tags from audio losslessly without re-encoding.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["base64Data"],"properties":{"base64Data":{"type":"string","description":"Base64 encoded media payload or data URL"},"mediaType":{"type":"string","enum":["auto","image","video","audio"],"default":"auto"},"fileName":{"type":"string"},"clearGps":{"type":"boolean","default":true},"clearDevice":{"type":"boolean","default":true},"clearTimestamps":{"type":"boolean","default":true}}}}}},"responses":{"200":{"description":"Media sanitized successfully with clean base64 data URI"}}}},"/api/v1/tools/token/verify":{"get":{"operationId":"verifyApiToken","summary":"Check validity and status of API / VIP token","description":"Returns authentication status, tier level, and expiration details.","responses":{"200":{"description":"Token status verified"}}}}},"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT/HMAC","description":"Optional VIP or Developer API Token. Free tier requests are accepted without a token."}}},"security":[{},{"BearerAuth":[]}]}