apyhub-logo
150 atoms
Base tier

About

This Utility API translates documents into specified languages. With support for a variety of file formats including PDF, DOC, and image files, it's a versatile tool that can handle a wide range of translation tasks.
The API follows the ISO 639-1 standard for language codes, ensuring accurate and standardized translations, which is crucial in maintaining consistency across multilingual projects.
Additionally, the utility offers a transliteration feature to Latin script, aiding in the pronunciation of non-Latin scripts. This API is a practical and smart choice for software engineers looking to expedite language translation tasks in their projects.
Supported Formats: pdf, doc, docx, png, jpg, jpeg, tiff, bmp, xlsx, pptx, html, and xml
Supported Languages for Transliteration ar, as, bn, be, bg, zh-Hans, zh-Hant, el, gu, he, hi, ja, kn, kk, ko, ky, mk, ml, mr, mn, or, fa, pa, ru, sr-Cyrl, sd, si, tg, ta, tt, te, th, uk and ur
Endpoint Selector
Input

API Playground

Documentation

Translate Text File
POST
https://api.apyhub.com/translate/file

Request example

1
curl --location --request POST 'https://api.apyhub.com/translate/file?transliteration=true' \
2
--header 'apy-token: {{token}}' \
3
--form 'file= @"sample.pdf"' \
4
--form 'language="ar"'
Method: POST
Content Type: multipart/form-data
Query Parameter(s)
AttributeTypeMandatoryDescription
transliterationBooleanNoSet to true if you wish to have the text transliterated to Latin script. Defaults to false.
Request Body
AttributeTypeMandatoryDescription
fileFileYesFile containing text. Supported file formats are pdf, doc, docx, png, jpg, jpeg, tiff, bmp, xlsx, pptx, html, and xml
languageStringYesDesired translation language. Should be specified in ISO 639-1 format.
Response
AttributeTypeDescription
detected_language.languageStringLanguage of the text extracted from the document.
detected_language.scoreDecimalScore indicating the proportion of text in the detected language, ranging from 0 to 1.
translated_languageStringLanguage to which the text has been translated.
translationStringTranslation of the extracted text in the specified language.
transliterationStringTransliteration of the extracted text to Latin script. Supported languages for transliteration are ar, as, bn, be, bg, zh-Hans, zh-Hant, el, gu, he, hi, ja, kn, kk, ko, ky, mk, ml, mr, mn, or, fa, pa, ru, sr-Cyrl, sd, si, tg, ta, tt, te, th, uk and ur
Sample Response
1
{
2
"detected_language": {
3
"language": "ar",
4
"score": 1
5
},
6
"translated_language": "en",
7
"translation": "Hello world!",
8
"transliteration": "marhaba balaalam!"
9
}

HTTP Response Codes

The method may return one of the following HTTP status codes:
Status CodeDescription
200The request was successful.
401Required authentication information is either missing or not valid for the resource.
400Invalid input
500If any unexpected error occurs while processing the request

Authentication

All requests to ApyHub services need to be authenticated, currently we support tokens or basic authentication mechanisms. You can generate and view your existing credentials from workspace settings (on the left side of the navbar) and go to applications.
Points to note:
  • Credential secrets are generated on the fly and are not stored in plain text, so on generating a credential please save the secrets somewhere safe.
  • Use the apy-token as the header parameter to pass the token.
  • Use the Authorization header to send the basic authentication credentials.

Error codes

1
{
2
"error": {
3
"code": 105,
4
"message": "Invalid URL"
5
}
6
}
To search for a specific error code, enter the code in the search box below. Alternatively, you can click on the button to view a complete list of all error codes.