Torii Image Translator API
Integrate the power of Torii's API into your own applications.
Get Started in Minutes
Start translating images with just a few lines of code.
Sign Up & Get Your Key
Create a free account and generate your unique API key from your dashboard.
Purchase Credits
Our API uses a simple credit-based system. Top up your account to start translating.
Make Your First Request
Use our simple endpoint to send an image and receive the translation instantly.
API Reference
Endpoints
Build Your Request
Authentication
Authenticate your requests by including your API key in the Authorization
header as a Bearer token.
Translate Endpoint
Request Headers
target_lang string * required
The target language code for the translation.
translator string * required
The translation model to use.
font string * required
The font to be used for the translated text.
text_align string
The alignment of the translated text.
stroke_disabled boolean
Whether to disable the text stroke/outline (useful for some documents, since Torii tries to detect the stroke and color for every word).
inpaint_only boolean
Whether to display to only remove text from the image and return a cleaned image without translations.
Request Body
The body of the request must contain the raw binary data of the image you want to translate or clean, as multipart/form-data, with the key "file" containing the image bytes.
Response Headers
success boolean
Whether the request was successful. If true, the response contains the translated or cleaned image, else the response contains an error message.
credits number
The amount of credits remaining in the account.
Response Body
The response content will contain the raw bytes of the translated or cleaned image.
Example Code
Authentication
Authenticate your requests by including your API key in the Authorization
header as a Bearer token.
OCR Endpoint
Request Body
The body of the request must contain the raw binary data of the image you want to perform OCR on, as multipart/form-data, with the key "file" containing the image bytes.
Response Headers
success boolean
Whether the request was successful. If true, the response contains the OCR result, else the response contains an error message.
credits number
The amount of credits remaining in the account.
Response Body
The response content will be a JSON object containing the extracted text from the image.
{
"angle": 0,
"width": 930,
"height": 696,
"paragraphs": [
{
"boundingBox": [10, 320, 170, 320, 170, 370, 10, 370],
"text": "Thank you very much!",
"lines": [
{
"boundingBox": [11, 326, 165, 327, 165, 361, 11, 360],
"text": "Thank you",
"words": [
{
"boundingBox": [12, 327, 100, 327, 99, 361, 11, 360],
"text": "Thank",
"confidence": 0.998
},
{
"boundingBox": [107, 327, 160, 328, 160, 361, 107, 361],
"text": "you",
"confidence": 0.998
}
]
},
{
"boundingBox": [15, 365, 180, 366, 180, 395, 15, 394],
"text": "very much!",
"words": [
{
"boundingBox": [16, 366, 80, 366, 80, 394, 16, 394],
"text": "very",
"confidence": 0.996
},
{
"boundingBox": [85, 366, 160, 366, 160, 394, 85, 394],
"text": "much!",
"confidence": 0.995
}
]
}
],
"detectedLanguage": {
"language": "ENGLISH",
"code": "en",
"confidence": 0.9
}
}
]
}
Response Fields
angle number
The detected rotation angle of the input image in degrees.
width number
The width of the input image in pixels.
height number
The height of the input image in pixels.
paragraph array
An array of objects, where each object represents a detected paragraph of text.
paragraph[].boundingBox array
An array of 8 numbers representing the four (x, y) coordinates of the bounding box surrounding the paragraph.
paragraph[].text string
The recognized text content of the paragraph.
paragraph[].lines array
An array of line objects within the paragraph.
paragraph[].lines[].boundingBox array
An array of 8 numbers representing the four (x, y) coordinates of the bounding box surrounding the line.
paragraph[].lines[].text string
The recognized text content of the line.
paragraph[].lines[].words array
An array of word objects within the line.
paragraph[].lines[].words[].boundingBox array
An array of 8 numbers representing the four (x, y) coordinates of the bounding box surrounding the word.
paragraph[].lines[].words[].text string
The text of the individual word.
paragraph[].lines[].words[].confidence number
The confidence level (0 to 1) of the word recognition.
paragraph[].detectedLanguage object
An object containing information about the detected language of the line.
paragraph[].detectedLanguage.language string
The full name of the detected language.
paragraph[].detectedLanguage.code string
The language code (e.g., "en", "ja").
paragraph[].detectedLanguage.confidence number
The confidence level (0 to 1) of the language detection.
Example Code
Manage Your API Key
Please sign in to generate and manage your API key.
Sign InYour unique API key:
Keep your API key secure. Do not share it publicly. You can only copy it once, but you can revoke it at any time and generate a new one.