Translate API

The Translate API allows you to embed the machine translation models in your external web app for testing or general usage.

Before starting

You need to obtain your Personal Access Token:

  1. Click your avatar
  2. Select Profile
  3. Select API tab
  4. If you don't have a Personal Access Token yet, click Issue new token button
  5. Copy the token

Using the API

You can utilize trained translation models via the Translate API with the following steps:‍

  1. To send the correct POST request, obtain the model ID
  2. Send a POST request to the following URL and set a valid access token in X-SINITIC-TOKEN header https://api.proto.cx/amt/model/<model_id>/inference‍
  3. The POST request should be done with a JSON body in the following format:
curl -X POST -H 'X-SINITIC-TOKEN: <your personal access token>' \
  https://api.proto.cx/amt/model/<model_id>/inference --data-raw '
{    
	"source": "intermediate",    
	"texts": [        
		"Hello!",        
		"How are you?"    
	]
}'

Request body format

FieldTypeDescription
sourceStringRequired. Allowed values are
- intermediate means to translate texts from English to Customer Language
- customer means to translate texts from Customer Language to English.
textsArray of StringsRequired. The array of sentences to be translated. The array can contains at most 100 strings. Each string is at most 400 characters long, include spaces and punctuation.

Response Body - JSON array with results for each text in the input array

{
    "results": [
        {
            "source_text": "Hello!",
            "target_text": "Hej!"
        },
        {
            "source_text": "how are you?",
            "target_text": "Hur mår du?"
        }
    ]
}

What’s Next