IsManga API

    透過 REST API 翻譯漫畫、韓漫和國漫圖片。

    API 每次請求翻譯一張漫畫圖片。大多數圖片在 4 秒內完成,因此一次呼叫通常就能回傳翻譯結果。

    翻譯費用會從你的 API 餘額中扣除,該餘額與 IsManga 應用程式中的高級版訂閱和點數是分開的。失敗的翻譯會退款。你可以隨時為餘額儲值。

    有問題嗎?請寄電子郵件至 [email protected]。

    建立 API 金鑰

    1. 開啟你的 API 設定。
    2. 輸入金鑰名稱,然後選擇「建立金鑰」。
    3. 請立即複製金鑰,它只會顯示一次。

    同一頁面會顯示你的餘額,並有一個「最近任務」分頁,列出你最近 20 次翻譯:每次使用的金鑰、耗時、費用以及取得的圖片。

    驗證

    每次請求都要以 Bearer 權杖的形式傳送金鑰。金鑰僅供你自己的伺服器使用。API 不會傳送 CORS Header,因此瀏覽器中的頁面無法使用金鑰呼叫它。

    Authorization: Bearer $YOUR_ISMANGA_API_KEY

    快速開始

    使用 wait 建立翻譯,並從回應中讀取 result。 wait 會保持請求直到圖片處理完成,最長 20 秒。大多數圖片在 4 秒內完成,因此回應通常就是已完成的任務。

    請求

    curl -X POST "https://api.ismanga.com/v1/manga/translations?wait=20" \
      -H "Authorization: Bearer $YOUR_ISMANGA_API_KEY" \
      -H "Content-Type: application/json" \
      -H "Idempotency-Key: chapter-12-image-3-en" \
      -d '{"imageUrl": "https://example.com/image.jpg", "sourceLang": "ja-JP", "targetLang": "en-US"}'

    如果 status 仍為 "queued" 或 "processing",請使用 wait 取得任務,直到其變為 "succeeded" 或 "failed"。

    請求

    curl "https://api.ismanga.com/v1/manga/translations/<id>?wait=20" \
      -H "Authorization: Bearer $YOUR_ISMANGA_API_KEY"

    如果無法讓請求保持 20 秒,請不要使用 wait,每隔幾秒再次取得任務,直到完成。

    端點

    所有路徑都相對於 https://api.ismanga.com。

    建立翻譯

    POST/v1/manga/translations

    翻譯一張漫畫圖片。

    Header

    • Authorizationstring
      Bearer 加上你的 API 金鑰。
    • Content-Typestring
      application/json。
    • Idempotency-Keystring選填
      1 到 255 個可見 ASCII 字元。在 24 小時內使用相同金鑰和 Body 重試,會回傳原本的任務,且不會再次計費。

    查詢參數

    • waitinteger選填
      保持請求直到任務完成的秒數,範圍為 0 到 20。

    Body

    • imageUrlstring
      圖片的公開 http 或 https 網址,需符合圖片限制。請傳送 imageUrl 或 image。
    • imagestring
      原始 base64 或 data URL 格式的圖片,需符合圖片限制。請傳送 image 或 imageUrl。
    • sourceLangstring
      圖片中文字的語言,例如 ja-JP。
    • targetLangstring
      要翻譯成的語言,例如 en-US。

    回應

    一個任務物件,其 status 為 "succeeded" 或 "failed"。任務在 wait 秒內已完成。

    其他回應請見錯誤。

    請求

    curl -X POST "https://api.ismanga.com/v1/manga/translations?wait=20" \
      -H "Authorization: Bearer $YOUR_ISMANGA_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"imageUrl": "https://example.com/image.jpg", "sourceLang": "ja-JP", "targetLang": "en-US"}'

    回應

    {
        "id": "8c6b1d52-4f1e-4a53-9a0f-2c43f3c4f8a1",
        "status": "succeeded",
        "sourceLang": "ja-JP",
        "targetLang": "en-US",
        "createdAt": "2026-11-03T10:00:00.000Z",
        "completedAt": "2026-11-03T10:00:03.412Z",
        "charged": 0.001,
        "result": {
            "imageWidth": 800,
            "imageHeight": 1200,
            "regions": [
                {
                    "x": 10,
                    "y": 20,
                    "width": 30,
                    "height": 40,
                    "detectedSourceLang": "ja-JP",
                    "sourceText": "こんにちは",
                    "translatedText": "Hello",
                    "inpaintedImageUrl": "https://example.com/region.jpg",
                    "textColor": "rgb(0, 0, 0)",
                    "backgroundColor": "rgb(255, 255, 255)"
                }
            ]
        },
        "error": null
    }

    取得翻譯

    GET/v1/manga/translations/{id}

    回傳此帳號的一個任務。

    Header

    • Authorizationstring
      Bearer 加上你的 API 金鑰。

    路徑參數

    • idstring
      任務的 id。

    查詢參數

    • waitinteger選填
      保持請求直到任務完成的秒數,範圍為 0 到 20。

    回應

    一個任務物件。使用 wait 時,會在任務完成後或經過 wait 秒後回傳。

    請求

    curl "https://api.ismanga.com/v1/manga/translations/8c6b1d52-4f1e-4a53-9a0f-2c43f3c4f8a1?wait=20" \
      -H "Authorization: Bearer $YOUR_ISMANGA_API_KEY"

    回應

    {
        "id": "8c6b1d52-4f1e-4a53-9a0f-2c43f3c4f8a1",
        "status": "succeeded",
        "sourceLang": "ja-JP",
        "targetLang": "en-US",
        "createdAt": "2026-11-03T10:00:00.000Z",
        "completedAt": "2026-11-03T10:00:03.412Z",
        "charged": 0.001,
        "result": {
            "imageWidth": 800,
            "imageHeight": 1200,
            "regions": [
                {
                    "x": 10,
                    "y": 20,
                    "width": 30,
                    "height": 40,
                    "detectedSourceLang": "ja-JP",
                    "sourceText": "こんにちは",
                    "translatedText": "Hello",
                    "inpaintedImageUrl": "https://example.com/region.jpg",
                    "textColor": "rgb(0, 0, 0)",
                    "backgroundColor": "rgb(255, 255, 255)"
                }
            ]
        },
        "error": null
    }

    餘額

    GET/v1/manga/balance

    回傳你的 API 餘額。

    Header

    • Authorizationstring
      Bearer 加上你的 API 金鑰。

    回應

    你的餘額。
    • balancenumber
      你的 API 餘額,以美元計。
    • translationPricenumber
      一次翻譯的價格,以美元計。

    餘額低於 translationPrice 時,建立翻譯會回傳 402,直到你儲值。

    請求

    curl "https://api.ismanga.com/v1/manga/balance" \
      -H "Authorization: Bearer $YOUR_ISMANGA_API_KEY"

    回應

    {
        "balance": 12.4975,
        "translationPrice": 0.001
    }

    語言

    GET/v1/manga/languages

    列出 API 接受的語言代碼。

    Header

    • Authorizationstring
      Bearer 加上你的 API 金鑰。

    回應

    語言代碼。
    • sourceLangsarray
      可作為 sourceLang 傳送的代碼。
    • targetLangsarray
      可作為 targetLang 傳送的代碼。

    請求

    curl "https://api.ismanga.com/v1/manga/languages" \
      -H "Authorization: Bearer $YOUR_ISMANGA_API_KEY"

    回應

    {
        "sourceLangs": ["ja-JP", "ko-KR", "zh-CN", "en-US"],
        "targetLangs": ["en-US", "es-ES", "fr-FR", "de-DE", "pt-PT"]
    }

    物件

    任務

    • idstring
      任務的 ID。
    • statusstring
      "queued"、"processing"、"succeeded" 或 "failed"。
    • sourceLang and targetLangstring
      你傳送的語言。
    • createdAt and completedAtstring
      ISO 8601 時間。任務完成前,completedAt 為 null。
    • chargednumber
      任務從你的餘額中扣除的費用,以美元計。任務失敗後為 null。
    • errorobject
      任務失敗後設定。取得該任務仍會回傳 200,因此這不是請求錯誤。失敗的任務會退款。
      顯示子欄位隱藏子欄位
      • codestring
        圖片無法使用時為 "invalid_image",可以重試時為 "translation_failed"。
      • messagestring
        出了什麼問題。
    • resultobject
      任務成功後設定。
      顯示子欄位隱藏子欄位
      • imageWidth and imageHeightinteger
        原始圖片的尺寸。
      • regionsarray
        每個文字區域一項。圖片中沒有文字時為空,但仍會計費。
        顯示子欄位隱藏子欄位
        • x, y, width and heightinteger
          原始圖片中的區域,以像素計。
        • sourceText and translatedTextstring
          辨識出的文字及其譯文。
        • detectedSourceLangstring
          你傳送的 sourceLang。
        • inpaintedImageUrlstring
          去除文字後的區域。把它放在該區域上,然後將 translatedText 嵌入其中。任何擁有該網址的人都可以開啟它,直到它被刪除。
        • textColor and backgroundColorstring
          CSS rgb() 顏色。

    result 的任何欄位都可能為 null,例如無法儲存該圖片時的 inpaintedImageUrl。IsManga 不會保存你的圖片。

    回應

    {
        "id": "8c6b1d52-4f1e-4a53-9a0f-2c43f3c4f8a1",
        "status": "succeeded",
        "sourceLang": "ja-JP",
        "targetLang": "en-US",
        "createdAt": "2026-11-03T10:00:00.000Z",
        "completedAt": "2026-11-03T10:00:03.412Z",
        "charged": 0.001,
        "result": {
            "imageWidth": 800,
            "imageHeight": 1200,
            "regions": [
                {
                    "x": 10,
                    "y": 20,
                    "width": 30,
                    "height": 40,
                    "detectedSourceLang": "ja-JP",
                    "sourceText": "こんにちは",
                    "translatedText": "Hello",
                    "inpaintedImageUrl": "https://example.com/region.jpg",
                    "textColor": "rgb(0, 0, 0)",
                    "backgroundColor": "rgb(255, 255, 255)"
                }
            ]
        },
        "error": null
    }

    請求錯誤

    失敗的請求會回傳 4xx 或 5xx 狀態和一個 error 物件。這不是失敗任務中的 error,後者會隨 200 回傳。

    • codestring
      錯誤中的代碼之一。
    • messagestring
      出了什麼問題。Body 無效時,會列出每個失敗的欄位,以 "; " 分隔。
    • requestIdstring
      與 X-Request-Id Header 的值相同,每個回應都帶有該 Header。聯絡支援團隊時請附上它。

    回應

    {
        "error": {
            "code": "insufficient_balance",
            "message": "Your API balance is too low for this translation. Top up your balance to keep translating.",
            "requestId": "req_3f9a1c2b7d4e4b8a9c0d1e2f3a4b5c6d"
        }
    }

    錯誤

    請求失敗時,其請求錯誤的代碼為下列之一。

    狀態碼代碼含義
    400invalid_requestBody、查詢參數或 Idempotency-Key Header 不可接受,或 imageUrl 不是公開的 http 或 https 網址。
    400invalid_image圖片不是 PNG、JPEG 或 WebP,或超過 5 MB,或每邊超過 2,000 像素。
    400image_unavailable無法取得 imageUrl 的圖片。請確認該網址無需登入即可存取。
    401unauthorizedAPI 金鑰缺少或無效。
    402insufficient_balance你的 API 餘額低於一次翻譯的費用,或餘額低於零。請儲值後再試。
    404not_found該翻譯在此帳號上不存在,或路徑未知。
    409idempotency_conflict此 Idempotency-Key 已用於另一個不同的請求。
    413payload_too_large請求 Body 超過 8 MB。
    429rate_limited請求過多。請等待 Retry-After 中的時間。
    429too_many_concurrent_jobs此帳號已有 8 個翻譯正在進行中,請等待其中一個完成。
    500internal_error伺服器在處理請求時發生錯誤。請求 ID 在回應 Body 中。
    503service_unavailable翻譯服務未接受任務,或 API 定價目前無法使用。未計費。

    限制

    限制針對你的整個帳號,由其所有 API 金鑰共用。

    翻譯限制

    限制數值
    同時進行中的翻譯8
    單次請求最長等待時間20 秒

    資料保留

    資料保留時間
    任務和結果24 小時
    修復區域圖片1 至 2 天

    圖片限制

    限制數值
    格式PNG、JPEG 或 WebP
    檔案大小5 MB
    寬度和高度每邊 2,000 像素
    圖片網址公開的 http 或 https,連接埠 80 或 443,最多 2048 個字元、3 次重新導向和 10 秒
    請求 Body8 MB

    請求限制

    每個請求都計入 IP 位址限制。建立翻譯還受同時進行中的翻譯數量限制。

    限制計入的請求每分鐘
    IP 位址來自該 IP 位址的每個請求,涵蓋所有帳號和金鑰,即使 API 金鑰錯誤也會計入300

    超出限制的請求會收到 429 rate_limited 錯誤,並帶有 Retry-After Header,其值為再次嘗試前需要等待的秒數。