Skip to main content
PATCH
/
accounts
/
{account_id}
/
distributions
/
{id}
cURL
curl "https://api.phrase.com/v2/accounts/:account_id/distributions/:id" \
  -u USERNAME_OR_ACCESS_TOKEN \
  -X PATCH \
  -d '{"name":"My Android Distribution","project_id":"abcd1234abcd1234abcd1234","platforms":["android","ios"],"locale_ids":["fff565db236400772368235db2c6117e,abcd1234cdef1234abcd1234cdef1234"],"format_options":"{xml:{enclose_in_cdata:'1'}}","fallback_to_non_regional_locale":true,"fallback_to_default_locale":true,"use_last_reviewed_version":true}' \
  -H 'Content-Type: application/json'
phrase distributions update \
--account_id <account_id> \
--id <id> \
--data '{"name": "My Android Distribution", "project_id":"abcd1234abcd1234abcd1234", "platforms": "android,ios", "locale_ids": "fff565db236400772368235db2c6117e,abcd1234cdef1234abcd1234cdef1234", "format_options": "{xml:{enclose_in_cdata:'1'}}", "fallback_to_non_regional_locale":true, "fallback_to_default_locale":true, "use_last_reviewed_version":true}' \
--access_token <token>
import requests

url = "https://api.phrase.com/v2/accounts/{account_id}/distributions/{id}"

payload = {
"name": "My Android Distribution",
"project_id": "abcd1234abcd1234abcd1234",
"platforms": ["android", "ios"],
"locale_ids": ["abcd1234cdef1234abcd1234cdef1234", "fff565db236400772368235db2c6117e"],
"format_options": "{xml:{enclose_in_cdata:'1'}}",
"fallback_locales_enabled": True,
"fallback_to_non_regional_locale": True,
"fallback_to_default_locale": True,
"use_last_reviewed_version": True
}
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({
name: 'My Android Distribution',
project_id: 'abcd1234abcd1234abcd1234',
platforms: ['android', 'ios'],
locale_ids: ['abcd1234cdef1234abcd1234cdef1234', 'fff565db236400772368235db2c6117e'],
format_options: '{xml:{enclose_in_cdata:\'1\'}}',
fallback_locales_enabled: true,
fallback_to_non_regional_locale: true,
fallback_to_default_locale: true,
use_last_reviewed_version: true
})
};

fetch('https://api.phrase.com/v2/accounts/{account_id}/distributions/{id}', 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/accounts/{account_id}/distributions/{id}",
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([
'name' => 'My Android Distribution',
'project_id' => 'abcd1234abcd1234abcd1234',
'platforms' => [
'android',
'ios'
],
'locale_ids' => [
'abcd1234cdef1234abcd1234cdef1234',
'fff565db236400772368235db2c6117e'
],
'format_options' => '{xml:{enclose_in_cdata:\'1\'}}',
'fallback_locales_enabled' => true,
'fallback_to_non_regional_locale' => true,
'fallback_to_default_locale' => true,
'use_last_reviewed_version' => 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/accounts/{account_id}/distributions/{id}"

payload := strings.NewReader("{\n \"name\": \"My Android Distribution\",\n \"project_id\": \"abcd1234abcd1234abcd1234\",\n \"platforms\": [\n \"android\",\n \"ios\"\n ],\n \"locale_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\",\n \"fff565db236400772368235db2c6117e\"\n ],\n \"format_options\": \"{xml:{enclose_in_cdata:'1'}}\",\n \"fallback_locales_enabled\": true,\n \"fallback_to_non_regional_locale\": true,\n \"fallback_to_default_locale\": true,\n \"use_last_reviewed_version\": true\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/accounts/{account_id}/distributions/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"My Android Distribution\",\n \"project_id\": \"abcd1234abcd1234abcd1234\",\n \"platforms\": [\n \"android\",\n \"ios\"\n ],\n \"locale_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\",\n \"fff565db236400772368235db2c6117e\"\n ],\n \"format_options\": \"{xml:{enclose_in_cdata:'1'}}\",\n \"fallback_locales_enabled\": true,\n \"fallback_to_non_regional_locale\": true,\n \"fallback_to_default_locale\": true,\n \"use_last_reviewed_version\": true\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.phrase.com/v2/accounts/{account_id}/distributions/{id}")

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 \"name\": \"My Android Distribution\",\n \"project_id\": \"abcd1234abcd1234abcd1234\",\n \"platforms\": [\n \"android\",\n \"ios\"\n ],\n \"locale_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\",\n \"fff565db236400772368235db2c6117e\"\n ],\n \"format_options\": \"{xml:{enclose_in_cdata:'1'}}\",\n \"fallback_locales_enabled\": true,\n \"fallback_to_non_regional_locale\": true,\n \"fallback_to_default_locale\": true,\n \"use_last_reviewed_version\": true\n}"

response = http.request(request)
puts response.read_body
{
  "id": "abcd1234cdef1234abcd1234cdef1234",
  "name": "Android Distribution",
  "project": {
    "id": "abcd1234cdef1234abcd1234cdef1234",
    "name": "My Android Project",
    "main_format": "xml",
    "created_at": "2015-01-28T09:52:53Z",
    "updated_at": "2015-01-28T09:52:53Z"
  },
  "platforms": [
    "android"
  ],
  "release_count": 10,
  "created_at": "2015-01-28T09:52:53Z",
  "updated_at": "2015-01-28T09:52:53Z",
  "locales": [
    {
      "id": "abcd1234cdef1234abcd1234cdef1234",
      "name": "English",
      "code": "en-GB"
    }
  ],
  "releases": [
    {
      "id": "abcd1234cdef1234abcd1234cdef1234",
      "version": 1,
      "project": {
        "id": "abcd1234cdef1234abcd1234cdef1234",
        "name": "My Android Project",
        "main_format": "xml",
        "created_at": "2015-01-28T09:52:53Z",
        "updated_at": "2015-01-28T09:52:53Z"
      },
      "platforms": [
        "android"
      ],
      "environments": [
        "development"
      ],
      "locale_codes": [
        "de",
        "en"
      ],
      "created_at": "2015-01-28T09:52:53Z",
      "updated_at": "2015-01-28T09:52:53Z"
    }
  ]
}
{
"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

account_id
string
required

Account ID

id
string
required

ID

Body

application/json
name
string

Name of the distribution

Example:

"My Android Distribution"

project_id
string

Project id the distribution should be assigned to.

Example:

"abcd1234abcd1234abcd1234"

platforms
string[]

List of platforms the distribution should support.

Example:
["android", "ios"]
locale_ids
string[]

List of locale ids that will be part of distribution releases

Example:
[
"abcd1234cdef1234abcd1234cdef1234",
"fff565db236400772368235db2c6117e"
]
format_options
object

Additional formatting and render options. Only enclose_in_cdata is available for platform android.

Example:

"{xml:{enclose_in_cdata:'1'}}"

fallback_locales_enabled
boolean

Use fallback locale if there is no translation in the current locale.

Example:

true

fallback_to_non_regional_locale
boolean

Indicates whether to fallback to non regional locale when locale can not be found

Example:

true

fallback_to_default_locale
boolean

Indicates whether to fallback to projects default locale when locale can not be found

Example:

true

use_last_reviewed_version
boolean

Use last reviewed instead of latest translation in a project

Example:

true

Response

OK

id
string
name
string
project
project_short · object
Example:
{
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "My Android Project",
"main_format": "xml",
"created_at": "2015-01-28T09:52:53Z",
"updated_at": "2015-01-28T09:52:53Z"
}
platforms
string[]
release_count
integer
created_at
string<date-time>
updated_at
string<date-time>
deleted_at
string<date-time> | null
locales
locale_preview · object[]
releases
release_preview · object[]