Search translation memory (sync)
curl --request POST \
--url https://cloud.memsource.com/web/api2/v1/transMemories/{transMemoryUid}/search \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"sourceLang": "<string>",
"nextSegment": "<string>",
"phraseQuery": true,
"previousSegment": "<string>",
"tagMetadata": [
{
"content": "<string>",
"id": "<string>",
"transAttributes": "<string>",
"type": "<string>"
}
],
"targetLangs": [
"<string>"
],
"trimQuery": true
}
'import requests
url = "https://cloud.memsource.com/web/api2/v1/transMemories/{transMemoryUid}/search"
payload = {
"query": "<string>",
"sourceLang": "<string>",
"nextSegment": "<string>",
"phraseQuery": True,
"previousSegment": "<string>",
"tagMetadata": [
{
"content": "<string>",
"id": "<string>",
"transAttributes": "<string>",
"type": "<string>"
}
],
"targetLangs": ["<string>"],
"trimQuery": True
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: '<string>',
sourceLang: '<string>',
nextSegment: '<string>',
phraseQuery: true,
previousSegment: '<string>',
tagMetadata: [
{
content: '<string>',
id: '<string>',
transAttributes: '<string>',
type: '<string>'
}
],
targetLangs: ['<string>'],
trimQuery: true
})
};
fetch('https://cloud.memsource.com/web/api2/v1/transMemories/{transMemoryUid}/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cloud.memsource.com/web/api2/v1/transMemories/{transMemoryUid}/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query' => '<string>',
'sourceLang' => '<string>',
'nextSegment' => '<string>',
'phraseQuery' => true,
'previousSegment' => '<string>',
'tagMetadata' => [
[
'content' => '<string>',
'id' => '<string>',
'transAttributes' => '<string>',
'type' => '<string>'
]
],
'targetLangs' => [
'<string>'
],
'trimQuery' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://cloud.memsource.com/web/api2/v1/transMemories/{transMemoryUid}/search"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"sourceLang\": \"<string>\",\n \"nextSegment\": \"<string>\",\n \"phraseQuery\": true,\n \"previousSegment\": \"<string>\",\n \"tagMetadata\": [\n {\n \"content\": \"<string>\",\n \"id\": \"<string>\",\n \"transAttributes\": \"<string>\",\n \"type\": \"<string>\"\n }\n ],\n \"targetLangs\": [\n \"<string>\"\n ],\n \"trimQuery\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://cloud.memsource.com/web/api2/v1/transMemories/{transMemoryUid}/search")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"sourceLang\": \"<string>\",\n \"nextSegment\": \"<string>\",\n \"phraseQuery\": true,\n \"previousSegment\": \"<string>\",\n \"tagMetadata\": [\n {\n \"content\": \"<string>\",\n \"id\": \"<string>\",\n \"transAttributes\": \"<string>\",\n \"type\": \"<string>\"\n }\n ],\n \"targetLangs\": [\n \"<string>\"\n ],\n \"trimQuery\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud.memsource.com/web/api2/v1/transMemories/{transMemoryUid}/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"<string>\",\n \"sourceLang\": \"<string>\",\n \"nextSegment\": \"<string>\",\n \"phraseQuery\": true,\n \"previousSegment\": \"<string>\",\n \"tagMetadata\": [\n {\n \"content\": \"<string>\",\n \"id\": \"<string>\",\n \"transAttributes\": \"<string>\",\n \"type\": \"<string>\"\n }\n ],\n \"targetLangs\": [\n \"<string>\"\n ],\n \"trimQuery\": true\n}"
response = http.request(request)
puts response.read_body{
"searchResults": [
{
"grossScore": 123,
"score": 123,
"segmentId": "<string>",
"source": {
"client": {
"id": 123,
"name": "<string>"
},
"createdAt": 123,
"createdBy": {
"email": "<string>",
"firstName": "<string>",
"id": "<string>",
"lastName": "<string>",
"role": "SYS_ADMIN",
"uid": "<string>",
"userName": "<string>"
},
"domain": {
"id": 123,
"name": "<string>"
},
"filename": "<string>",
"id": "<string>",
"key": "<string>",
"lang": "<string>",
"modifiedAt": 123,
"modifiedBy": {
"email": "<string>",
"firstName": "<string>",
"id": "<string>",
"lastName": "<string>",
"role": "SYS_ADMIN",
"uid": "<string>",
"userName": "<string>"
},
"nextSegment": "<string>",
"previousSegment": "<string>",
"project": {
"id": 123,
"name": "<string>",
"uid": "<string>"
},
"rtl": true,
"subDomain": {
"id": 123,
"name": "<string>"
},
"tagMetadata": [
{
"content": "<string>",
"id": "<string>",
"transAttributes": "<string>",
"type": "<string>"
}
],
"text": "<string>"
},
"subSegment": true,
"transMemory": {
"id": "<string>",
"name": "<string>",
"reverse": true,
"uid": "<string>"
},
"translations": [
{
"client": {
"id": 123,
"name": "<string>"
},
"createdAt": 123,
"createdBy": {
"email": "<string>",
"firstName": "<string>",
"id": "<string>",
"lastName": "<string>",
"role": "SYS_ADMIN",
"uid": "<string>",
"userName": "<string>"
},
"domain": {
"id": 123,
"name": "<string>"
},
"filename": "<string>",
"id": "<string>",
"key": "<string>",
"lang": "<string>",
"modifiedAt": 123,
"modifiedBy": {
"email": "<string>",
"firstName": "<string>",
"id": "<string>",
"lastName": "<string>",
"role": "SYS_ADMIN",
"uid": "<string>",
"userName": "<string>"
},
"nextSegment": "<string>",
"previousSegment": "<string>",
"project": {
"id": 123,
"name": "<string>",
"uid": "<string>"
},
"rtl": true,
"subDomain": {
"id": 123,
"name": "<string>"
},
"tagMetadata": [
{
"content": "<string>",
"id": "<string>",
"transAttributes": "<string>",
"type": "<string>"
}
],
"text": "<string>"
}
]
}
]
}Translation Memory
Search translation memory (sync)
Overview
- Searches a single translation memory using the primary TM scoring pipeline. The endpoint always returns up to 15
SearchTMResponseDtoentries ordered by score.
Modes
- Standard segment search (default): normalize text, leverage penalties, thresholds, tag metadata, and context. This is the behavior when
phraseQuery=true(default). The service calls the downstream/searchendpoint withwildcard=trueto allow combined exact/wildcard candidates in one pass. - Legacy phrase-only mode: set
phraseQuery=falseto disable the wildcard branch (wildcard=false,exactIfQuotes=false,combinedExact=false). Use when you need strict normalized matches without wildcard processing.
Request parameters
query(required): search text. IftrimQuery=true(default) leading/trailing whitespace is removed before sending to TM service.sourceLang(required) and optionaltargetLangs: locales are normalized. WhentargetLangsis omitted the backend queries all TM targets.previousSegment/nextSegment: optional context strings; when provided, the backend raises 101% matches that align with the surrounding segments.tagMetadata: serialized inline tags; improves scoring and avoids dropping tag pairs.trimQuery: defaulttrue. Set tofalseto preserve leading/trailing spaces (rare).phraseQuery: defaulttrue. Controls whether wildcard/phrase helpers are enabled (see “Modes”).
Scoring & ordering
- Backend computes
grossScore(raw similarity) andscore(penalty-adjusted). 101% matches retain their priority even after penalties. - Ordering priority (per downstream service):
score DESC,grossScore DESC, context match priority DESC, segment key ASC, TM priority ASC, timestamp DESC, TU id DESC. - Numeric replacements or uppercase normalization are not performed here (
replaceFigures=false,modifyTransText=falsein this controller).
Limits & behavior
- Returns maximum 15 matches; there is no
offsetortotalFoundCount. - Threshold is fixed to
0, so all results above penalties are returned until limit. - Multiple target locales per TM are not supported, mirroring backend validation.
- Logical operators (AND/OR/NOT) and wildcard expressions in
queryare interpreted only whenphraseQuery=trueenables the wildcard path.
Context & caching notes
- Downstream service may consult its 60-second cache for identical search inputs (including context and penalties). Freshly imported matches might appear with a short delay if cached results are reused.
- If previous/next segments are omitted the search still runs, but 101% context boosts cannot trigger.
Error handling
- Invalid locales, blank
query, or an inaccessible TM ID return400/403. - Backend may throw when multiple target locales are submitted for a single TM; the controller surfaces that error unchanged.
POST
/
api2
/
v1
/
transMemories
/
{transMemoryUid}
/
search
Search translation memory (sync)
curl --request POST \
--url https://cloud.memsource.com/web/api2/v1/transMemories/{transMemoryUid}/search \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"sourceLang": "<string>",
"nextSegment": "<string>",
"phraseQuery": true,
"previousSegment": "<string>",
"tagMetadata": [
{
"content": "<string>",
"id": "<string>",
"transAttributes": "<string>",
"type": "<string>"
}
],
"targetLangs": [
"<string>"
],
"trimQuery": true
}
'import requests
url = "https://cloud.memsource.com/web/api2/v1/transMemories/{transMemoryUid}/search"
payload = {
"query": "<string>",
"sourceLang": "<string>",
"nextSegment": "<string>",
"phraseQuery": True,
"previousSegment": "<string>",
"tagMetadata": [
{
"content": "<string>",
"id": "<string>",
"transAttributes": "<string>",
"type": "<string>"
}
],
"targetLangs": ["<string>"],
"trimQuery": True
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: '<string>',
sourceLang: '<string>',
nextSegment: '<string>',
phraseQuery: true,
previousSegment: '<string>',
tagMetadata: [
{
content: '<string>',
id: '<string>',
transAttributes: '<string>',
type: '<string>'
}
],
targetLangs: ['<string>'],
trimQuery: true
})
};
fetch('https://cloud.memsource.com/web/api2/v1/transMemories/{transMemoryUid}/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cloud.memsource.com/web/api2/v1/transMemories/{transMemoryUid}/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query' => '<string>',
'sourceLang' => '<string>',
'nextSegment' => '<string>',
'phraseQuery' => true,
'previousSegment' => '<string>',
'tagMetadata' => [
[
'content' => '<string>',
'id' => '<string>',
'transAttributes' => '<string>',
'type' => '<string>'
]
],
'targetLangs' => [
'<string>'
],
'trimQuery' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://cloud.memsource.com/web/api2/v1/transMemories/{transMemoryUid}/search"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"sourceLang\": \"<string>\",\n \"nextSegment\": \"<string>\",\n \"phraseQuery\": true,\n \"previousSegment\": \"<string>\",\n \"tagMetadata\": [\n {\n \"content\": \"<string>\",\n \"id\": \"<string>\",\n \"transAttributes\": \"<string>\",\n \"type\": \"<string>\"\n }\n ],\n \"targetLangs\": [\n \"<string>\"\n ],\n \"trimQuery\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://cloud.memsource.com/web/api2/v1/transMemories/{transMemoryUid}/search")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"sourceLang\": \"<string>\",\n \"nextSegment\": \"<string>\",\n \"phraseQuery\": true,\n \"previousSegment\": \"<string>\",\n \"tagMetadata\": [\n {\n \"content\": \"<string>\",\n \"id\": \"<string>\",\n \"transAttributes\": \"<string>\",\n \"type\": \"<string>\"\n }\n ],\n \"targetLangs\": [\n \"<string>\"\n ],\n \"trimQuery\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud.memsource.com/web/api2/v1/transMemories/{transMemoryUid}/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"<string>\",\n \"sourceLang\": \"<string>\",\n \"nextSegment\": \"<string>\",\n \"phraseQuery\": true,\n \"previousSegment\": \"<string>\",\n \"tagMetadata\": [\n {\n \"content\": \"<string>\",\n \"id\": \"<string>\",\n \"transAttributes\": \"<string>\",\n \"type\": \"<string>\"\n }\n ],\n \"targetLangs\": [\n \"<string>\"\n ],\n \"trimQuery\": true\n}"
response = http.request(request)
puts response.read_body{
"searchResults": [
{
"grossScore": 123,
"score": 123,
"segmentId": "<string>",
"source": {
"client": {
"id": 123,
"name": "<string>"
},
"createdAt": 123,
"createdBy": {
"email": "<string>",
"firstName": "<string>",
"id": "<string>",
"lastName": "<string>",
"role": "SYS_ADMIN",
"uid": "<string>",
"userName": "<string>"
},
"domain": {
"id": 123,
"name": "<string>"
},
"filename": "<string>",
"id": "<string>",
"key": "<string>",
"lang": "<string>",
"modifiedAt": 123,
"modifiedBy": {
"email": "<string>",
"firstName": "<string>",
"id": "<string>",
"lastName": "<string>",
"role": "SYS_ADMIN",
"uid": "<string>",
"userName": "<string>"
},
"nextSegment": "<string>",
"previousSegment": "<string>",
"project": {
"id": 123,
"name": "<string>",
"uid": "<string>"
},
"rtl": true,
"subDomain": {
"id": 123,
"name": "<string>"
},
"tagMetadata": [
{
"content": "<string>",
"id": "<string>",
"transAttributes": "<string>",
"type": "<string>"
}
],
"text": "<string>"
},
"subSegment": true,
"transMemory": {
"id": "<string>",
"name": "<string>",
"reverse": true,
"uid": "<string>"
},
"translations": [
{
"client": {
"id": 123,
"name": "<string>"
},
"createdAt": 123,
"createdBy": {
"email": "<string>",
"firstName": "<string>",
"id": "<string>",
"lastName": "<string>",
"role": "SYS_ADMIN",
"uid": "<string>",
"userName": "<string>"
},
"domain": {
"id": 123,
"name": "<string>"
},
"filename": "<string>",
"id": "<string>",
"key": "<string>",
"lang": "<string>",
"modifiedAt": 123,
"modifiedBy": {
"email": "<string>",
"firstName": "<string>",
"id": "<string>",
"lastName": "<string>",
"role": "SYS_ADMIN",
"uid": "<string>",
"userName": "<string>"
},
"nextSegment": "<string>",
"previousSegment": "<string>",
"project": {
"id": 123,
"name": "<string>",
"uid": "<string>"
},
"rtl": true,
"subDomain": {
"id": 123,
"name": "<string>"
},
"tagMetadata": [
{
"content": "<string>",
"id": "<string>",
"transAttributes": "<string>",
"type": "<string>"
}
],
"text": "<string>"
}
]
}
]
}Authorizations
ApiTokenOAuth2
Get a token from auth/login endpoint and then pass it in the Authorization HTTP header in every subsequent API call. For more information visit our help center.
Path Parameters
Translation memory UID
Body
application/json
Search request payload
Return both wildcard and exact search results. Default: true
Per-tag content used for tag-sensitive matching against the query segment's inline tags
Show child attributes
Show child attributes
Remove leading and trailing whitespace from query. Default: true
Response
OK
Translation memory search results
Show child attributes
Show child attributes
Was this page helpful?