Using the Translate API

Authenticating the Translate API

1. To issue a short-lived access token, run this command:

curl -X POST -F 'email=<your-email>' -F 'password=<your password>' \
https://api.staging.sinitic.ai/login/

2. A successful request will return an encoded access token as plain text in the response body. Save the valid token and send future requests with this valid token in the X-SINITIC-TOKEN header:

{
    "result": {
"company_id": "<default company id>",
        "token": "<yourshort-lived token>",
        "user_id": "<your user id>"
    }
}

3. Short-lived tokens expire after 30 minutes. You can switch a short-lived token to a long-lived token with the following command:

curl -X POST -H 'X-SINITIC-TOKEN: <your short-lived token>' \
https://api.staging.sinitic.ai/login/access_token/

 

4. A successful request will return an encoded access token as plain text in the response body:

{
    "result": {
        "token": "<your long-lived token"
    }
}

Note: If you have lost your long-lived token you can issue a new token or obtain the old token as follows:

curl -X GET -H 'X-SINITIC-TOKEN: <your short-lived token>' \
https://api.staging.sinitic.ai/login/access_token/

Using the Translate API

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

1. In order to to send the correct POST request you'll need to 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.staging.sinitic.ai/amt/model/<model_id>/inference

3. The POST request should be done with a JSON body in the following format:

{
    "source": "intermediate",
    "texts": [
        "Hello!",
        "How are you?"
    ]
}

 

Request Body

Response Body

The response body is a 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?"
        }
    ]
}
Using the Translate API
Using the Translate API
Using the Translate API
Using the Translate API

Sammy is the Head of Engineering at Proto. He specializes in backend development and cloud infrastructure. To reach Sammy, please write to him at sammy@proto.cx.