Skip to main content

Instant Translate

In this walkthrough we will demonstrate how to use the LILT API Instant Translate functionality. Instant translate is a powerful way to use LILT's Transformative AI to translate your content quickly and accurately without having to wait for a human to verify the results.

Things you will need:

  • API Key - All requests throught the LILT API use the API Key to authenticate.
  • File to Translate - We recommend a simple text file (txt) for a first attempt.
  • Data Source - A LILT Data Source id to use with the translation - Create one here!

File Upload

A common step in many Lilt processes is going to be uploading a file. Before most operations involving translation you will need to upload a file and retain a fileId for further processing. Step 1 is to upload your text file into Lilt, you can do this with a POST call to the files endpoint which will allow you to upload a file:

curl -X POST \
--header "Content-Type: application/octet-stream" \
--data-binary @testfile.txt

Once you make the API call you should see a 201 Created status code and a response object that gives you the fileId:

"id": {Your File Id here},
"name": "testfile.txt",
"file_hash": "3858f62230ac3c915f300c664312c63f",
"detected_lang": "en",
"detected_lang_confidence": 0.7,
"category": "REFERENCE",
"labels": [],
"created_at": "2024-02-16T22:12:34.000Z",
"updated_at": "2024-02-16T22:12:34.000Z"

Translate File

Now that you have a file saved in LILT, let's translate it! To run an instant translation for a single file you will need to use the translate/file endpoint. The end point below will translate your file, using the provided memoryId, fileId. File Translation is an Asynchronous process.

curl --X --request POST ''

The response will be a status object that looks like this:

"id": 1,
"fileId": "2,",
"status": "InProgress",
"createdAt": 1609357135

Monitor Translation

Now that you have the translation id, you can call the Monitor end point to get the current status of your translations. You can ask for status for any number of translations at a time, we recommend bundling these translationIds together.

curl --X --request GET ',2,3,4'

The response to the Monitor end point will look the same as the POST call you made earlier. The status might be different. Here are the statuses you can expect to see:

  • InProgress - The Translation has begun!
  • Completed - Translation is Complete but not yet ready for download.
  • Failed - The Translation was unsuccessful. 🙃
  • ReadyForDownload - The Translation was Complete and is available for retrieval.

Download Translated File

Once you have the green light to download the translated file you can call the Download end point. This end point only allows for downloading one file at a time.

curl --X --request GET ''

The response to this end point will be your content translated into whatever language you picked for the Data Source!


The end points described above have additional features, but we don't recommend them for most users. If you are curious, feel free to take a look at the API Specification.