curl "https://api.phrase.com/v2/projects/:project_id/jobs" \
-u USERNAME_OR_ACCESS_TOKEN \
-X POST \
-d '{"branch":"my-feature-branch","name":"de","briefing":"de-DE","due_date":"2017-08-15","ticket_url":"https://example.atlassian.net/browse/FOO","tags":["myUploadTag"],"translation_key_ids":["abcd1234cdef1234abcd1234cdef1234"]}' \
-H 'Content-Type: application/json'phrase jobs create \
--project_id <project_id> \
--data '{"branch":"my-feature-branch", "name":"de", "briefing":"de-DE", "due_date":"2017-08-15", "ticket_url":"https://example.atlassian.net/browse/FOO", "tags": ["myUploadTag"], "translation_key_ids": ["abcd1234cdef1234abcd1234cdef1234"]}' \
--access_token <token>import requests
url = "https://api.phrase.com/v2/projects/{project_id}/jobs"
payload = {
"name": "de",
"branch": "my-feature-branch",
"source_locale_id": "abcd1234cdef1234abcd1234cdef1234",
"briefing": "de-DE",
"due_date": "2017-08-15",
"ticket_url": "https://example.atlassian.net/browse/FOO",
"tags": ["myUploadTag"],
"translation_key_ids": ["abcd1234cdef1234abcd1234cdef1234"],
"target_locale_ids": ["abcd1234cdef1234abcd1234cdef1234"],
"job_template_id": "abcd1234cdef1234abcd1234cdef1234",
"autotranslate": 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({
name: 'de',
branch: 'my-feature-branch',
source_locale_id: 'abcd1234cdef1234abcd1234cdef1234',
briefing: 'de-DE',
due_date: '2017-08-15',
ticket_url: 'https://example.atlassian.net/browse/FOO',
tags: ['myUploadTag'],
translation_key_ids: ['abcd1234cdef1234abcd1234cdef1234'],
target_locale_ids: ['abcd1234cdef1234abcd1234cdef1234'],
job_template_id: 'abcd1234cdef1234abcd1234cdef1234',
autotranslate: true
})
};
fetch('https://api.phrase.com/v2/projects/{project_id}/jobs', 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",
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([
'name' => 'de',
'branch' => 'my-feature-branch',
'source_locale_id' => 'abcd1234cdef1234abcd1234cdef1234',
'briefing' => 'de-DE',
'due_date' => '2017-08-15',
'ticket_url' => 'https://example.atlassian.net/browse/FOO',
'tags' => [
'myUploadTag'
],
'translation_key_ids' => [
'abcd1234cdef1234abcd1234cdef1234'
],
'target_locale_ids' => [
'abcd1234cdef1234abcd1234cdef1234'
],
'job_template_id' => 'abcd1234cdef1234abcd1234cdef1234',
'autotranslate' => 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://api.phrase.com/v2/projects/{project_id}/jobs"
payload := strings.NewReader("{\n \"name\": \"de\",\n \"branch\": \"my-feature-branch\",\n \"source_locale_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"briefing\": \"de-DE\",\n \"due_date\": \"2017-08-15\",\n \"ticket_url\": \"https://example.atlassian.net/browse/FOO\",\n \"tags\": [\n \"myUploadTag\"\n ],\n \"translation_key_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"target_locale_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"job_template_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"autotranslate\": 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://api.phrase.com/v2/projects/{project_id}/jobs")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"de\",\n \"branch\": \"my-feature-branch\",\n \"source_locale_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"briefing\": \"de-DE\",\n \"due_date\": \"2017-08-15\",\n \"ticket_url\": \"https://example.atlassian.net/browse/FOO\",\n \"tags\": [\n \"myUploadTag\"\n ],\n \"translation_key_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"target_locale_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"job_template_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"autotranslate\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.phrase.com/v2/projects/{project_id}/jobs")
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 \"name\": \"de\",\n \"branch\": \"my-feature-branch\",\n \"source_locale_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"briefing\": \"de-DE\",\n \"due_date\": \"2017-08-15\",\n \"ticket_url\": \"https://example.atlassian.net/browse/FOO\",\n \"tags\": [\n \"myUploadTag\"\n ],\n \"translation_key_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"target_locale_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"job_template_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"autotranslate\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "626ea67628690c73ac86ac81eec2d185",
"name": "Translations for new Feature",
"briefing": "Some instructions for the translators",
"due_date": "2017-02-28T09:52:53Z",
"state": "completed",
"ticket_url": "https://example.atlassian.net/browse/FOO",
"created_at": "2017-01-28T09:52:53Z",
"updated_at": "2017-01-28T09:52:53Z",
"project": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "My Android Project",
"main_format": "xml",
"created_at": "2015-01-28T09:52:53Z",
"updated_at": "2015-01-28T09:52:53Z"
},
"owner": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"username": "joe.doe",
"name": "Joe Doe"
},
"job_tag_name": "Job_123",
"source_translations_updated_at": "2020-01-01T00:00:00Z",
"source_locale": {
"id": "abcd1234cdef1234abcd1234cdef1235",
"name": "de-DE",
"code": "de-DE"
},
"locales": [
{
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "English",
"code": "en-GB"
}
],
"keys": [
{
"id": "dbcd1234cdef1234abcd1234cdef1234",
"name": "greeting.hello"
}
]
}{
"message": "Validation Failed",
"errors": [
{
"resource": "Resource",
"field": "name",
"message": "can't be blank"
}
]
}Create a job
Create a new job.
curl "https://api.phrase.com/v2/projects/:project_id/jobs" \
-u USERNAME_OR_ACCESS_TOKEN \
-X POST \
-d '{"branch":"my-feature-branch","name":"de","briefing":"de-DE","due_date":"2017-08-15","ticket_url":"https://example.atlassian.net/browse/FOO","tags":["myUploadTag"],"translation_key_ids":["abcd1234cdef1234abcd1234cdef1234"]}' \
-H 'Content-Type: application/json'phrase jobs create \
--project_id <project_id> \
--data '{"branch":"my-feature-branch", "name":"de", "briefing":"de-DE", "due_date":"2017-08-15", "ticket_url":"https://example.atlassian.net/browse/FOO", "tags": ["myUploadTag"], "translation_key_ids": ["abcd1234cdef1234abcd1234cdef1234"]}' \
--access_token <token>import requests
url = "https://api.phrase.com/v2/projects/{project_id}/jobs"
payload = {
"name": "de",
"branch": "my-feature-branch",
"source_locale_id": "abcd1234cdef1234abcd1234cdef1234",
"briefing": "de-DE",
"due_date": "2017-08-15",
"ticket_url": "https://example.atlassian.net/browse/FOO",
"tags": ["myUploadTag"],
"translation_key_ids": ["abcd1234cdef1234abcd1234cdef1234"],
"target_locale_ids": ["abcd1234cdef1234abcd1234cdef1234"],
"job_template_id": "abcd1234cdef1234abcd1234cdef1234",
"autotranslate": 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({
name: 'de',
branch: 'my-feature-branch',
source_locale_id: 'abcd1234cdef1234abcd1234cdef1234',
briefing: 'de-DE',
due_date: '2017-08-15',
ticket_url: 'https://example.atlassian.net/browse/FOO',
tags: ['myUploadTag'],
translation_key_ids: ['abcd1234cdef1234abcd1234cdef1234'],
target_locale_ids: ['abcd1234cdef1234abcd1234cdef1234'],
job_template_id: 'abcd1234cdef1234abcd1234cdef1234',
autotranslate: true
})
};
fetch('https://api.phrase.com/v2/projects/{project_id}/jobs', 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",
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([
'name' => 'de',
'branch' => 'my-feature-branch',
'source_locale_id' => 'abcd1234cdef1234abcd1234cdef1234',
'briefing' => 'de-DE',
'due_date' => '2017-08-15',
'ticket_url' => 'https://example.atlassian.net/browse/FOO',
'tags' => [
'myUploadTag'
],
'translation_key_ids' => [
'abcd1234cdef1234abcd1234cdef1234'
],
'target_locale_ids' => [
'abcd1234cdef1234abcd1234cdef1234'
],
'job_template_id' => 'abcd1234cdef1234abcd1234cdef1234',
'autotranslate' => 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://api.phrase.com/v2/projects/{project_id}/jobs"
payload := strings.NewReader("{\n \"name\": \"de\",\n \"branch\": \"my-feature-branch\",\n \"source_locale_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"briefing\": \"de-DE\",\n \"due_date\": \"2017-08-15\",\n \"ticket_url\": \"https://example.atlassian.net/browse/FOO\",\n \"tags\": [\n \"myUploadTag\"\n ],\n \"translation_key_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"target_locale_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"job_template_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"autotranslate\": 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://api.phrase.com/v2/projects/{project_id}/jobs")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"de\",\n \"branch\": \"my-feature-branch\",\n \"source_locale_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"briefing\": \"de-DE\",\n \"due_date\": \"2017-08-15\",\n \"ticket_url\": \"https://example.atlassian.net/browse/FOO\",\n \"tags\": [\n \"myUploadTag\"\n ],\n \"translation_key_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"target_locale_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"job_template_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"autotranslate\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.phrase.com/v2/projects/{project_id}/jobs")
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 \"name\": \"de\",\n \"branch\": \"my-feature-branch\",\n \"source_locale_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"briefing\": \"de-DE\",\n \"due_date\": \"2017-08-15\",\n \"ticket_url\": \"https://example.atlassian.net/browse/FOO\",\n \"tags\": [\n \"myUploadTag\"\n ],\n \"translation_key_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"target_locale_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"job_template_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"autotranslate\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "626ea67628690c73ac86ac81eec2d185",
"name": "Translations for new Feature",
"briefing": "Some instructions for the translators",
"due_date": "2017-02-28T09:52:53Z",
"state": "completed",
"ticket_url": "https://example.atlassian.net/browse/FOO",
"created_at": "2017-01-28T09:52:53Z",
"updated_at": "2017-01-28T09:52:53Z",
"project": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "My Android Project",
"main_format": "xml",
"created_at": "2015-01-28T09:52:53Z",
"updated_at": "2015-01-28T09:52:53Z"
},
"owner": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"username": "joe.doe",
"name": "Joe Doe"
},
"job_tag_name": "Job_123",
"source_translations_updated_at": "2020-01-01T00:00:00Z",
"source_locale": {
"id": "abcd1234cdef1234abcd1234cdef1235",
"name": "de-DE",
"code": "de-DE"
},
"locales": [
{
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "English",
"code": "en-GB"
}
],
"keys": [
{
"id": "dbcd1234cdef1234abcd1234cdef1234",
"name": "greeting.hello"
}
]
}{
"message": "Validation Failed",
"errors": [
{
"resource": "Resource",
"field": "name",
"message": "can't be blank"
}
]
}Authorizations
Enter your token in the format token TOKEN
Headers
Two-Factor-Authentication token (optional)
Path Parameters
Project ID
Body
Job name
"de"
specify the branch to use
"my-feature-branch"
The API id of the source language
"abcd1234cdef1234abcd1234cdef1234"
Briefing for the translators
"de-DE"
Date the job should be finished
"2017-08-15"
URL to a ticket for this job (e.g. Jira, Trello)
"https://example.atlassian.net/browse/FOO"
tags of keys that should be included within the job
["myUploadTag"]
ids of keys that should be included within the job
["abcd1234cdef1234abcd1234cdef1234"]
List of target locales for the job. Mutually exclusive with job_template_id.
["abcd1234cdef1234abcd1234cdef1234"]
id of a job template you would like to model the created job after. Any manually added parameters will take preference over template attributes. Mutually exclusive with target_locale_ids.
"abcd1234cdef1234abcd1234cdef1234"
Automatically translate the job using machine translation.
true
Response
Created
Show child attributes
Show child attributes
{
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "My Android Project",
"main_format": "xml",
"created_at": "2015-01-28T09:52:53Z",
"updated_at": "2015-01-28T09:52:53Z"
}
Show child attributes
Show child attributes
{ "name": "new-branch" }
The ID of the automation that created this job, or null if the job was created manually.
The ID of the job template this job was created from, or null if no template was used.
The review due date for this job. Returns null when the project does not have review workflow enabled.
"2015-03-25T11:43:52Z"
Show child attributes
Show child attributes
{
"id": "abcd1234cdef1234abcd1234cdef1234",
"username": "johndoe",
"name": "John Doe",
"gravatar_uid": "205e460b479e2e5b48aec07710c08d50"
}
Show child attributes
Show child attributes
{
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "English",
"code": "en-GB"
}
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Returned only when include_annotations=true is supplied on the request.
Show child attributes
Show child attributes
true if the job has been locked by the project's job-locking workflow (translations attached to the job are read-only until the job advances).
Was this page helpful?