Introduction

BASE URL

https://api.modernmt.com/

CLIENT LIBRARIES

cURL

Node.js

Python

Java

PHP

.NET

By default, the documentation demonstrates using cURL to interact with the API over HTTPS. Select one of our official client libraries to see examples in code.

npm i modernmt # or yarn add

# browser
<script src="https://unpkg.com/modernmt"></script>
pip3 install modernmt
# maven
<dependency>
<groupId>com.modernmt</groupId>
<artifactId>modernmt-java</artifactId>
<version>1.0.1</version>
</dependency>

# gradle
compile "com.modernmt:modernmt-java:1.0.0"
composer require modernmt/modernmt-php
dotnet add package modernmt-dotnet

ModernMT Enterprise services are available through a public REST API that allows you to request translations and manage your memories.

To workaround some HTTP methods limitations ModernMT recommends to send POST requests and separately declare the method through the X-HTTP-Method-Override. This technique is present in this documentation’s cURL examples where necessary and official libraries.

Authentication

AUTHENTICATION

curl -H "MMT-ApiKey: YOUR_API_KEY" ...
const mmt = new ModernMT("YOUR_API_KEY");
mmt = ModernMT("YOUR_API_KEY");
ModernMT mmt = new ModernMT("YOUR_API_KEY");
$mmt = new ModernMT("YOUR_API_KEY");
var mmt = new ModernMTService("YOUR_API_KEY");

The ModernMT API uses API keys to authenticate requests. You can view and manage your API key in the account Dashboard.

For every API request you have to include an HTTP header named MMT-ApiKey which contains your API key as value. API requests without this header will fail.

The API key is unique and identifies you, so be sure to keep it secure. Do not share your API key in publicly accessible areas such as GitHub, client-side code, and so forth. If you accidentally shared your API key or suspect that it has been stolen, you can reset it from the account Dashboard. This operation will generate a new API key and will invalidate the previous one.

Client Identity

CLIENT IDENTITY

curl -H "MMT-ApiKey: YOUR_API_KEY" -H "MMT-Platform: simple-cat-tool" -H "MMT-PlatformVersion: 1.2.8" ...
const mmt = new ModernMT("YOUR_API_KEY", "simple-cat-tool", "1.2.8");
mmt = ModernMT("YOUR_API_KEY", "simple-cat-tool", "1.2.8");
ModernMT mmt = new ModernMT("YOUR_API_KEY", "simple-cat-tool", "1.2.8");
$mmt = new ModernMT("YOUR_API_KEY", "simple-cat-tool", "1.2.8");
var mmt = new ModernMTService("YOUR_API_KEY", "simple-cat-tool", "1.2.8");

Clients which use ModernMT API can specify additional identity informations using the following headers:

Those data are optional but can be extremely valuable in our support activities, allowing us to track the traffic of a specific client, and letting us immediately intervene in case of necessity, therefore we recommend to include them in every API request.

Response and Errors

SUCCESS RESPONSE

{
      "data": ...,
      "status": 200
}

ERROR RESPONSE

{
      "error": {
          "message": "Missing parameter text",
          "type": "ParameterParsingException"
      },
      "status": 400
}

ModernMT uses conventional HTTP response codes to indicate the success or failure of an API request. The status code is always included in the response “status” field.

Codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (a required parameter was omitted, the requested resource does not exist, etc.). Codes in the 5xx range indicate an error in ModernMT’s servers.

In case of success, the response includes a “data” field which contains the request result. In case of failure, the response includes an “error” field that contains the failure type and an explanatory message. Official libraries methods will return the data field content or throw an exception in case of failure.

Languages

ModernMT supports a wide variety of languages. Translations from any language to any language in this list are supported. The list is updated as new languages are added. The list of supported language codes can be retrieved using the languages API.

A
Albanian - sq
Arabic - ar

B
Bosnian - bs
Bulgarian - bg

C
Catalan - ca
Chinese (Simplified) - zh-CN or zh
Chinese (Traditional) - zh-TW
Croatian - hr
Czech - cs

D
Danish - da
Dutch - nl

E
English - en
Estonian - et
F
Finnish - fi
French - fr

G
German - de
Greek - el

H
Hebrew - he
Hungarian - hu

I
Icelandic - is
Indonesian - id
Italian - it

J
Japanese - ja

K
Korean - ko
L
Latvian - lv
Lithuanian - lt

M
Macedonian - mk
Malay - ms
Maltese - mt

N
Norwegian Bokmål - nb
Norwegian Nynorsk - nn

P
Polish - pl
Portuguese (European) - pt-PT or pt
Portuguese (Brazilian) - pt-BR

R
Romanian - ro
Russian - ru
S
Serbian (Cyrillic) - sr-Cyrl
Serbian (Latin) - sr-Latn
Slovak - sk
Slovenian - sl
Spanish (European) - es-ES or es
Spanish (Latin American) - es-419
Swedish - sv

T
Thai - th
Turkish - tr

U
Ukrainian - uk

V
Vietnamese - vi

Endpoints

Translation

Supported languages

GET /translate/languages

curl "https://api.modernmt.com/translate/languages"
const languages = await mmt.listSupportedLanguages();
languages = mmt.list_supported_languages();
List<String> languages = mmt.listSupportedLanguages();
$languages = $mmt->list_supported_languages();
var languages = mmt.ListSupportedLanguages();

RESPONSE

{
      "data": [...],
      "status": 200
}

Gives the list of supported language codes (ISO 639-1) for translation.

Request parameters

None.

Result

Returns an array which contains supported language codes.

Translate text

GET /translate - SINGLE SENTENCE

curl -X POST \
    -H "X-HTTP-Method-Override: GET" \
    -H "Content-Type: application/json" \
    -H "MMT-ApiKey: YOUR_API_KEY" \
    --data '{"source":"en", "target":"it", "q":"Hello world."}' \
    "https://api.modernmt.com/translate"
const translation = await mmt.translate("en", "it", "Hello world.")
translation = mmt.translate("en", "it", "Hello world.")
Translation translation = mmt.translate("en", "it", "Hello world.");
$translation = $mmt->translate("en", "it", "Hello world.");
var translation = mmt.Translate("en", "it", "Hello world.");

RESPONSE

{
  "status": 200,
  "data": {
    "translation": "Ciao mondo.",
    "billedCharacters": 12,
    "characters": 12
  }
}

GET /translate - MULTIPLE SENTENCES

curl -X POST \
    -H "X-HTTP-Method-Override: GET" \
    -H "Content-Type: application/json" \
    -H "MMT-ApiKey: YOUR_API_KEY" \
    --data '{"source": "en", "target":"it", "q":["Hello world.", "This is a test"]}' \
    "https://api.modernmt.com/translate"
const translations = await mmt.translate("en", "it", ["Hello world.", "This is a test"]);
translations = mmt.translate("en", "it", ["Hello world.", "This is a test"]);
List<Translation> translations = mmt.translate("en", "it", Arrays.asList("Hello world.", "This is a test"));
$translations = $mmt->translate("en", "it", ["Hello world.", "This is a test"]);
var translations = mmt.Translate("en", "it", new List<string>{"Hello world.", "This is a test"});

RESPONSE

{
  "status": 200,
  "data": [
    {
      "translation": "Ciao mondo.",
      "billedCharacters": 12,
      "characters": 12
    },
    {
      "translation": "Questo è un test",
      "billedCharacters": 14,
      "characters": 14
    }
  ]
}

GET /translate - HINTS

curl -X POST \
    -H "X-HTTP-Method-Override: GET" \
    -H "Content-Type: application/json" \
    -H "MMT-ApiKey: YOUR_API_KEY" \
    --data '{"source": "it", "target":"en", "q":"Dì il mio nome.", "hints":"37790"}' \
    "https://api.modernmt.com/translate"
const translation = await mmt.translate("it", "en", "Dì il mio nome.", [37790]);
translation = await mmt.translate("it", "en", "Dì il mio nome.", [37790]);
Translation translation = mmt.translate("it", "en", "Dì il mio nome.", new long[]{37790});
$translation = $mmt->translate("it", "en", "Dì il mio nome.", [37790]);
var translation = mmt.Translate("it", "en", "Dì il mio nome.", new long[]{37790});

RESPONSE

{
  "status": 200,
  "data": {
    "translation": "Say my name.",
    "billedCharacters": 15,
    "characters": 15,
    "contextVector": "37790:1"
  }
}

GET /translate - CONTEXT VECTOR

curl -X POST \
    -H "X-HTTP-Method-Override: GET" \
    -H "Content-Type: application/json" \
    -H "MMT-ApiKey: YOUR_API_KEY" \
    --data '{"source": "en", "target":"it", "q":"Say my name.", "context_vector":"37787:0.191,37784:0.163,37790:0.14,37791:0.092"}' \
    "https://api.modernmt.com/translate"
const translation = await mmt.translate("en", "it", "Say my name.", null, "37787:0.191,37784:0.163,37790:0.14,37791:0.092");
translation = await mmt.translate("en", "it", "Say my name.", context_vector="37787:0.191,37784:0.163,37790:0.14,37791:0.092");
Translation translation = mmt.translate("en", "it", "Say my name.", null, "37787:0.191,37784:0.163,37790:0.14,37791:0.092");
$translation = $mmt->translate("en", "it", "Say my name.", null, "37787:0.191,37784:0.163,37790:0.14,37791:0.092");
var translation = mmt.Translate("en", "it", "Say my name.", null, "37787:0.191,37784:0.163,37790:0.14,37791:0.092");

RESPONSE

{
  "status": 200,
  "data": {
    "translation": "Dì il mio nome.",
    "billedCharacters": 12,
    "characters": 12,
    "contextVector": "37787:0.191,37784:0.163,37790:0.14,37791:0.092"
  }
}

GET /translate - OPTIONS

curl -X POST \
    -H "X-HTTP-Method-Override: GET" \
    -H "Content-Type: application/json" \
    -H "MMT-ApiKey: YOUR_API_KEY" \
    --data '{"source": "en", "target":"it", "q":"Say my name.", "priority":"background", "project_id":"1"}' \
    "https://api.modernmt.com/translate"
const translation = await mmt.translate("en", "it", "Say my name.", null, null, {priority: "background", projectId: "1"});
translation = await mmt.translate("en", "it", "Say my name.", options={"priority": "background", "project_id": "1"});
TranslateOptions options = new TranslateOptions();
options.setPriority("background");
options.setProjectId("1");
Translation translation = mmt.translate("en", "it", "Say my name.", null, null, options);
$translation = $mmt->translate("en", "it", "Say my name.", null, null, ['priority' => 'background', 'project_id' => 'ajeje']);
var options = new TranslateOptions
{
    Priority = "background",
    Timeout = 5000
};
var translation = mmt.Translate("en", "it", "Say my name.", null, null, options);

RESPONSE

{
  "status": 200,
  "data": {
    "translation": "Dì il mio nome.",
    "billedCharacters": 12,
    "characters": 12
  }
}

Allows to translate an input sentence or a list of sentences.

Request parameters

Name Description
source The language code (ISO 639-1) of the source sentence(s). If omitted, ModernMT will attempt to detect the source language automatically and return it within the response. Is strongly recommended to provide the source language whenever possible: the detection will negatively impact response time and is subject to failures for very short sentences
target The language code (ISO 639-1) to use for translation of the input sentence(s)
q The input sentence or an array of sentences to be translated. Translations are returned in the same order as they are requested. If no source is provided, the array can include sentences in different languages. The maximum length of the array is 128, the maximum number of characters is 10’000. See the note about XML Tags
context_vector The context vector to use for the translation of the input sentence(s). This is necessary for adaptation
hints The hints for the context vector. If context_vector is omitted, it will be created automatically including those memories only
priority The priority of the translation request. It can be normal or background. Default value depends on your pricing plan
project_id An identifier of the project or document. This field is useful for CAT tools development: in a limited range of time, translation requests with the same project_id, sentence and target language will be billed only once
multiline Given a long query, ModernMT automatically decides if to split the text in sub-sentences in order to provide a better translation result. This boolean parameter can force this behavior. True will always attempt to split, false disables it
timeout Aborts the request if the translation is not completed in the given milliseconds

Result

The translate API returns a JSON representation of the translation (or an array of JSON representations if multiple sentences were provided, in the given order). The JSON has the following structure:

Name Description
tanslation The sentence translated into the target language
contextVector The context vector effectively used in the translation, which has hints applied and eventually non-existing memories provided filtered out. This field is omitted if no context vector or hints were provided in the request, or if they included only non-existing memories
characters The amount of characters of the input sentence
billedCharacters The amount of billed characters
detectedLanguage The source language code (ISO 639-1) detected automatically. This field is omitted if the source language code was specified in the request

XML tags

ModernMT supports XML input type for translations. XML tags are extracted from the input sentences and then re-inserted in the translation in the right position. Tag’s attributes are kept untouched.

Pre-processing:

Post-processing:

Example:

Rate limit

By default there is a rate limit of 10'000 chars per second to protect users from unwanted billing. It can be removed upon request. The limit applies to both kinds of requests, single sentence or multiple sentences.

Context vector

The context vector is the object which leverages ModernMT adaptation during the translation. It consists of a list of memories, each one with a corresponding weight. The higher the weight is, the more the memory content will influence the translation result. The maximum weight which can be assigned to a memory is 1 and the decimal place accuracy is 3.

A context vector is represented by a string which contains a list of couples separated by a comma. Each couple contains the memory id and the corresponding weight separated by a colon. This is an example of a context vector: 37787:0.457,37784:0.2. It contains the memory 37787 with a weight of 0.457, and the memory 37784 with a weight of 0.2.

Hints

This parameter is a string which contains a list of memory ids separated by a comma. It can be used to force the assignment of the maximum weight to the given list of memories. If a non-existent memory is provided, it will be ignored.

Context vector guessing from raw text

GET /context-vector - FILE

curl -X POST \
    -H "X-HTTP-Method-Override: GET" \
    -H "MMT-ApiKey: YOUR_API_KEY" \
    -F "content=@path/to/text_file" \
    -F "source=en" \
    -F "targets=it" \
    -F "targets=es" \
    "https://api.modernmt.com/context-vector"
const contextVector = await mmt.getContextVectorFromFile("en", ["es", "it"], "path/to/file.txt"); // or ReadStream
context_vector = mmt.get_context_vector_from_file("en", ["es", "it"], "path/to/file.txt");  # or stream
String contextVector = mmt.getContextVectorFromFile("en", Arrays.asList("es", "it"), "path/to/file.txt"); // or File
$context_vector = $mmt->get_context_vector_from_file("en", ["es", "it"], "path/to/file.txt");
var contextVector = mmt.GetContextVectorFromFile("en", new List<string>{"es", "it"}, "path/to/file.txt"); // or FileStream

RESPONSE

{
  "status": 200,
  "data": {
    "source": "en",
    "vectors": {
      "it": "37787:0.191,37784:0.163,37790:0.14,37791:0.092"
    }
  }
}

GET /context-vector - TEXT

curl -X POST \
    -H "X-HTTP-Method-Override: GET" \
    -H "MMT-ApiKey: YOUR_API_KEY" \
    -F "text=This is an example text for context vector computation" \
    -F "source=en" \
    -F "targets=it" \
    -F "targets=es" \
    "https://api.modernmt.com/context-vector"
const contextVector = await mmt.getContextVector("en", ["es", "it"], "This is an example text for context vector computation");
context_vector = mmt.get_context_vector("en", ["es", "it"], "This is an example text for context vector computation");
String contextVector = mmt.getContextVector("en", Arrays.asList("es", "it"), "This is an example text for context vector computation");
$context_vector = $mmt->get_context_vector("en", ["es", "it"], "This is an example text for context vector computation");
var contextVector = mmt.GetContextVector("en", new List<string>{"es", "it"}, "This is an example text for context vector computation");

RESPONSE

{
  "status": 200,
  "data": {
    "source": "en",
    "vectors": {
      "it": "37790:0.167,37787:0.058,37784:0.054,37791:0.019"
    }
  }
}

ModernMT can analyze a given content, compare it with the memories content, and automatically create a context vector which can be used in the attempt to maximize the translation quality. This API returns the context vector which is the result of that automatic analysis for the provided content.

Request parameters

Name Description
source The language code (ISO 639-1) of the source content
targets The language codes (ISO 639-1) of the targets, separated by a comma. The response will contain a different vector for each target provided
content The text file to be analyzed
text The text to be analyzed. This parameter is required if content is omitted, ignored otherwise
hints The hints for the context vector
limit The maximum number of memories to include in the vector. Lowest weight memories will be filtered out. If omitted or zero, no limit will be applied.
compression Specifies the compression algorithm. Required if content is compressed. Supported algorithms: gzip

Result

Name Description
source The language code (ISO 639-1) of the source content provided in the request
vectors A JSON object whose keys are the target language codes provided in the request, each one with the corresponding context vector as value

Memories

ENDPOINTS

# Management
GET /memories
GET /memories/:id
POST /memories
PUT /memories/:id
DELETE /memories/:id

# Content
POST /memories/:id/content
PUT /memories/:id/content
GET /import-jobs/:id

In ModernMT a memory is an entity that stores sentences and their corresponding translation. The memories are used in ModernMT through the context vector to perform real-time adaptation.

To obtain the best adaptation results, it’s recommended to create a separate translation memory for each domain (eg. memory A for legal stuff and memory B for medical stuff).

It is not necessary to split up memories content by language pairs instead. In the translation function ModernMT will automatically ignore content which doesn’t match the translation’s language pairs, even for memories provided as hints.

The JSON representation of a memory has the following structure:

Name Description
id The memory’s unique identifier (integer)
name The name of the memory. Symbols, numbers and spaces are allowed
description The description of the memory. Symbols, numbers and spaces are allowed
creationDate The memory creation date and time expressed according to ISO 8601

Management

Retrieve all memories

GET /memories

curl -H "MMT-ApiKey: YOUR_API_KEY" "https://api.modernmt.com/memories"
const memories = await mmt.memories.list();
memories = mmt.memories.list();
List<Memory> memories = mmt.memories.list();
$memories = $mmt->memories->get_all();
var memories = mmt.Memories.List();

RESPONSE

{
  "status": 200,
  "data": [
    {
      "id": 37784,
      "creationDate": "2021-03-19T09:46:59+00:00",
      "name": "legal"
    },
    ...
    {
      "id": 37791,
      "creationDate": "2021-03-19T09:47:21+00:00",
      "name": "medical"
    }
  ]
}

This endpoint allows to retrieve a list of your memories. The list is sorted by creation date, with the least recent memories appearing first.

Request parameters

None.

Result

Returns an array containing a JSON representation or your memories.

Retrieve memory metadata

GET /memories/:id

curl -H "MMT-ApiKey: YOUR_API_KEY" "https://api.modernmt.com/memories/37790"
const memory = await mmt.memories.get(37790);
memory = mmt.memories.get(37790);
Memory memory = mmt.memories.get(37790);
$memory = $mmt->memories->get(37790);
var memory = mmt.Memories.Get(37790);

RESPONSE

{
  "status": 200,
  "data": {
    "id": 37790,
    "creationDate": "2021-03-19T09:46:59+00:00",
    "name": "legal"
  }
}

This endpoint allows to retrieve the metadata of a memory. You need to specify the memory unique identifier (id).

Request parameters

None.

Result

Returns a JSON representation of the requested memory.

Create new memory

POST /memories

curl -X POST \
    -H "Content-Type: application/json" \
    -H "MMT-ApiKey: YOUR_API_KEY" \
    --data '{"name": "chemistry"}' \
    "https://api.modernmt.com/memories"
const memory = await mmt.memories.create("chemistry");
memory = mmt.memories.create("chemistry");
Memory memory = mmt.memories.create("chemistry");
$memory = $mmt->memories->create("chemistry");
var memory = mmt.Memories.Create("chemistry");

RESPONSE

{
  "status": 200,
  "data": {
    "id": 37790,
    "creationDate": "2021-04-12T15:24:26+00:00",
    "name": "chemistry"
  }
}

This endpoint allows to create a memory.

Request parameters

Name Description
name The name of the memory (different memories can share the same name)
description The description of the memory
external_id The identifier of a third party service memory. Its content will be automatically imported. Supported services: MyMemory

Result

Returns a JSON representation of the created memory.

Update memory metadata

PUT /memories/:id

curl -X PUT \
    -H "Content-Type: application/json" \
    -H "MMT-ApiKey: YOUR_API_KEY" \
    --data '{"name": "physical chemistry"}' \
    "https://api.modernmt.com/memories/37790"
const memory = await mmt.memories.edit(37790, "physical chemistry");
memory = mmt.memories.edit(37790, "physical chemistry");
Memory memory = mmt.memories.edit(37790, "physical chemistry");
$memory = $mmt->memories->edit(37790, "physical chemistry");
var memory = mmt.Memories.Edit(37790, "physical chemistry");

RESPONSE

{
  "status": 200,
  "data": {
    "id": 37790,
    "creationDate": "2021-04-12T15:24:26+00:00",
    "name": "physical chemistry"
  }
}

This endpoint allows to update the metadata of a memory. You need to specify the memory unique identifier (id). Any parameters not provided will be left unchanged, but at least one is required. Returns a JSON representation of the updated memory.

Request parameters

Name Description
name The name of the memory
description The description of the memory

Result

Returns a JSON representation of the updated memory.

Delete memory and its content

DELETE /memories/:id

curl -X DELETE \
    -H "MMT-ApiKey: YOUR_API_KEY" \
    "https://api.modernmt.com/memories/37790"
const memory = await mmt.memories.delete(37790);
memory = mmt.memories.delete(37790);
Memory memory = mmt.memories.delete(37790);
$memory = $mmt->memories->delete(37790);
var memory = mmt.Memories.Delete(37790);

RESPONSE

{
  "status": 200,
  "data": {
    "id": 37790,
    "creationDate": "2021-04-12T15:24:26+00:00",
    "name": "physical chemistry"
  }
}

This endpoint allows to permanently delete a memory and its content. It cannot be undone. You need to specify the memory unique identifier (id).

Request parameters

None.

Response

Returns a JSON representation of the deleted memory or a response with status code 404 if the memory is not found.

Content

Store memory content

POST /memories/:id/content - TMX FILE

curl -X POST \
    -H "MMT-ApiKey: YOUR_API_KEY" \
    -F "tmx=@path/to/tmx_file" \
    "https://api.modernmt.com/memories/37790/content"
const importJob = await mmt.memories.import(37790, "path/to/file.tmx"); // or ReadStream
import_job = mmt.memories.import_tmx(37790, "path/to/file.tmx");  # or stream
ImportJob importJob = mmt.memories.importTmx(37790, "path/to/file.tmx"); // or File
$import_job = $mmt->memories->import(37790, "path/to/file.tmx");
var importJob = mmt.Memories.Import(37790, "path/to/file.tmx"); // or FileStream

RESPONSE

{
  "status": 200,
  "data": {
    "id": "00000000-0000-0000-0000-0000000379fc",
    "memory": 37790,
    "size": 18818,
    "progress": 0
  }
}

POST /memories/:id/content - SENTENCE-TRANSLATION PAIR

curl -X POST \
    -H "Content-Type: application/json" \
    -H "MMT-ApiKey: YOUR_API_KEY" \
    --data '{"source":"en", "target":"it", "tuid":"1", "sentence":"This is a test.", "translation":"Questo è un test."}' \
    "https://api.modernmt.com/memories/37790/content"
const importJob = await mmt.memories.add(37790, "en", "it", "This is a test.", "Questo è un test.", "1");
import_job = mmt.memories.add(37790, "en", "it", "This is a test.", "Questo è un test.", "1");
ImportJob importJob = mmt.memories.add(37790, "en", "it", "This is a test.", "Questo è un test.", "1");
$import_job = $mmt->memories->add(37790, "en", "it", "This is a test.", "Questo è un test.", "1");
var importJob = mmt.Memories.Add(37790, "en", "it", "This is a test.", "Questo è un test.", "1");

RESPONSE

{
  "status": 200,
  "data": {
    "id": "80000001-0000-0000-0000-0000049c6374",
    "memory": 37790,
    "size": 1,
    "progress": 0
  }
}

This section describes API functions to store sentences and their corresponding translation into memories. You need to specify the memory unique identifier (id). Multiple pairs can be stored at once using a tmx file, in that case the only required parameters are tmx and compression (if any). To store a single pair the other parameters are required.

Request parameters

Name Description
tmx The tmx file which content will be imported into the memory
compression Specifies the compression algorithm. Required if tmx is compressed. Supported algorithms: gzip
source The language code (ISO 639-1) of the source sentence. Ignored if tmx is provided, required otherwise
target The language code (ISO 639-1) of the translated sentence. Ignored if tmx is provided, required otherwise
sentence The source sentence. Ignored if tmx is provided, required otherwise
translation The translation of the source sentence. Ignored if tmx is provided, required otherwise
tuid A string identifier, necessary if you will need to update the given sentence-translation pair. Ignored if tmx is provided

Result

Returns the corresponding Import Job.

Update sentence-translation pair

PUT /memories/:id/content

curl -X PUT \
    -H "Content-Type: application/json" \
    -H "MMT-ApiKey: YOUR_API_KEY" \
    --data '{"source":"en", "target":"it", "tuid":"1", "sentence":"This is a test.", "translation":"Questa è una prova."}' \
    "https://api.modernmt.com/memories/37790/content"
const importJob = await mmt.memories.replace(37790, "1", "en", "it", "This is a test.", "Questa è una prova.");
import_job = mmt.memories.replace(37790, "1", "en", "it", "This is a test.", "Questa è una prova.");
ImportJob importJob = mmt.memories.replace(37790, "1", "en", "it", "This is a test.", "Questa è una prova.");
$import_job = $mmt->memories->replace(37790, "1", "en", "it", "This is a test.", "Questa è una prova.");
var importJob = mmt.Memories.Add(37790, "1", "en", "it", "This is a test.", "Questa è una prova.");

RESPONSE

{
  "status": 200,
  "data": {
    "id": "80000001-0000-0000-0000-0000049c7646",
    "memory": 37790,
    "size": 1,
    "progress": 0
  }
}

Update a sentence-translation pair in the given memory. You need to specify the memory unique identifier (id). None of the request parameters is optional.

Request parameters

Name Description
tuid The tuid of the sentence-translation pair to be updated
source The language code (ISO 639-1) of the source sentence to be updated
target The language code (ISO 639-1) of the translated sentence to be updated
sentence The updated source sentence
translation The updated translation

Result

Returns the corresponding Import Job.

Import job

An Import Job is an object which represents the import operation of content in a memory. Each import operation function returns the corresponding Import Job.

The JSON representation of an Import Job has the following structure:

Name Description
id The id of the import job (uuid)
memory The id of the corresponding memory
size The number of sentence-translation pairs of the import job
progress Indicates the percentage of progress of the import job. The value can be between 0 and 1. A value of 1 indicates that the job is completed

Retrieve TMX import status

GET /import-jobs/:id - IMPORT JOB

curl -H "MMT-ApiKey: YOUR_API_KEY" \
    "https://api.modernmt.com/import-jobs/00000000-0000-0000-0000-0000000379fc"
const importJob = await mmt.memories.getImportStatus("00000000-0000-0000-0000-0000000379fc");
import_job = mmt.memories.get_import_status("00000000-0000-0000-0000-0000000379fc");
ImportJob importJob = mmt.memories.getImportStatus("00000000-0000-0000-0000-0000000379fc");
$import_job = $mmt->memories->get_import_status("00000000-0000-0000-0000-0000000379fc");
var importJob = mmt.Memories.GetImportStatus("00000000-0000-0000-0000-0000000379fc");

RESPONSE

{
  "status": 200,
  "data": {
    "id": "00000000-0000-0000-0000-0000000379fc",
    "memory": 37790,
    "size": 18818,
    "progress": 1
  }
}

Returns the JSON representation of an Import Job. You need to specify the memory unique identifier (uuid).

Request parameters

None.

Result

Returns the corresponding Import Job.