Translate with AI (write)
curl --request POST \
--url https://api.textsetu.com/api/v1/projects/{projectId}/ai/translations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"targetLanguageCodes": [
"fr",
"de"
],
"keyIds": [
"<string>"
],
"onlyEmpty": true,
"onlyOutdated": true,
"includeTags": [
"<string>"
],
"excludeTags": [
"<string>"
],
"keyPrefix": "<string>",
"autoApprove": true,
"review": true,
"batch": true
}
'import requests
url = "https://api.textsetu.com/api/v1/projects/{projectId}/ai/translations"
payload = {
"targetLanguageCodes": ["fr", "de"],
"keyIds": ["<string>"],
"onlyEmpty": True,
"onlyOutdated": True,
"includeTags": ["<string>"],
"excludeTags": ["<string>"],
"keyPrefix": "<string>",
"autoApprove": True,
"review": True,
"batch": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
targetLanguageCodes: ['fr', 'de'],
keyIds: ['<string>'],
onlyEmpty: true,
onlyOutdated: true,
includeTags: ['<string>'],
excludeTags: ['<string>'],
keyPrefix: '<string>',
autoApprove: true,
review: true,
batch: true
})
};
fetch('https://api.textsetu.com/api/v1/projects/{projectId}/ai/translations', 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.textsetu.com/api/v1/projects/{projectId}/ai/translations",
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([
'targetLanguageCodes' => [
'fr',
'de'
],
'keyIds' => [
'<string>'
],
'onlyEmpty' => true,
'onlyOutdated' => true,
'includeTags' => [
'<string>'
],
'excludeTags' => [
'<string>'
],
'keyPrefix' => '<string>',
'autoApprove' => true,
'review' => true,
'batch' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.textsetu.com/api/v1/projects/{projectId}/ai/translations"
payload := strings.NewReader("{\n \"targetLanguageCodes\": [\n \"fr\",\n \"de\"\n ],\n \"keyIds\": [\n \"<string>\"\n ],\n \"onlyEmpty\": true,\n \"onlyOutdated\": true,\n \"includeTags\": [\n \"<string>\"\n ],\n \"excludeTags\": [\n \"<string>\"\n ],\n \"keyPrefix\": \"<string>\",\n \"autoApprove\": true,\n \"review\": true,\n \"batch\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.textsetu.com/api/v1/projects/{projectId}/ai/translations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"targetLanguageCodes\": [\n \"fr\",\n \"de\"\n ],\n \"keyIds\": [\n \"<string>\"\n ],\n \"onlyEmpty\": true,\n \"onlyOutdated\": true,\n \"includeTags\": [\n \"<string>\"\n ],\n \"excludeTags\": [\n \"<string>\"\n ],\n \"keyPrefix\": \"<string>\",\n \"autoApprove\": true,\n \"review\": true,\n \"batch\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.textsetu.com/api/v1/projects/{projectId}/ai/translations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"targetLanguageCodes\": [\n \"fr\",\n \"de\"\n ],\n \"keyIds\": [\n \"<string>\"\n ],\n \"onlyEmpty\": true,\n \"onlyOutdated\": true,\n \"includeTags\": [\n \"<string>\"\n ],\n \"excludeTags\": [\n \"<string>\"\n ],\n \"keyPrefix\": \"<string>\",\n \"autoApprove\": true,\n \"review\": true,\n \"batch\": true\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"jobId": "job_a1b2c3d4",
"status": "queued"
}
}AI
Translate with AI (write)
Machine-translate the project’s candidate keys into one or more target languages with the resolved engine. Runs asynchronously — poll the returned jobId.
Candidates are filtered in SQL before any model sees a string (onlyEmpty / onlyOutdated / tag filters / keyPrefix / explicit keyIds). With ?branch= the run targets a branch instead of main. Writes follow the project’s approval workflow exactly as in the app.
Constraints:
- Metered against the org’s AI credits when running on a TextSetu platform key; free on a BYOK key.
autoApproveis honored only for callers that can approve; otherwise writes land as proposals.
POST
/
projects
/
{projectId}
/
ai
/
translations
Translate with AI (write)
curl --request POST \
--url https://api.textsetu.com/api/v1/projects/{projectId}/ai/translations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"targetLanguageCodes": [
"fr",
"de"
],
"keyIds": [
"<string>"
],
"onlyEmpty": true,
"onlyOutdated": true,
"includeTags": [
"<string>"
],
"excludeTags": [
"<string>"
],
"keyPrefix": "<string>",
"autoApprove": true,
"review": true,
"batch": true
}
'import requests
url = "https://api.textsetu.com/api/v1/projects/{projectId}/ai/translations"
payload = {
"targetLanguageCodes": ["fr", "de"],
"keyIds": ["<string>"],
"onlyEmpty": True,
"onlyOutdated": True,
"includeTags": ["<string>"],
"excludeTags": ["<string>"],
"keyPrefix": "<string>",
"autoApprove": True,
"review": True,
"batch": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
targetLanguageCodes: ['fr', 'de'],
keyIds: ['<string>'],
onlyEmpty: true,
onlyOutdated: true,
includeTags: ['<string>'],
excludeTags: ['<string>'],
keyPrefix: '<string>',
autoApprove: true,
review: true,
batch: true
})
};
fetch('https://api.textsetu.com/api/v1/projects/{projectId}/ai/translations', 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.textsetu.com/api/v1/projects/{projectId}/ai/translations",
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([
'targetLanguageCodes' => [
'fr',
'de'
],
'keyIds' => [
'<string>'
],
'onlyEmpty' => true,
'onlyOutdated' => true,
'includeTags' => [
'<string>'
],
'excludeTags' => [
'<string>'
],
'keyPrefix' => '<string>',
'autoApprove' => true,
'review' => true,
'batch' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.textsetu.com/api/v1/projects/{projectId}/ai/translations"
payload := strings.NewReader("{\n \"targetLanguageCodes\": [\n \"fr\",\n \"de\"\n ],\n \"keyIds\": [\n \"<string>\"\n ],\n \"onlyEmpty\": true,\n \"onlyOutdated\": true,\n \"includeTags\": [\n \"<string>\"\n ],\n \"excludeTags\": [\n \"<string>\"\n ],\n \"keyPrefix\": \"<string>\",\n \"autoApprove\": true,\n \"review\": true,\n \"batch\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.textsetu.com/api/v1/projects/{projectId}/ai/translations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"targetLanguageCodes\": [\n \"fr\",\n \"de\"\n ],\n \"keyIds\": [\n \"<string>\"\n ],\n \"onlyEmpty\": true,\n \"onlyOutdated\": true,\n \"includeTags\": [\n \"<string>\"\n ],\n \"excludeTags\": [\n \"<string>\"\n ],\n \"keyPrefix\": \"<string>\",\n \"autoApprove\": true,\n \"review\": true,\n \"batch\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.textsetu.com/api/v1/projects/{projectId}/ai/translations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"targetLanguageCodes\": [\n \"fr\",\n \"de\"\n ],\n \"keyIds\": [\n \"<string>\"\n ],\n \"onlyEmpty\": true,\n \"onlyOutdated\": true,\n \"includeTags\": [\n \"<string>\"\n ],\n \"excludeTags\": [\n \"<string>\"\n ],\n \"keyPrefix\": \"<string>\",\n \"autoApprove\": true,\n \"review\": true,\n \"batch\": true\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"jobId": "job_a1b2c3d4",
"status": "queued"
}
}Authorizations
Query Parameters
Body
application/json

