API
You can either make one call to the service (with a timeout of a few minutes) or launch the translation and poll for the results.
The api url is https://api.digitalpixo.com
The api url is https://api.digitalpixo.com
Remaining Translations
You can check how much translations are left for your API key.
GETapi/get_remaining_credits
- api_keystringRequiredYour api key.
fetch("https://api.digitalpixo.com/api/get_remaining_credits?api_key=hi4h2u-jk4nji")
Response:
{
"remaining_credits": 98
}
One Call Only
This send the document to the server and wait until the translated document is returned. <br />Translation time depends on the document size and server load, but should be in the order of seconds for small documents and possibly a couple minutes for larger documents.
Supported formats: JPG, JPEG, PNG, GIF, TIFF, BMP, PDF, DOCX, PPTX, XLSX, XML, HTML, TXT
Max size: 5 MBPlease note that pictures are always returned as PNG to avoid any loss in quality.
POSTdocument/translate
- api_keystringRequiredYour api key.
- filefileRequiredThe file.
- target_languagestringThe language to translate to. Defaults to "English".
- delete_onlyboolWether to delete the text only. Especially relevant for images. Defaults to false.
- editableboolWether to return an editable file format (i.e. docx for pdf). Defaults to false.
- email_addressesstringA list of email addresses (comma separated) to send the translated document to. Defaults to none.
let formData = new FormData()
formData.append(api_key: "hi4h2u-jk4nji"),
formData.append(file: document.getElementById("upload-file").files[0]),
formData.append(target_language: "German"),
formData.append(delete_only: true),
formData.append(editable: true),
formData.append(email_addresses: "contact@digitalpixo.com,example@gmail.com")
fetch("https://api.digitalpixo.com/document/translate", {
method: "POST",
body: formData
})
Response:
A File
Two Steps Call
1. Request translation
This call uploads a document and queues it for translation. The call returns a document ID which can be used to query the translation status and to download the translated document once translation is complete.
Supported formats: JPG, JPEG, PNG, GIF, TIFF, BMP, PDF, DOCX, PPTX, XLSX, XML, HTML, TXT
Max size: 5 MBPOSTdocument/request_translation
- api_keystringRequiredYour api key.
- filefileRequiredThe file.
- target_languagestringThe language to translate to. Defaults to "English".
- delete_onlyboolWether to delete the text only. Especially relevant for images. Defaults to false.
- editableboolWether to return an editable file format (i.e. docx for pdf). Defaults to false.
- email_addressesstringA list of email addresses (comma separated) to send the translated document to. Defaults to none.
let formData = new FormData()
formData.append(api_key: "hi4h2u-jk4nji"),
formData.append(file: document.getElementById("upload-file").files[0]),
formData.append(target_language: "German"),
formData.append(delete_only: true),
formData.append(editable: true),
formData.append(email_addresses: "contact@digitalpixo.com,example@gmail.com")
fetch("https://api.digitalpixo.com/document/request_translation", {
method: "POST",
body: formData
})
Response:
{
"document_id": "saa44-dfs5"
}
2. Get the results
We recommend polling this endpoint, which returns the translated file, once available.
Until then, it returns a json: {status: "in progress"}
Please note that pictures are always returned as PNG to avoid any loss in quality.
POSTdocument/get_translation
- document_idstringRequiredThe document ID returned from Step 1.
fetch("https://api.digitalpixo.com/document/get_translation", {
headers: {
"Content-Type": "application/json"
},
method: "POST",
body: JSON.stringify({
"document_id": "saa44-dfs5"
})
})
Response - If the server is still working:
{
"status": "in progress"
}
Response - If the translation is complete:
A File