curl "https://api.phrase.com/v2/projects/:project_id/jobs/:id/keys" \
-u USERNAME_OR_ACCESS_TOKEN \
-X POST \
-d '{"branch":"my-feature-branch","translation_key_ids":["abcd1234cdef1234abcd1234cdef1234"]}' \
-H 'Content-Type: application/json'phrase jobs keys_create \
--project_id <project_id> \
--id <id> \
--data '{"branch":"my-feature-branch", "translation_key_ids": "abcd1234cdef1234abcd1234cdef1234"}' \
--access_token <token>import requests
url = "https://api.phrase.com/v2/projects/{project_id}/jobs/{id}/keys"
payload = {
"branch": "my-feature-branch",
"translation_key_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({
branch: 'my-feature-branch',
translation_key_ids: ['abcd1234cdef1234abcd1234cdef1234']
})
};
fetch('https://api.phrase.com/v2/projects/{project_id}/jobs/{id}/keys', 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/{id}/keys",
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([
'branch' => 'my-feature-branch',
'translation_key_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/{id}/keys"
payload := strings.NewReader("{\n \"branch\": \"my-feature-branch\",\n \"translation_key_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/{id}/keys")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"branch\": \"my-feature-branch\",\n \"translation_key_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.phrase.com/v2/projects/{project_id}/jobs/{id}/keys")
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 \"branch\": \"my-feature-branch\",\n \"translation_key_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ]\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"
}
]
}Add keys to job
Add multiple keys to a existing job.
curl "https://api.phrase.com/v2/projects/:project_id/jobs/:id/keys" \
-u USERNAME_OR_ACCESS_TOKEN \
-X POST \
-d '{"branch":"my-feature-branch","translation_key_ids":["abcd1234cdef1234abcd1234cdef1234"]}' \
-H 'Content-Type: application/json'phrase jobs keys_create \
--project_id <project_id> \
--id <id> \
--data '{"branch":"my-feature-branch", "translation_key_ids": "abcd1234cdef1234abcd1234cdef1234"}' \
--access_token <token>import requests
url = "https://api.phrase.com/v2/projects/{project_id}/jobs/{id}/keys"
payload = {
"branch": "my-feature-branch",
"translation_key_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({
branch: 'my-feature-branch',
translation_key_ids: ['abcd1234cdef1234abcd1234cdef1234']
})
};
fetch('https://api.phrase.com/v2/projects/{project_id}/jobs/{id}/keys', 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/{id}/keys",
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([
'branch' => 'my-feature-branch',
'translation_key_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/{id}/keys"
payload := strings.NewReader("{\n \"branch\": \"my-feature-branch\",\n \"translation_key_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/{id}/keys")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"branch\": \"my-feature-branch\",\n \"translation_key_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.phrase.com/v2/projects/{project_id}/jobs/{id}/keys")
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 \"branch\": \"my-feature-branch\",\n \"translation_key_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ]\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"
}
]
}Authorizations
Enter your token in the format token TOKEN
Headers
Two-Factor-Authentication token (optional)
Body
Response
OK
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?