API Reference
Public REST API for image translation. Authenticate with a Bearer token, send a base64 image, get the translated image back.
Translate the text in an image, preserving the original layout, and render it back into the image.
Quick start
Get an API key
Generate one from the API Keys page.
Use the response
response.resultImage is a base64-encoded PNG with a data:image/png;base64, prefix — not an HTTP URL. Render it directly in the browser with <img src={response.resultImage} />, or save to disk by stripping the prefix and base64-decoding.
Authentication
All requests must include your API key in the Authorization header as a Bearer token:
Keys are 32-byte random tokens prefixed with sk_imagetranslate_. Treat them like passwords — store them in a server-side secret manager, never commit them to source control, never expose them in client-side code.
Idempotency
If you retry a request after a network timeout, send the same Idempotency-Key header to avoid double-charging credits:
- First call with a given key: processed normally.
- Subsequent call with the same key (per API key): returns
409 Conflictand the originalrecordId. The retry does not consume credit. - Different keys = different calls.
Generate the key on the client (UUIDv4 is fine). Without it, retries each consume a fresh credit and run Torii again.
Translate Image
Synchronous endpoint. Returns the translated image base64-encoded (with a data:image/png;base64, prefix).
Base URL
Request body
| Field | Type | Required | Description |
|---|---|---|---|
imageBase64 | string | yes | Base64-encoded image. Accepts raw base64 or full data URL (e.g. data:image/png;base64,...). Max 20MB decoded. |
sourceLanguage | string | yes | ISO code, or auto for detection. See Language values. |
targetLanguage | string | yes | ISO code. See Language values. |
mode | string | no | Translation context. Default general. See Mode values. |
translator | string | no | AI model. Default Grok. See Translator values. |
customPrompt | string | no | Extra instructions for the translator. Max 1000 characters. |
Response
| Field | Type | Description |
|---|---|---|
success | boolean | true if the translation succeeded. |
recordId | string | Unique log ID for this call. Save for support reference. |
resultImage | string | Translated image, base64-encoded with a data:image/png;base64, prefix. Not an HTTP URL — render directly with <img src={...} /> or strip the prefix and base64-decode to save. |
remainingCredit | number | Advanced credit balance after this call. |
Examples
Example response
Error codes
| Status | Meaning |
|---|---|
400 | Invalid request body or imageBase64 is not valid base64. |
401 | Missing or invalid API key. Generate one from the API Keys page. |
402 | Insufficient advanced credits. Top up via the pricing page. The call did not consume credit. |
403 | Account plan does not include API access. Upgrade to Professional or above on the pricing page. |
409 | Idempotency-Key already used. Returns { "error": "idempotency_replay", "recordId": "<id>" }. Credit was not charged. |
413 | Image exceeds 20MB after base64 decoding. Compress or downscale. |
422 | Request body failed validation (missing/invalid field). Body contains a detail array with the error location. |
429 | Rate limit exceeded for your plan. No credit charged. |
500 | Translation failed. Credit was automatically refunded. |
Error response format
- 4xx / 500:
{ "detail": "<message>" } - 422:
{ "detail": [{ "loc": [...], "msg": "...", "type": "..." }] } - 409:
{ "error": "idempotency_replay", "recordId": "<id>", "message": "..." }
Rate limits
Per-key per-minute limits based on your account plan.
| Plan | Limit |
|---|---|
| Free | not eligible |
| Starter | not eligible |
| Professional | 60 req/min |
| Enterprise | 300 req/min |
Need a higher limit? Email [email protected].
Pricing
10 advanced credits per translation call. See pricing for plan details and credit packages.
Appendix
Language values
sourceLanguage accepts an ISO 639-1 / BCP-47 code, or auto for automatic detection.
targetLanguage accepts the same codes (no auto).
Common codes:
| Code | Language | Code | Language |
|---|---|---|---|
auto | Auto-detect (source only) | pt | Portuguese |
en | English | ru | Russian |
zh | Chinese | ar | Arabic |
zh-cn | Simplified Chinese | hi | Hindi |
zh-tw | Traditional Chinese | th | Thai |
ja | Japanese | vi | Vietnamese |
ko | Korean | id | Indonesian |
es | Spanish | tr | Turkish |
fr | French | it | Italian |
de | German | nl | Dutch |
Full list — 130+ languages by region
East Asia
| Code | Language |
|---|---|
zh | Chinese |
zh-cn | Simplified Chinese |
zh-tw | Traditional Chinese |
ja | Japanese |
ko | Korean |
mn | Mongolian |
jv | Javanese |
su | Sundanese |
Southeast Asia
| Code | Language |
|---|---|
vi | Vietnamese |
th | Thai |
id | Indonesian |
ms | Malay |
my | Burmese |
km | Khmer |
lo | Lao |
fil | Filipino |
ceb | Cebuano |
ilo | Iloko |
South Asia
| Code | Language | Code | Language |
|---|---|---|---|
hi | Hindi | ne | Nepali |
bn | Bengali | si | Sinhala |
ur | Urdu | as | Assamese |
ta | Tamil | bho | Bhojpuri |
te | Telugu | dv | Divehi |
ml | Malayalam | doi | Dogri |
gu | Gujarati | gom | Konkani |
kn | Kannada | mai | Maithili |
mr | Marathi | lus | Mizo |
or | Odia | pa | Punjabi |
sa | Sanskrit | sd | Sindhi |
Africa
| Code | Language | Code | Language |
|---|---|---|---|
am | Amharic | kri | Krio |
sw | Swahili | ln | Lingala |
ha | Hausa | nso | Northern Sotho |
yo | Yoruba | om | Oromo |
zu | Zulu | st | Sesotho |
xh | Xhosa | sn | Shona |
af | Afrikaans | ti | Tigrinya |
mg | Malagasy | ts | Tsonga |
so | Somali | ak | Twi |
bm | Bambara | ee | Ewe |
ny | Chichewa | lg | Ganda |
ig | Igbo | rw | Kinyarwanda |
Europe
| Code | Language | Code | Language |
|---|---|---|---|
fr | French | lt | Lithuanian |
de | German | lv | Latvian |
es | Spanish | et | Estonian |
it | Italian | is | Icelandic |
ru | Russian | sq | Albanian |
pl | Polish | hy | Armenian |
uk | Ukrainian | az | Azerbaijani |
nl | Dutch | eu | Basque |
pt | Portuguese | be | Belarusian |
el | Greek | bs | Bosnian |
cs | Czech | ca | Catalan |
hu | Hungarian | co | Corsican |
sv | Swedish | fy | Frisian |
da | Danish | gl | Galician |
fi | Finnish | ka | Georgian |
no | Norwegian | kk | Kazakh |
ro | Romanian | ky | Kyrgyz |
bg | Bulgarian | lb | Luxembourgish |
hr | Croatian | mk | Macedonian |
sk | Slovak | mt | Maltese |
sl | Slovenian | sr | Serbian |
tg | Tajik | tt | Tatar |
tk | Turkmen | ug | Uyghur |
uz | Uzbek |
Middle East
| Code | Language |
|---|---|
ar | Arabic |
fa | Persian |
tr | Turkish |
he | Hebrew |
ku | Kurdish |
ckb | Sorani |
ps | Pashto |
Americas & Oceania
| Code | Language |
|---|---|
ay | Aymara |
gn | Guarani |
ht | Haitian Creole |
haw | Hawaiian |
qu | Quechua |
sm | Samoan |
mi | Maori |
Others
| Code | Language |
|---|---|
eo | Esperanto |
la | Latin |
cy | Welsh |
ga | Irish |
gd | Scots Gaelic |
hmn | Hmong |
yi | Yiddish |
Mode values
The mode field tunes the rendering style for different content types. Pick the one that best matches your image.
| Value | Description |
|---|---|
general (default) | Default translation without mode-specific styling. |
manga | Preserving the original text layout with text strokes. |
e-commerce | Preserving the original text layout without text strokes. |
light-novel | Overlays translated text on the image. |
Translator values
The translator field selects which AI model performs the translation. All cost 10 credits per call.
Grok(default)GeminiDeepseekChatGPTClaude
Get started
Ready to integrate? Create your first API key →