Skip to main content
PATCH
/
projects
/
{project_id}
/
translations
/
{id}
/
include
cURL
curl "https://api.phrase.com/v2/projects/:project_id/translations/:id/include" \
  -u USERNAME_OR_ACCESS_TOKEN \
  -X PATCH \
  -d '{"branch":"my-feature-branch"}' \
  -H 'Content-Type: application/json'
phrase translations include \
--project_id <project_id> \
--id <id> \
--data '{"branch":"my-feature-branch"}' \
--access_token <token>
import requests

url = "https://api.phrase.com/v2/projects/{project_id}/translations/{id}/include"

payload = { "branch": "my-feature-branch" }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({branch: 'my-feature-branch'})
};

fetch('https://api.phrase.com/v2/projects/{project_id}/translations/{id}/include', 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}/translations/{id}/include",
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([
'branch' => 'my-feature-branch'
]),
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}/translations/{id}/include"

payload := strings.NewReader("{\n \"branch\": \"my-feature-branch\"\n}")

req, _ := http.NewRequest("PATCH", 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.patch("https://api.phrase.com/v2/projects/{project_id}/translations/{id}/include")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"branch\": \"my-feature-branch\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.phrase.com/v2/projects/{project_id}/translations/{id}/include")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"branch\": \"my-feature-branch\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "abcd1234cdef1234abcd1234cdef1234",
  "content": "My translation",
  "unverified": false,
  "excluded": false,
  "plural_suffix": "",
  "key": {
    "id": "abcd1234cdef1234abcd1234cdef1234",
    "name": "home.index.headline",
    "plural": false,
    "use_ordinal_rules": false
  },
  "locale": {
    "id": "abcd1234cdef1234abcd1234cdef1234",
    "name": "de",
    "code": "de-DE"
  },
  "placeholders": [
    "%{count}"
  ],
  "state": "translated",
  "created_at": "2015-01-28T09:52:53Z",
  "updated_at": "2015-01-28T09:52:53Z",
  "user": {
    "id": "abcd1234cdef1234abcd1234cdef1234",
    "username": "joe.doe",
    "name": "Joe Doe"
  },
  "word_count": 2
}
{
"message": "Validation Failed",
"errors": [
{
"resource": "Resource",
"field": "name",
"message": "can't be blank"
}
]
}

Authorizations

Authorization
string
header
required

Enter your token in the format token TOKEN

Headers

X-PhraseApp-OTP
string

Two-Factor-Authentication token (optional)

Path Parameters

project_id
string
required

Project ID

id
string
required

ID

Body

application/json
branch
string

specify the branch to use

Example:

"my-feature-branch"

Response

OK

id
string
content
string
unverified
boolean
excluded
boolean
plural_suffix
string
key
key_preview · object
Example:

null

locale
locale_preview · object
Example:
{
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "English",
"code": "en-GB"
}
placeholders
string[]
state
string
created_at
string<date-time>
updated_at
string<date-time>
linked_translation
translation_parent · object
Example:
{
"id": "abcd1234cdef1234abcd1234cdef1234",
"content": "My parent translation"
}
user
user_preview · object
Example:
{
"id": "abcd1234cdef1234abcd1234cdef1234",
"username": "johndoe",
"name": "John Doe",
"gravatar_uid": "205e460b479e2e5b48aec07710c08d50"
}
word_count
integer