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:
- Click your avatar
- Select Profile
- Select API tab
- If you don't have a Personal Access Token yet, click Issue new token button
- Copy the token
Using the API
You can utilize trained translation models via the Translate API with the following steps:
- To send the correct POST request, obtain the model ID
- Send a POST request to the following URL and set a valid access token in
X-SINITIC-TOKEN
headerhttps://api.proto.cx/amt/model/<model_id>/inference
- 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
Field | Type | Description |
---|---|---|
source | String | Required. Allowed values are - intermediate means to translate texts from English to Customer Language- customer means to translate texts from Customer Language to English. |
texts | Array of Strings | Required. 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?"
}
]
}
Updated over 3 years ago
What’s Next