{"openapi":"3.1.0","info":{"title":"MangaTrans AI — Manga, Poster & Image Translation Open API","version":"0.1.0","description":"RESTful API for automated manga, webtoon, e-commerce poster, and image translation with seamless background cleaning, editable bubble layers, custom glossaries, and optional NSFW uncensored mode."},"servers":[{"url":"http://localhost:3000"}],"components":{"securitySchemes":{"BearerExtensionToken":{"type":"http","scheme":"bearer","bearerFormat":"ext_...","description":"Dedicated Chrome / Edge browser extension token minted via one-click pairing (`/api/v1/extension/pair/start` → `/extension/connect` → `/api/v1/extension/auth/exchange`). Pass as `Authorization: Bearer ext_...`."},"BearerApiKey":{"type":"http","scheme":"bearer","bearerFormat":"sk_...","description":"Create an API key (`sk_...`) at /settings/apikeys and pass it as `Authorization: Bearer sk_...`"}}},"security":[{"BearerExtensionToken":[]},{"BearerApiKey":[]}],"paths":{"/api/v1/translate/image":{"post":{"summary":"Translate a single manga page, poster, or image (returns clean background + editable textBlocks)","operationId":"translateImage","description":"Use preset `chart` for lossless chart-label translation with the chart fidelity mode. Chart requests use `vlm_vision` (the default for charts), cost 2 credits for authenticated callers, require one inline PNG, JPEG, or WebP via `imageBase64` (no remote URLs), and do not support NSFW or upscaling.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["targetLang"],"properties":{"imageUrl":{"type":"string","description":"Public HTTP/HTTPS URL of source image"},"imageBase64":{"type":"string","description":"Base64 data URI (data:image/png;base64,...)"},"omitEchoedOriginal":{"type":"boolean","default":false,"description":"Omit originalImageUrl when it is an exact echo of your inline upload. Ignored for charts and does not change task history."},"preset":{"type":"string","enum":["manga","poster","general","chart","uncensored_manga","inpaint_only","ocr_only"],"default":"manga"},"qualityTier":{"type":"string","enum":["standard","vlm_vision","ai_redraw"],"description":"Defaults to `standard` except for `chart`, which accepts only `vlm_vision`."},"chartRegions":{"type":"array","maxItems":12,"description":"Chart only. Omit to detect labels automatically, or provide selected label rectangles in original-image percentages. Rectangles must fit within the image.","items":{"type":"object","required":["x","y","width","height","angle","role"],"properties":{"x":{"type":"number","minimum":0,"exclusiveMaximum":100},"y":{"type":"number","minimum":0,"exclusiveMaximum":100},"width":{"type":"number","exclusiveMinimum":0,"maximum":100},"height":{"type":"number","exclusiveMinimum":0,"maximum":100},"angle":{"type":"number","enum":[0,-90,90],"description":"Only axis labels may be rotated; titles and subtitles use 0."},"role":{"type":"string","enum":["title","subtitle","axis_label"]}}}},"upscaleRatio":{"type":"number","description":"Optional output scaling. Charts require 1 (or omit)."},"sourceLang":{"type":"string","default":"auto"},"targetLang":{"type":"string","enum":["CHS","CHT","EN","JA","KO","ES","FR","DE","PT","RU","VI","TH","ID","AR","IT","TR"],"default":"CHS"},"nsfwMode":{"type":"boolean","default":false,"description":"Enables uncensored translation mode to prevent refusals or omissions on mature comics"},"ephemeralMode":{"type":"boolean","default":false,"description":"Zero-retention privacy mode: purges raw image URLs from persistence immediately after returning response"},"glossaryId":{"type":"string","description":"Optional saved glossary ID for consistent character/brand names"},"glossary":{"type":"object","additionalProperties":{"type":"string"},"description":"Inline key-value terminology map"}}}}}},"responses":{"200":{"description":"Translation completed with translatedImageUrl, inpaintedImageUrl, and editable textBlocks. Chart results include PNG output, anchored layers, and chartDiagnostics (counts and optional review regions)."}}}},"/api/v1/translate/batch":{"post":{"summary":"Batch translate up to 20 manga/poster images with cross-page context memory and optional HMAC-signed webhook callback","operationId":"translateBatch","description":"The chart preset is single-image only; use /api/v1/translate/image. Set omitEchoedOriginal to true to omit exact echoes of inline uploads from results. Ignored for webhook requests."}},"/api/v1/translate/retranslate-bubble":{"post":{"summary":"Instant single-bubble AI re-translation with selectable tone (manga_casual, faithful, ecommerce_copy)","operationId":"retranslateBubble"}},"/api/v1/glossaries/extract":{"post":{"summary":"Automatically extract recurring character names, places, skills, and brand SKUs across pages for 1-click glossary creation","operationId":"extractGlossaryTerms"}},"/api/v1/ocr":{"post":{"summary":"Detect speech bubbles and extract raw text & coordinates only","operationId":"extractOcr"}},"/api/v1/inpaint":{"post":{"summary":"Remove text from manga bubbles or posters and return a clean text-free background","operationId":"inpaintImage"}},"/api/v1/tasks/{taskId}":{"get":{"summary":"Get task status, layered textBlocks, and output URLs","operationId":"getTask"},"patch":{"summary":"Update edited textBlocks from Canvas Studio","operationId":"updateTaskLayers"},"delete":{"summary":"Permanently purge task and image data","operationId":"purgeTask"}},"/api/v1/worker/status":{"get":{"summary":"Check service readiness, scene presets, and supported languages","operationId":"getServiceStatus"}},"/api/v1/extension/pair/start":{"post":{"summary":"Start a Chrome / Edge browser extension pairing session (returns pairCode, pollSecret, authorizeUrl)","operationId":"extensionPairStart","security":[]}},"/api/v1/extension/pair/approve":{"get":{"summary":"Inspect non-sensitive pairing device info by code","operationId":"extensionPairInfo","security":[]},"post":{"summary":"Approve pairing from logged-in web session and mint a dedicated ext_... token","operationId":"extensionPairApprove"}},"/api/v1/extension/auth/exchange":{"post":{"summary":"Exchange approved pairCode (+ pollSecret or PKCE codeVerifier) for one-time ext_... access token","operationId":"extensionAuthExchange","security":[]}},"/api/v1/extension/auth/rotate":{"post":{"summary":"Seamlessly rotate the active ext_... token before expiration and revoke the old one","operationId":"extensionAuthRotate"}},"/api/v1/extension/auth/revoke":{"post":{"summary":"Immediately revoke the current ext_... token on extension sign-out","operationId":"extensionAuthRevoke"}},"/api/v1/extension/me":{"get":{"summary":"Single-call extension bootstrap: user profile, credit balance, pricing table, saved glossaries, and capabilities","operationId":"extensionMe"}},"/api/v1/extension/worker":{"get":{"summary":"Translation worker state for the extension: ready / busy / warming / cold / offline / fallback, worker and queue counts, estimated wait, and a suggested poll interval","operationId":"extensionWorker","description":"Read-only; it never starts a worker. The translate request starts it when the user clicks; poll this endpoint after pollAfterMs while state is warming or busy to show progress. Returns abstract state only; no endpoint, provider or model details."}},"/api/v1/extension/translate":{"post":{"summary":"High-speed immersive web manga translation with content-hash cache (0 credits on HIT), X-Idempotency-Key, SSRF-safe anti-hotlink fetch, and overlay payload mode","operationId":"extensionTranslate","description":"The browser extension endpoint does not support the chart preset; use /api/v1/translate/image."}}}}