cURL
curl "https://api.phrase.com/v2/projects/:project_id/jobs/:job_id/locales" \
-u USERNAME_OR_ACCESS_TOKEN \
-X POST \
-d '{"branch":"my-feature-branch","locale_id":"abcd1234cdef1234abcd1234cdef1234","user_ids":["abcd1234cdef1234abcd1234cdef1234"], "translator_team_ids":["abcd1234cdef1234abcd1234cdef1234"]}' \
-H 'Content-Type: application/json'phrase job_locales create \
--project_id <project_id> \
--job_id <job_id> \
--data '{"branch":"my-feature-branch", "locale_id":"abcd1234cdef1234abcd1234cdef1234", "user_ids": "abcd1234cdef1234abcd1234cdef1234", "translator_team_ids": "abcd1234cdef1234abcd1234cdef1234"}' \
--access_token <token>import requests
url = "https://api.phrase.com/v2/projects/{project_id}/jobs/{job_id}/locales"
payload = {
"locale_id": "abcd1234cdef1234abcd1234cdef1234",
"branch": "my-feature-branch",
"user_ids": ["abcd1234cdef1234abcd1234cdef1234"],
"reviewer_ids": ["abcd1234cdef1234abcd1234cdef1234"],
"translator_team_ids": ["abcd1234cdef1234abcd1234cdef1234"],
"reviewer_team_ids": ["abcd1234cdef1234abcd1234cdef1234"]
}
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({
locale_id: 'abcd1234cdef1234abcd1234cdef1234',
branch: 'my-feature-branch',
user_ids: ['abcd1234cdef1234abcd1234cdef1234'],
reviewer_ids: ['abcd1234cdef1234abcd1234cdef1234'],
translator_team_ids: ['abcd1234cdef1234abcd1234cdef1234'],
reviewer_team_ids: ['abcd1234cdef1234abcd1234cdef1234']
})
};
fetch('https://api.phrase.com/v2/projects/{project_id}/jobs/{job_id}/locales', 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/projects/{project_id}/jobs/{job_id}/locales",
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([
'locale_id' => 'abcd1234cdef1234abcd1234cdef1234',
'branch' => 'my-feature-branch',
'user_ids' => [
'abcd1234cdef1234abcd1234cdef1234'
],
'reviewer_ids' => [
'abcd1234cdef1234abcd1234cdef1234'
],
'translator_team_ids' => [
'abcd1234cdef1234abcd1234cdef1234'
],
'reviewer_team_ids' => [
'abcd1234cdef1234abcd1234cdef1234'
]
]),
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://api.phrase.com/v2/projects/{project_id}/jobs/{job_id}/locales"
payload := strings.NewReader("{\n \"locale_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"branch\": \"my-feature-branch\",\n \"user_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"reviewer_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"translator_team_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"reviewer_team_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ]\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://api.phrase.com/v2/projects/{project_id}/jobs/{job_id}/locales")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"locale_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"branch\": \"my-feature-branch\",\n \"user_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"reviewer_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"translator_team_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"reviewer_team_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.phrase.com/v2/projects/{project_id}/jobs/{job_id}/locales")
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 \"locale_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"branch\": \"my-feature-branch\",\n \"user_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"reviewer_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"translator_team_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"reviewer_team_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "626ea67628690c73ac86ac81eec2d185",
"job": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "My Job 1",
"state": "completed"
},
"users": [
{
"id": "abcd1234cdef1234abcd1234cdef1234",
"username": "joe.doe",
"name": "Joe Doe",
"role": "translator"
}
],
"teams": [
{
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "Joe's team",
"role": "translator"
}
],
"locale": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "English",
"code": "en-GB"
},
"annotations": [
{
"name": "priority",
"value": "high",
"created_at": "2023-10-01T12:00:00Z",
"updated_at": "2023-10-01T12:00:00Z"
}
],
"completed": true,
"translation_completed_at": "2017-01-28T09:52:53Z",
"review_completed_at": "2017-01-28T09:52:53Z"
}Job Locales
Add a target locale to a job
Adds a target locale to a job.
POST
/
projects
/
{project_id}
/
jobs
/
{job_id}
/
locales
cURL
curl "https://api.phrase.com/v2/projects/:project_id/jobs/:job_id/locales" \
-u USERNAME_OR_ACCESS_TOKEN \
-X POST \
-d '{"branch":"my-feature-branch","locale_id":"abcd1234cdef1234abcd1234cdef1234","user_ids":["abcd1234cdef1234abcd1234cdef1234"], "translator_team_ids":["abcd1234cdef1234abcd1234cdef1234"]}' \
-H 'Content-Type: application/json'phrase job_locales create \
--project_id <project_id> \
--job_id <job_id> \
--data '{"branch":"my-feature-branch", "locale_id":"abcd1234cdef1234abcd1234cdef1234", "user_ids": "abcd1234cdef1234abcd1234cdef1234", "translator_team_ids": "abcd1234cdef1234abcd1234cdef1234"}' \
--access_token <token>import requests
url = "https://api.phrase.com/v2/projects/{project_id}/jobs/{job_id}/locales"
payload = {
"locale_id": "abcd1234cdef1234abcd1234cdef1234",
"branch": "my-feature-branch",
"user_ids": ["abcd1234cdef1234abcd1234cdef1234"],
"reviewer_ids": ["abcd1234cdef1234abcd1234cdef1234"],
"translator_team_ids": ["abcd1234cdef1234abcd1234cdef1234"],
"reviewer_team_ids": ["abcd1234cdef1234abcd1234cdef1234"]
}
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({
locale_id: 'abcd1234cdef1234abcd1234cdef1234',
branch: 'my-feature-branch',
user_ids: ['abcd1234cdef1234abcd1234cdef1234'],
reviewer_ids: ['abcd1234cdef1234abcd1234cdef1234'],
translator_team_ids: ['abcd1234cdef1234abcd1234cdef1234'],
reviewer_team_ids: ['abcd1234cdef1234abcd1234cdef1234']
})
};
fetch('https://api.phrase.com/v2/projects/{project_id}/jobs/{job_id}/locales', 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/projects/{project_id}/jobs/{job_id}/locales",
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([
'locale_id' => 'abcd1234cdef1234abcd1234cdef1234',
'branch' => 'my-feature-branch',
'user_ids' => [
'abcd1234cdef1234abcd1234cdef1234'
],
'reviewer_ids' => [
'abcd1234cdef1234abcd1234cdef1234'
],
'translator_team_ids' => [
'abcd1234cdef1234abcd1234cdef1234'
],
'reviewer_team_ids' => [
'abcd1234cdef1234abcd1234cdef1234'
]
]),
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://api.phrase.com/v2/projects/{project_id}/jobs/{job_id}/locales"
payload := strings.NewReader("{\n \"locale_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"branch\": \"my-feature-branch\",\n \"user_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"reviewer_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"translator_team_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"reviewer_team_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ]\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://api.phrase.com/v2/projects/{project_id}/jobs/{job_id}/locales")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"locale_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"branch\": \"my-feature-branch\",\n \"user_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"reviewer_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"translator_team_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"reviewer_team_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.phrase.com/v2/projects/{project_id}/jobs/{job_id}/locales")
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 \"locale_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"branch\": \"my-feature-branch\",\n \"user_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"reviewer_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"translator_team_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"reviewer_team_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "626ea67628690c73ac86ac81eec2d185",
"job": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "My Job 1",
"state": "completed"
},
"users": [
{
"id": "abcd1234cdef1234abcd1234cdef1234",
"username": "joe.doe",
"name": "Joe Doe",
"role": "translator"
}
],
"teams": [
{
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "Joe's team",
"role": "translator"
}
],
"locale": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "English",
"code": "en-GB"
},
"annotations": [
{
"name": "priority",
"value": "high",
"created_at": "2023-10-01T12:00:00Z",
"updated_at": "2023-10-01T12:00:00Z"
}
],
"completed": true,
"translation_completed_at": "2017-01-28T09:52:53Z",
"review_completed_at": "2017-01-28T09:52:53Z"
}Authorizations
TokenBasic
Enter your token in the format token TOKEN
Headers
Two-Factor-Authentication token (optional)
Body
application/json
ID of a locale to be added
Example:
"abcd1234cdef1234abcd1234cdef1234"
specify the branch to use
Example:
"my-feature-branch"
Array of user ids to be assigned to the job locale as translators
Example:
["abcd1234cdef1234abcd1234cdef1234"]
Array of reviewer ids to be assigned to the job locale as reviewers
Example:
["abcd1234cdef1234abcd1234cdef1234"]
Array of team ids to be assigned to the job locale as translators
Example:
["abcd1234cdef1234abcd1234cdef1234"]
Array of team ids to be assigned to the job locale as reviewers
Example:
["abcd1234cdef1234abcd1234cdef1234"]
Response
Created
Show child attributes
Show child attributes
Example:
null
Show child attributes
Show child attributes
Example:
{
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "English",
"code": "en-GB"
}
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?
⌘I