curl --request PATCH \
--url https://api.phrase.com/v2/accounts/{account_id}/machine_translation_settings \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"default_service": "google_translate"
}
'import requests
url = "https://api.phrase.com/v2/accounts/{account_id}/machine_translation_settings"
payload = { "default_service": "google_translate" }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({default_service: 'google_translate'})
};
fetch('https://api.phrase.com/v2/accounts/{account_id}/machine_translation_settings', 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://api.phrase.com/v2/accounts/{account_id}/machine_translation_settings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'default_service' => 'google_translate'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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://api.phrase.com/v2/accounts/{account_id}/machine_translation_settings"
payload := strings.NewReader("{\n \"default_service\": \"google_translate\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.patch("https://api.phrase.com/v2/accounts/{account_id}/machine_translation_settings")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"default_service\": \"google_translate\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.phrase.com/v2/accounts/{account_id}/machine_translation_settings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"default_service\": \"google_translate\"\n}"
response = http.request(request)
puts response.read_body{
"default_service": "google_translate",
"machine_translation_units_used": 12500,
"machine_translation_units_total": 1000000,
"locale_provider_mappings": [
{
"source_locale_code": "en",
"target_locale_code": "de",
"service": "google_translate"
}
]
}{
"message": "Validation Failed",
"errors": [
{
"resource": "Resource",
"field": "name",
"message": "can't be blank"
}
]
}Update machine translation settings
Sets the default machine translation service for the account. Requires write
access to the account’s machine translation settings. Passing an empty or
absent value for default_service resets the account to its plan default
(Microsoft Translate).
curl --request PATCH \
--url https://api.phrase.com/v2/accounts/{account_id}/machine_translation_settings \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"default_service": "google_translate"
}
'import requests
url = "https://api.phrase.com/v2/accounts/{account_id}/machine_translation_settings"
payload = { "default_service": "google_translate" }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({default_service: 'google_translate'})
};
fetch('https://api.phrase.com/v2/accounts/{account_id}/machine_translation_settings', 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://api.phrase.com/v2/accounts/{account_id}/machine_translation_settings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'default_service' => 'google_translate'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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://api.phrase.com/v2/accounts/{account_id}/machine_translation_settings"
payload := strings.NewReader("{\n \"default_service\": \"google_translate\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.patch("https://api.phrase.com/v2/accounts/{account_id}/machine_translation_settings")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"default_service\": \"google_translate\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.phrase.com/v2/accounts/{account_id}/machine_translation_settings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"default_service\": \"google_translate\"\n}"
response = http.request(request)
puts response.read_body{
"default_service": "google_translate",
"machine_translation_units_used": 12500,
"machine_translation_units_total": 1000000,
"locale_provider_mappings": [
{
"source_locale_code": "en",
"target_locale_code": "de",
"service": "google_translate"
}
]
}{
"message": "Validation Failed",
"errors": [
{
"resource": "Resource",
"field": "name",
"message": "can't be blank"
}
]
}Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Headers
Two-Factor-Authentication token (optional)
Path Parameters
Account ID
Body
The machine translation engine to use as the account default. Supported values: language_ai_translate, aita_translate, microsoft_translate, google_translate, amazon_translate, intento_translate, gpt_translate. Pass null or an empty string to reset to the plan default.
"google_translate"
Response
OK
The default machine translation engine configured for the account. Returns "microsoft_translate" when no service has been explicitly configured. Supported values: language_ai_translate, aita_translate, microsoft_translate, google_translate, amazon_translate, intento_translate, gpt_translate.
"google_translate"
Number of machine translation characters consumed in the current billing period.
12500
Total machine translation character quota granted for the current billing period.
1000000
Per-locale-pair provider overrides. When a matching mapping exists for a source/target locale pair, that provider takes precedence over the account default.
Show child attributes
Show child attributes
Was this page helpful?