API Reference

Our API accepts form-encoded request bodies and returns JSON-encoded responses.

Testing environment

For testing purpose, use following API endpoint:

https://pool.aligner.io/test
API Reference

https://pool.aligner.io

Authentication

You need to have Aligner Pool API key for authentication. Your API key should be sent in an authorization header.

Authorization: alignerKey MY_KEY
curl --location --request POST 'https://pool.aligner.io' \
--header 'Content-Type: application/json' \
--header 'Authorization: alignerKey MY_KEY' \
--data-raw '{}'  
                                                
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "alignerKey MY_TOKEN");

var raw = JSON.stringify({});
var requestOptions = {
      method: 'POST',
      headers: myHeaders,
      body: raw,
      redirect: 'follow'
};

fetch("https://pool.aligner.io", requestOptions)
      .then(response => response.text())
      .then(result => console.log(result))
      .catch(error => console.log('error', error));                                                            
                                                      
import http.client
import mimetypes
conn = http.client.HTTPSConnection("https://pool.aligner.io", 443)
payload = "{}"
headers = {
      'Content-Type': 'application/json',
      'Authorization': 'alignerKey MY_KEY'
}
conn.request("POST", "", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))                                                            
                                                      
$curl = curl_init();

curl_setopt_array($curl, array(
      CURLOPT_URL => "https://pool.aligner.io",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 0,
      CURLOPT_FOLLOWLOCATION => true,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS =>"{}",
      CURLOPT_HTTPHEADER => array(
      "Content-Type: application/json",
      "Authorization: alignerKey MY_KEY"
      ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;                                                            
                                                      
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{}");
Request request = new Request.Builder()
.url("https://pool.aligner.io")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "alignerKey MY_KEY")
.build();
Response response = client.newCall(request).execute();                                                            
                                                      
var http = require('follow-redirects').http;
var fs = require('fs');

var options = {
      'method': 'POST',
      'hostname': 'https://pool.aligner.io',
      'headers': {
      'Content-Type': 'application/json',
      'Authorization': 'alignerKey MY_KEY'
      },
      'maxRedirects': 20
};

var req = http.request(options, function (res) {
      var chunks = [];

      res.on("data", function (chunk) {
      chunks.push(chunk);
      });

      res.on("end", function (chunk) {
      var body = Buffer.concat(chunks);
      console.log(body.toString());
      });

      res.on("error", function (error) {
      console.error(error);
      });
});

var postData = JSON.stringify({});

req.write(postData);

req.end();                                                            

                                                      
package main

import (
      "fmt"
      "strings"
      "net/http"
      "io/ioutil"
)

func main() {

      url := "https://pool.aligner.io"
      method := "POST"

      payload := strings.NewReader("")

      client := &http.Client {
      }
      req, err := http.NewRequest(method, url, payload)

      if err != nil {
      fmt.Println(err)
      }
      req.Header.Add("Content-Type", "application/json")
      req.Header.Add("Authorization", "alignerKey MY_KEY")

      res, err := client.Do(req)
      defer res.Body.Close()
      body, err := ioutil.ReadAll(res.Body)

      fmt.Println(string(body))
}                                                            
                                                      

Errors

Under responses, each response has a status field, such as SUCCESS or ERROR.

In case of ERROR, additional fields are included in response:

Field Description
code Error code. Read more about error codes
errorMessage Error message for developers
No data
No data
No data
No data
No data
No data
No data

Error codes

Field Description
4001 Request parsing error
4002 Invalid parameter(s)
5001 Order not found
5002 Unable to confirm order
5003 Unable to calculate quote
5004 Document not ready (order not delivered)
5005 Document has not been downloaded
6001 Missing header token
6002 Invalid header token type
6003 Invalid token
7001 Account is suspended
7002 Account orders are disabled
7003 Account orders has reached its limit
7004 Account files has reached its limit
8XXX System errors

Requests

Follow this basic sequence for ordering translation:

  • getQuote - get quote for document translation
  • confirmOrder - confirm the order
  • getStatuses - ask order statuses
  • document - download translated document
  • confirmDelivery - confirm order delivery

Request a quote

POST /getQuote

The getQuote request accepts following parameters:

Attributes
  • source_url mandatory

    Public URL of the file. Example: https://www.mysite.com/document.pdf.

  • source_lang mandatory

    Language being translated from. Example: english.
    Check available languages

  • target_lang mandatory

    Language being translated to. Example:estonian.
    Check available languages

  • tag optional

    Optional reference identificator

Response

The getQuote returns the following fields:

Field Description
status Request status - SUCCESS or ERROR
code On successful request the value is 1
reqular_quote.delivery_date Estimated date and time of translation delivery (Zulu)
reqular_quote.delivery_date Number of words counted
reqular_quote.price Translation price in euro
reqular_quote.order_id Order identifier
curl --location --request POST 'https://pool.aligner.io/getQuote' \
--header 'Content-Type: application/json' \
--header 'Authorization: alignerKey MY_KEY' \
--data-raw '{
      "source_url":"https://www.mysite.com/document.pdf",
      "source_lang":"estonian",
      "target_lang":"english"
}'      
                                                      
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "alignerKey MY_TOKEN");

var raw = JSON.stringify({"source_url":"https://www.mysite.com/document.pdf","source_lang":"estonian","target_lang":"english"});

var requestOptions = {
      method: 'POST',
      headers: myHeaders,
      body: raw,
      redirect: 'follow'
};

fetch("https://pool.aligner.io/getQuote", requestOptions)
      .then(response => response.text())
      .then(result => console.log(result))
      .catch(error => console.log('error', error));
                                                      
package main

import (
      "fmt"
      "strings"
      "net/http"
      "io/ioutil"
)

func main() {

      url := "https://pool.aligner.io/getQuote"
      method := "POST"

      payload := strings.NewReader("{\n	\"source_url\":\"https://www.mysite.com/document.pdf\",\n	\"source_lang\":\"estonian\",\n	\"target_lang\":\"english\"\n}")

      client := &http.Client {
      }
      req, err := http.NewRequest(method, url, payload)

      if err != nil {
      fmt.Println(err)
      }
      req.Header.Add("Content-Type", "application/json")
      req.Header.Add("Authorization", "alignerKey MY_KEY")

      res, err := client.Do(req)
      defer res.Body.Close()
      body, err := ioutil.ReadAll(res.Body)

      fmt.Println(string(body))
}
                                                      
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"source_url\":\"https://www.mysite.com/document.pdf\",\n\t\"source_lang\":\"estonian\",\n\t\"target_lang\":\"english\"\n}");
Request request = new Request.Builder()
.url("https://pool.aligner.io/getQuote")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "alignerKey MY_KEY")
.build();
Response response = client.newCall(request).execute();      
                                                      
$curl = curl_init();

curl_setopt_array($curl, array(
      CURLOPT_URL => "https://pool.aligner.io/getQuote",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 0,
      CURLOPT_FOLLOWLOCATION => true,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS =>"{\n\t\"source_url\":\"https://www.mysite.com/document.pdf\",\n\t\"source_lang\":\"estonian\",\n\t\"target_lang\":\"english\"\n}",
      CURLOPT_HTTPHEADER => array(
      "Content-Type: application/json",
      "Authorization: alignerKey MY_KEY"
      ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;      
                                                      
var http = require('follow-redirects').http;
var fs = require('fs');

var options = {
      'method': 'POST',
      'hostname': 'pool.aligner.io',
      'port': 443,
      'path': '/getQuote',
      'headers': {
      'Content-Type': 'application/json',
      'Authorization': 'alignerKey MY_KEY'
      },
      'maxRedirects': 20
};

var req = http.request(options, function (res) {
      var chunks = [];

      res.on("data", function (chunk) {
      chunks.push(chunk);
      });

      res.on("end", function (chunk) {
      var body = Buffer.concat(chunks);
      console.log(body.toString());
      });

      res.on("error", function (error) {
      console.error(error);
      });
});

var postData = JSON.stringify({"source_url":"https://www.mysite.com/document.pdf","source_lang":"estonian","target_lang":"english"});

req.write(postData);

req.end();      
                                                      
import http.client
import mimetypes
conn = http.client.HTTPSConnection("pool.aligner.io", 443)
payload = "{\n\t\"source_url\":\"https://www.mysite.com/document.pdf\",\n\t\"source_lang\":\"estonian\",\n\t\"target_lang\":\"english\"\n}"
headers = {
      'Content-Type': 'application/json',
      'Authorization': 'alignerKey MY_KEY'
}
conn.request("POST", "/getQuote", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))      
                                                      

Order confirmation

POST /confirmOrder

The confirmOrder request accepts following mandatory parameter:

Attributes
  • order_id mandatory

    Order identifier provided by getQuote. Example: 456234.

Response

The confirmOrder returns the following fields:

Field Description
status Request status - SUCCESS or ERROR
code On successful request the value is 1
order_status Order status - ACCEPTED

Order statuses

GET /getStatuses

The getStatuses request has no parameters.

Response

The getStatuses returns the following fields:

Field Description
status Request status - SUCCESS or ERROR
code On successful request the value is 1
orders.created_at Order date
orders.order_number Order number
orders.source_lang Document source language
orders.target_lang Document target language
orders.delivery_date Order delivery date and time
orders.price Order price
orders.translation_delivered Order is delivered (true or false)
orders.transaction_confirmed Order is confirmed (true or false)
orders.transaction_delivery_confirmed Order is confirmed and delivered (true or false)

On testing environment, API will return static test file as returned order. Order will be delivered after about 5 minutes.

Download translated document

GET /document/ORDER_ID

The document request has no parameters.

Response

Response body contains translated document. Headers include document extension

Header field Description
Extension Document extionsion including leading '.'

Delivery confirmation

GET /confirmDelivery/ORDER_ID

The confirmDelivery request accepts following mandatory parameter:

Attributes
  • order_id mandatory

    Order identifier provided by getQuote. Example: 456234.

Response

The confirmDelivery returns the following fields:

Field Description
status Request status - SUCCESS or ERROR
code On successful request the value is 1
order_status Order status - DELIVERY_CONFIRMED

Get supported languages

GET /getLanguages

The getLanguages request has no parameters.

Response

The getLanguages returns the following fields:

Field Description
status Request status - SUCCESS or ERROR
code On successful request the value is 1
languages[] String array of supported languages

API documentation

GET /docs

Current documentation.

General

We’re happy to answer any questions you may have.

Aligner OÜ (Tallinn HQ)
Laeva 2
Tallinn, 10151
Phone: (+372) 673 1044
Email: support@aligner.io

Monday - Friday 9.00-17.00 GMT +3 hours

Pricing

For pricing details contact us.