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.
  • Memory ID - A LILT Data Source's memoryId to use with the translation - Create one here!

File Upload

Please refer to the File Upload documentation to get a File ID.

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 POST 'https://api.lilt.com/v2/translate/file?key=API_KEY&fileId=123&memoryId=1234'

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 endpoint 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 GET 'https://api.lilt.com/v2/translate/file?key=API_KEY&translationIds=1,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 endpoint. This endpoint only allows for downloading one file at a time.

curl -X GET 'https://api.lilt.com/v2/translate/files?key=API_KEY&id=1'

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

Notes

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.