Phrase Language AI via API (1.0.0)

Download OpenAPI specification:Download

Machine translation powered by Phrase allows the translation of content utilizing a unique AI powered feature to pick the best available translation engine for that content.

File translations

Allows the processing files asynchronously with the file being uploaded and stored in Phrase. Files can be either stored or translated by the best available MT engine. File TTL is limited to 24 hours after which the file is deleted from storage.

File translations

Creates a new file translations request based on multipart/form-data. The translation state can be fetched utilizing a returned UID in the response and a Metadata endpoint. It is also possible to download the translated file using the Get file endpoint once the translation is complete (action.status == OK).

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

Source file with the metadata used for the translation process. Multipart request with metadata and file parts. Metadata accepts the following actionTypes:

Action Type Description
FILE_IMPORT Imports the file into the system
CONVERTER_IMPORT Extracts the translatable texts out of the file
MT_GENERIC_PRETRANSLATE Translates the extracted text
QUALITY_ESTIMATION Returns Phrase Quality Performance Score (QPS)

Note that only action type MT_GENERIC_PRETRANSLATE is needed when user wants to translate the file. Or only action type QUALITY_ESTIMATION is needed when user wants to translate the file and to get the quality estimation

file
required
string <binary>
required
object (FileTranslationsMetadataV1)

Responses

Callbacks

Request samples

Content type
multipart/form-data
Example
--Boundary_1_1453803947_1691603987728
Content-Type: application/octet-stream
Content-Disposition: form-data; name="file"; filename="test.txt"
Text for translation

--Boundary_1_1453803947_1691603987728
Content-Type: application/json
Content-Disposition: form-data; name="metadata"

{"sourceLang":{"code":"en"},"targetLangs":[{"code":"cs"}],"actionTypes":["MT_GENERIC_PRETRANSLATE"],"callbackUrl":"https://your-server.com/send/data/here"}
--Boundary_1_1453803947_1691603987728--

Response samples

Content type
application/json
{
  • "uid": "random-uid",
  • "actions": [
    ],
  • "metadata": {
    }
}

Callback payload samples

Callback
POST: File Translations Callback
Content type
application/json
{
  • "uid": "random-uid",
  • "actions": [
    ],
  • "metadata": {
    }
}

Action result

Use the Accept header with either application/octet-stream to get the file or use application/json to get the quality estimation.

Authorizations:
BearerAuth
path Parameters
actionType
required
string (ActionTypeEnumV1)
Enum: "CONVERTER_IMPORT" "FILE_IMPORT" "MT_GENERIC_PRETRANSLATE" "QUALITY_ESTIMATION"
Example: MT_GENERIC_PRETRANSLATE

File associated with the specified action type will be returned, if the action was completed.

language
required
string

Requested language of the file. Please note different actions have different languages available.

uid
required
string

UID of the operation. See File translations endpoint.

header Parameters
Accept
required
string

Media type which caller expects as a response.

Responses

Response samples

Content type
--Boundary_1_1453803947_1691603987728
Content-Type: application/octet-stream
Content-Disposition: form-data; name="file"; filename="test.txt"
Přeložený text

--Boundary_1_1453803947_1691603987728
Content-Type: application/json
Content-Disposition: form-data; name="metadata"

{"sourceLang":{"code":"en"},"targetLangs":[{"code":"cs"}],"actionTypes":["MT_GENERIC_PRETRANSLATE"],"callbackUrl":"https://your-server.com/send/data/here"}
--Boundary_1_1453803947_1691603987728--

File processing metadata

Allows the fetching of metadata from the processing file. The completed file can be downloaded using the File download endpoint.

Authorizations:
BearerAuth
path Parameters
uid
required
string

UID of the operation. See File translations endpoint.

Responses

Response samples

Content type
application/json
{
  • "uid": "random-uid",
  • "actions": [
    ],
  • "metadata": {
    }
}

Authentication

Allows the authentication of a user and to get the token to be used in the Authorization header.

Login

Returns information about the user with the token to be used in the Authorization header and its expiration date.

Request Body schema: application/json
required
password
required
string
userName
required
string
object (OrganizationUidV1)
otpCode
string

Responses

Request samples

Content type
application/json
{
  • "userName": "string",
  • "password": "string",
  • "otpCode": "string",
  • "organization": {
    }
}

Response samples

Content type
application/json
{
  • "token": "string",
  • "tokenType": "Bearer",
  • "expires": "string"
}

Text translations

Allows the translation of text content utilizing Phrase Language AI capabilities. APIs are synchronous, designed for quick turnaround and are limited in size of the request.

Text translations

Translates the text content utilizing Phrase Language AI capabilities. Can identify the source language, if not provided, and translate the text to the target language. If language identification is requested, system needs to have at least 50 characters.

Authorizations:
BearerAuth
Request Body schema: application/json
required
sourceText
required
string [ 1 .. 2000 ]
required
object (LanguageV1)
object (MtSettingSimplifiedV1)
object (LanguageV1)

Responses

Request samples

Content type
application/json
Example
{
  • "sourceLang": {
    },
  • "sourceText": "Hello, world!",
  • "targetLang": {
    },
  • "mtSettings": {
    }
}

Response samples

Content type
application/json
{
  • "sourceLang": {
    },
  • "translatedText": "Ahoj, světe!",
  • "targetLang": {
    }
}

List Language AI Profiles

List Language AI Profiles

List available Language AI profiles for the user.

Authorizations:
BearerAuth
query Parameters
name
string

Filter by name

order
string
Default: "asc"
Enum: "asc" "desc"

desc

pageNumber
integer <int32> >= 0
Default: 0

Page number, starting with 0, default 0

pageSize
integer <int32> [ 1 .. 50 ]
Default: 10

Page size, accepts values between 1 and 50, default 10

sort
string
Default: "name"
Enum: "name" "dateCreated"

Sort by

Responses

Response samples

Content type
application/json
{
  • "pageNumber": 0,
  • "content": [
    ],
  • "numberOfElements": 0,
  • "totalElements": 0,
  • "pageSize": 0,
  • "totalPages": 0
}