IsManga API
透過 REST API 翻譯漫畫、韓漫和國漫圖片。
API 每次請求翻譯一張漫畫圖片。大多數圖片在 4 秒內完成,因此一次呼叫通常就能回傳翻譯結果。
翻譯費用會從你的 API 餘額中扣除,該餘額與 IsManga 應用程式中的高級版訂閱和點數是分開的。失敗的翻譯會退款。你可以隨時為餘額儲值。
有問題嗎?請寄電子郵件至 [email protected]。
建立 API 金鑰
- 開啟你的 API 設定。
- 輸入金鑰名稱,然後選擇「建立金鑰」。
- 請立即複製金鑰,它只會顯示一次。
同一頁面會顯示你的餘額,並有一個「最近任務」分頁,列出你最近 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。
建立翻譯
/v1/manga/translations翻譯一張漫畫圖片。
Header
AuthorizationstringBearer加上你的 API 金鑰。Content-Typestringapplication/json。Idempotency-Keystring選填1 到 255 個可見 ASCII 字元。在 24 小時內使用相同金鑰和 Body 重試,會回傳原本的任務,且不會再次計費。
查詢參數
waitinteger選填保持請求直到任務完成的秒數,範圍為 0 到 20。
Body
imageUrlstringimagestringsourceLangstring圖片中文字的語言,例如 ja-JP。targetLangstring要翻譯成的語言,例如 en-US。
回應
其他回應請見錯誤。
請求
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
}取得翻譯
/v1/manga/translations/{id}回傳此帳號的一個任務。
Header
AuthorizationstringBearer加上你的 API 金鑰。
路徑參數
idstring任務的id。
查詢參數
waitinteger選填保持請求直到任務完成的秒數,範圍為 0 到 20。
回應
請求
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
}餘額
/v1/manga/balance回傳你的 API 餘額。
Header
AuthorizationstringBearer加上你的 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
}語言
/v1/manga/languages列出 API 接受的語言代碼。
Header
AuthorizationstringBearer加上你的 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"。sourceLangandtargetLangstring你傳送的語言。createdAtandcompletedAtstringISO 8601 時間。任務完成前,completedAt為 null。chargednumber任務從你的餘額中扣除的費用,以美元計。任務失敗後為 null。errorobject任務失敗後設定。取得該任務仍會回傳 200,因此這不是請求錯誤。失敗的任務會退款。顯示子欄位隱藏子欄位
codestring圖片無法使用時為 "invalid_image",可以重試時為 "translation_failed"。messagestring出了什麼問題。
resultobject任務成功後設定。顯示子欄位隱藏子欄位
imageWidthandimageHeightinteger原始圖片的尺寸。regionsarray每個文字區域一項。圖片中沒有文字時為空,但仍會計費。顯示子欄位隱藏子欄位
x,y,widthandheightinteger原始圖片中的區域,以像素計。sourceTextandtranslatedTextstring辨識出的文字及其譯文。detectedSourceLangstring你傳送的sourceLang。inpaintedImageUrlstring去除文字後的區域。把它放在該區域上,然後將translatedText嵌入其中。任何擁有該網址的人都可以開啟它,直到它被刪除。textColorandbackgroundColorstringCSSrgb()顏色。
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-IdHeader 的值相同,每個回應都帶有該 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"
}
}錯誤
請求失敗時,其請求錯誤的代碼為下列之一。
| 狀態碼 | 代碼 | 含義 |
|---|---|---|
| 400 | invalid_request | Body、查詢參數或 Idempotency-Key Header 不可接受,或 imageUrl 不是公開的 http 或 https 網址。 |
| 400 | invalid_image | 圖片不是 PNG、JPEG 或 WebP,或超過 5 MB,或每邊超過 2,000 像素。 |
| 400 | image_unavailable | 無法取得 imageUrl 的圖片。請確認該網址無需登入即可存取。 |
| 401 | unauthorized | API 金鑰缺少或無效。 |
| 402 | insufficient_balance | 你的 API 餘額低於一次翻譯的費用,或餘額低於零。請儲值後再試。 |
| 404 | not_found | 該翻譯在此帳號上不存在,或路徑未知。 |
| 409 | idempotency_conflict | 此 Idempotency-Key 已用於另一個不同的請求。 |
| 413 | payload_too_large | 請求 Body 超過 8 MB。 |
| 429 | rate_limited | 請求過多。請等待 Retry-After 中的時間。 |
| 429 | too_many_concurrent_jobs | 此帳號已有 8 個翻譯正在進行中,請等待其中一個完成。 |
| 500 | internal_error | 伺服器在處理請求時發生錯誤。請求 ID 在回應 Body 中。 |
| 503 | service_unavailable | 翻譯服務未接受任務,或 API 定價目前無法使用。未計費。 |
限制
限制針對你的整個帳號,由其所有 API 金鑰共用。
翻譯限制
| 限制 | 數值 |
|---|---|
| 同時進行中的翻譯 | 8 |
| 單次請求最長等待時間 | 20 秒 |
資料保留
| 資料 | 保留時間 |
|---|---|
| 任務和結果 | 24 小時 |
| 修復區域圖片 | 1 至 2 天 |
圖片限制
| 限制 | 數值 |
|---|---|
| 格式 | PNG、JPEG 或 WebP |
| 檔案大小 | 5 MB |
| 寬度和高度 | 每邊 2,000 像素 |
| 圖片網址 | 公開的 http 或 https,連接埠 80 或 443,最多 2048 個字元、3 次重新導向和 10 秒 |
| 請求 Body | 8 MB |
請求限制
每個請求都計入 IP 位址限制。建立翻譯還受同時進行中的翻譯數量限制。
| 限制 | 計入的請求 | 每分鐘 |
|---|---|---|
| IP 位址 | 來自該 IP 位址的每個請求,涵蓋所有帳號和金鑰,即使 API 金鑰錯誤也會計入 | 300 |
超出限制的請求會收到 429 rate_limited 錯誤,並帶有 Retry-After Header,其值為再次嘗試前需要等待的秒數。