Lengoo Connect API (1.0.0-rc.1)

Download OpenAPI specification:Download

Introduction

Lengoo Connect API is a RESTful HTTP API that provides a way to programmatically interface with Lengoo's translation process. It allows creating translation jobs and getting notified when they're completed and ready for delivery.

Using this API

This API is available to Customers who have commercial agreements in place that allow for translation Jobs to be automatically approved.

The basic workflow consists of providing source texts, defining the Job parameters, and then either polling the Job endpoint or waiting for a webhook to fire when the translation is done.

You can add arbitrary metadata to Files and Jobs too. This is a way to store any information you might need for your integration. For example, you can use it to store the information related to the pages or blocks in your CMS that a File or a Job is about. Additionally files have an additional field for storing reference IDs to enable easy processing. That way, you don't need to run a database on your side. No particular format is enforced for that metadata.

1. Authentication

Every HTTP call to the API requires OAuth2 authentication.

Invalid credentials result in an HTTP 401 Forbidden error response.

A client ID and secret is required. To request for client ID and secret or decommision one reach out to your account manager or sales rep.

Base64 encode the client ID and secret using command.

echo -n clientid:clientsecret | base64

Copy value and then pass through Basic Authentication.

Note that the scope of the request should be connect_api.

  curl --request POST \
    --url https://id.lengoo.com/oauth2/aus2i12rp7MwhLcLB417/v1/token \
    --header 'accept: application/json' \
    --header 'authorization: Basic MG9hY...' \
    --header 'cache-control: no-cache' \
    --header 'content-type: application/x-www-form-urlencoded' \
    --data 'grant_type=client_credentials&scope=connect_api'

Add the Token to the Authorization header on every request made. The Authorization type is the Bearer Token and the value is the Token generated from the earlier request.

Example:

  curl --location --request GET '{baseUrl}/api/jobs' \
  --header 'authorization: Bearer eyJra...' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "name": "Spring Collection Landing Page",
    "description": "Translation of the Spring Collection Landing Page on our marketing website",
    "sourceLanguage": "de-AT",
    "targetLanguages": ["en-US"],
    "files": [
        {
            "id": "d7e9f332-afe2-4005-aa52-8cfd361b391c"
        }
    ]
  }'

2. Source texts

In order to start a translation Job, it's necessary to have source texts to translate. Currently there's only one way to provide them: as files.

Upload them using the Files endpoint. That will give each file a unique URI you can use when creating a Job.

3. Job definition

A translation Job is created by POSTing to the Jobs endpoint with the basic configuration of the Job. Afterwards, it's possible to add source files to the Job's by first uploading those files, then linking them.

The job doesn't actually start until you POST a translation request.

Once a Job is submitted for translation, it should be automatically accepted if all the details are valid. If they're not, the API returns an error 400 with more information.

In rare cases, a Job might be rejected after it's been accepted. The best way to deal with that is by getting in touch with your Lengoo Project Manager. In the future we expect to support full programmatic rejection / resubmission.

4. Webhooks

When a translation job is done or a partial delivery of a translation has occured, you can get notified about the status of the job if you have the webhook registered.

In the case where you have registered for a job.done webhook event with an active secured URL, you will get a request notification of the job payload when the job is completed via the url provided when you registered for the event.

If you have registered for a job.partial webhook event with an active secured URL, you will get a request notification of the job payload when the job has received a new translation via the registered url for the event

The secret you provide will be used to encode the payload in the X-Signature-Hmac-Sha256 header which will be in the notification request you will recieve.

5. Sandbox

The Lengoo Connect API is also available in a sandbox environment for development purposes, which doesn't trigger real translations.

Files

Files hold the texts that are subject to translation. They can be used as input and downloaded as output after translations are done.

Upload a file

Upload a file. After that, it can be used in a translation Job.

Supported File Formats:

  • XLIFF 1.2
  • XLIFF 2.0
  • HTML5
  • MP4 (video)
  • Image Formats: PNG, JPG, GIF, SVG

File Size Limits:

  • MP4 files: Maximum file size of 100 MB
  • Other file types: Maximum file size of 10 MB

IMPORTANT: This endpoint accepts multipart forms instead of JSON.

Authorizations:
OAuth2
Request Body schema: multipart/form-data
required

Upload File

file
required
string <binary>

File formats supported: XLIFF 1.2, XLIFF 2.0, HTML5, MP4 (video), image (PNG, JPG, GIF, SVG). Maximum file size: 100 MB for MP4 files, 10 MB for other formats.

language
required
LanguageCode (LanguageCode) [ 2 .. 5 ] characters

Language code: ISO 639-1 for language, optionally ISO 15924 for script, and ISO 3166-1 alpha-2 for country, separated by dashes.

referenceId
string <= 100 characters

Optional field containing identifier string to help you reference the file on your system.

metadata
string

Arbitrary data. Completely up to you. Use it for anything that helps your integration work.

Responses

Response samples

Content type
application/json
{
  • "file": {
    }
}

Get file information

Get detailed information on a single file

Authorizations:
OAuth2
path Parameters
id
required
string

ID of the source file

Responses

Response samples

Content type
application/json
{
  • "file": {
    }
}

Delete a file

Delete a file, as long as it isn't part of an active translation job. If it is, the request will fail with a 400 BAD REQUEST and an appropriate error.

Authorizations:
OAuth2
path Parameters
id
required
string

ID of the source file

Responses

Response samples

Content type
application/json
{
  • "errors": [
    ]
}

Download file

Download source file

Authorizations:
OAuth2
path Parameters
id
required
string

ID of the source file

Responses

Jobs

Jobs represent the discrete translation orders that a Customer can place.

Create a job

Create a job to translate content.

In a Job, all content must be in the same source language.

Source files must be uploaded separately (see section "Files").

Content can be translated to multiple target languages.

For each file the target languages can be selected, if not the file is translated to all the target languages of the job.

Target languages for each file must be available in the target languages of the job.

Due date must be a date in the future, by default at least two days in advance, during a business day. Minimum due date can be adjusted based on your operational requirements and contractual agreements.

Authorizations:
OAuth2
Request Body schema: application/json
required

Create job

name
required
string >= 4 characters

Title of the job

sourceLanguage
required
string (LanguageCode)

Language code: ISO 639-1 for language, optionally ISO 15924 for script, and ISO 3166-1 alpha-2 for country, separated by dashes.

targetLanguages
Array of strings

A list of target languages for this Job.

dueDate
string

Due date for the job. Expecting an ISO8601 UTC date string.

Array of objects (FilesWithTargetLanguage) [ 1 .. 100 ] items

Files to be translated

additionalInformation
string <= 5000 characters

Provide additional information for the job to the Lengoo operations team.

metadata
string

Arbitrary data. Completely up to you. Use it for anything that helps your integration work.

Responses

Request samples

Content type
application/json
{
  • "name": "Spring Collection Landing Page",
  • "sourceLanguage": "en-GB",
  • "targetLanguages": [
    ],
  • "dueDate": "2021-07-15T13:00:00.000Z",
  • "files": [
    ],
  • "additionalInformation": "string",
  • "metadata": "string"
}

Response samples

Content type
application/json
{
  • "job": {
    }
}

Get job

Get a single translation job including its status.

Files contained in the job can have translations partially delivered as indicated by the deliveredLanguages field which will contain an array of target languages the file has been translated into and available for download.

Authorizations:
OAuth2
path Parameters
id
required
string

ID of the Job

Responses

Response samples

Content type
application/json
{
  • "job": {
    }
}

Delete a Job

Delete a Job, as long as it hasn't been submitted for translation yet. If it has, the request will fail with a 400 BAD REQUEST and an appropriate error.

Authorizations:
OAuth2
path Parameters
id
required
string

ID of the Job

Responses

Response samples

Content type
application/json
{
  • "errors": [
    ]
}

Update a Job

Update properties of the job. For example due date, description etc.

Due date must be a date in the future, by default at least two days in advance, during a business day. Minimum due date can be adjusted based on your operational requirements and contractual agreements.

A job can not be updated if it is already submitted.

The source language of the job can only be updated if there are no files attached.

This operation can not be used for attaching source files to the job. See Add files to job endpoint section for more operations.

Authorizations:
OAuth2
path Parameters
id
required
string

ID of the Job

Request Body schema: application/json
required

Update job

name
string >= 4 characters

Title of the job

sourceLanguage
string (LanguageCode)

Language code: ISO 639-1 for language, optionally ISO 15924 for script, and ISO 3166-1 alpha-2 for country, separated by dashes.

targetLanguages
Array of strings

A list of target languages for this Job.

dueDate
string

Due date for the job. Expecting an ISO8601 UTC date string.

additionalInformation
string <= 5000 characters

Provide additional information for the job to the Lengoo operations team.

metadata
string

Arbitrary data. Completely up to you. Use it for anything that helps your integration work.

Responses

Request samples

Content type
application/json
{
  • "name": "Spring Collection Landing Page",
  • "sourceLanguage": "en-GB",
  • "targetLanguages": [
    ],
  • "dueDate": "2021-07-15T13:00:00.000Z",
  • "additionalInformation": "string",
  • "metadata": "string"
}

Response samples

Content type
application/json
{
  • "errors": [
    ]
}

Translate a Job

You can send a request for translation which locks the job data and triggers the translation flow inside lengoo.

Authorizations:
OAuth2
path Parameters
id
required
string

ID of the Job

Responses

Response samples

Content type
application/json
{
  • "errors": [
    ]
}

Mark Job as Done - Sandbox

This endpoint is only available in the sandbox enviroment as it exists to help test the integration with Connect API.

Sending a request to this endpoint marks specified job as done.

A done job might have three possible resolutions: delivered, cancelled or failed.

The default resolution is delivered.

Authorizations:
OAuth2
path Parameters
id
required
string

ID of the Job

Request Body schema: application/json
optional

Mark job as Done request body

resolution
string (JobStatusResolutionInput)

The job resolution for being marked as done. The supported values are: delivered, cancelled and failed.

Responses

Request samples

Content type
application/json
{
  • "resolution": "delivered"
}

Response samples

Content type
application/json
{
  • "errors": [
    ]
}

Mark Job as Partially Delivered - Sandbox

This endpoint is only available in the sandbox enviroment as it exists to help test the integration with Connect API.

A job is considered partially delivered when at least one source file was translated for a target language.

Sending a request to this endpoint marks specified job and specified files with target languages as partially delivered.

NOTE: If all the job files and target languages are provided as input to be partially delivered, then the job is going to be marked as done.

Authorizations:
OAuth2
path Parameters
id
required
string

ID of the Job

Request Body schema: application/json
required

Mark job as partially delivered

required
Array of objects [ 1 .. 100 ] items

Files to be marked as partially delivered

Responses

Request samples

Content type
application/json
{
  • "files": [
    ]
}

Response samples

Content type
application/json
{
  • "errors": [
    ]
}

Get job workflow

Get workflow history of a job

Authorizations:
OAuth2
path Parameters
id
required
string

ID of the Job

Responses

Response samples

Content type
application/json
{
  • "workflow": [
    ]
}

Add files to job

Add files (see Files for uploading files) to a job for translation.

There is a 100 files per job limitation.

Specific target languages can be specified if it exists in job target language list.

Authorizations:
OAuth2
path Parameters
id
required
string

ID of the Job

Request Body schema: application/json
required

Files to add in one of the target languages of a job.

required
Array of objects (FilesWithTargetLanguage) [ 1 .. 100 ] items

List of file IDs and optionally target languages

Responses

Request samples

Content type
application/json
{
  • "files": [
    ]
}

Response samples

Content type
application/json
{
  • "errors": [
    ]
}

Detach file from job

Detach file from a job but does not delete the source file itself

Authorizations:
OAuth2
path Parameters
id
required
string

ID of the job

fileId
required
string

ID of the source file

Responses

Response samples

Content type
application/json
{
  • "errors": [
    ]
}

Download translation file for a specific target language

Download translation file

Authorizations:
OAuth2
path Parameters
id
required
string

ID of the job

fileId
required
string

ID of the source file

languageCode
required
string

Target Language code

Responses

Upload a feedback file - Beta

Upload a feedback file for a specific job, source file and target language after the translation has been completed.

The feedback file must contain the corrected translation.

IMPORTANT: This feature is currently in closed beta status and only available to specific customers. Contact us if you would like to use the feature.

Supported File Formats:

  • HTML5

File Size Limits:

  • Maximum file size of 10 MB
Authorizations:
OAuth2
path Parameters
id
required
string

ID of the job

fileId
required
string

ID of the source file

languageCode
required
string

Target Language code

Request Body schema: multipart/form-data
required

Upload Feedback File

file
required
string <binary>

File formats supported: HTML5. Maximum file size: 10.

Responses

Response samples

Content type
application/json
{
  • "errors": [
    ]
}

Languages

Available language combinations for translation Jobs

List available source languages

This endpoint returns a list of available source language codes.

Language code: ISO 639-1 for language, optionally ISO 15924 for script, and ISO 3166-1 alpha-2 for country, separated by dashes (e.g. "en-GB" and "sr-Cyrl-RS").

Authorizations:
OAuth2

Responses

Response samples

Content type
application/json
{
  • "languages": [
    ]
}

Show available target languages

List of languages that are available for translation given a the source language.

The languages are formated as such: ISO 639-1 for language, optionally ISO 15924 for script, and ISO 3166-1 alpha-2 for country, separated by dashes. (e.g. "en-GB" and "sr-Cyrl-RS").

Authorizations:
OAuth2
path Parameters
languageCode
required
string

Language code usingISO 639-1 for language, optionally ISO 15924 for script, and ISO 3166-1 alpha-2 for country, separated by dashes.

Responses

Response samples

Content type
application/json
{
  • "languages": [
    ]
}

Webhook

Job done or partially delivered Webhook

Information about a job that has been completed or partially delivered. These notifications are sent if webhooks for the events job.done or job.partial were created.

Responses

Response samples

Content type
application/json
{
  • "job": {
    }
}

Register webhook

This is used to get notifications when you have your webhook registered.

Authorizations:
OAuth2
Request Body schema: application/json
required

Webhook registeration payload

events
required
Array of strings [ 1 .. 4 ] items
Items Enum: "job.done" "job.partial"

webhook events for subscription

url
required
string

URL for recieving event, it must be secured with https://

secret
required
string

Secret of the request with the hash request

Responses

Request samples

Content type
application/json
{}

Response samples

Content type
application/json
{
  • "webhookId": {
    }
}