curl "https://api.phrase.com/v2/projects" \
-u USERNAME_OR_ACCESS_TOKEN \
-X POST \
-F name=My%20Android%20Project \
-F main_format=yml \
-F shares_translation_memory=truephrase projects create \
--data '{"name": "My Android Project", "main_format":"yml", "shares_translation_memory":true}' \
--access_token <token>import requests
url = "https://api.phrase.com/v2/projects"
payload = {
"name": "My Android Project",
"main_format": "yml",
"media": "Python",
"shares_translation_memory": True,
"tm_ids": ["abcd1234cdef1234abcd1234cdef1234"],
"term_base_ids": ["abcd1234cdef1234abcd1234cdef1234"],
"project_image": "/path/to/my/project-screenshot.png",
"remove_project_image": None,
"account_id": "abcd1234",
"point_of_contact": "abcd1234",
"source_project_id": "abcd1234",
"workflow": "review",
"machine_translation_enabled": True,
"enable_branching": True,
"protect_master_branch": True,
"enable_all_data_type_translation_keys_for_translators": True,
"enable_icu_message_format": True,
"zero_plural_form_enabled": True,
"autotranslate_enabled": True,
"autotranslate_check_new_translation_keys": True,
"autotranslate_check_new_uploads": True,
"autotranslate_check_new_locales": True,
"autotranslate_mark_as_unverified": True,
"autotranslate_use_machine_translation": True,
"autotranslate_use_translation_memory": True,
"autotranslate_overwrite_unverified_translations": True,
"fallback_for_unverified_translations": False,
"autocomplete_job_enabled": False,
"job_locking_enabled": False,
"smart_suggest_enabled": True,
"smart_suggest_use_glossary": True,
"smart_suggest_use_machine_translation": True,
"translation_keys_sort_collation": "unicode_ci",
"default_encoding": "UTF-8",
"cldr_version": "cldr48",
"placeholder_styles": ["rails_i18n", "java_properties"]
}
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: 'My Android Project',
main_format: 'yml',
media: 'Python',
shares_translation_memory: true,
tm_ids: ['abcd1234cdef1234abcd1234cdef1234'],
term_base_ids: ['abcd1234cdef1234abcd1234cdef1234'],
project_image: '/path/to/my/project-screenshot.png',
remove_project_image: null,
account_id: 'abcd1234',
point_of_contact: 'abcd1234',
source_project_id: 'abcd1234',
workflow: 'review',
machine_translation_enabled: true,
enable_branching: true,
protect_master_branch: true,
enable_all_data_type_translation_keys_for_translators: true,
enable_icu_message_format: true,
zero_plural_form_enabled: true,
autotranslate_enabled: true,
autotranslate_check_new_translation_keys: true,
autotranslate_check_new_uploads: true,
autotranslate_check_new_locales: true,
autotranslate_mark_as_unverified: true,
autotranslate_use_machine_translation: true,
autotranslate_use_translation_memory: true,
autotranslate_overwrite_unverified_translations: true,
fallback_for_unverified_translations: false,
autocomplete_job_enabled: false,
job_locking_enabled: false,
smart_suggest_enabled: true,
smart_suggest_use_glossary: true,
smart_suggest_use_machine_translation: true,
translation_keys_sort_collation: 'unicode_ci',
default_encoding: 'UTF-8',
cldr_version: 'cldr48',
placeholder_styles: ['rails_i18n', 'java_properties']
})
};
fetch('https://api.phrase.com/v2/projects', 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",
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' => 'My Android Project',
'main_format' => 'yml',
'media' => 'Python',
'shares_translation_memory' => true,
'tm_ids' => [
'abcd1234cdef1234abcd1234cdef1234'
],
'term_base_ids' => [
'abcd1234cdef1234abcd1234cdef1234'
],
'project_image' => '/path/to/my/project-screenshot.png',
'remove_project_image' => null,
'account_id' => 'abcd1234',
'point_of_contact' => 'abcd1234',
'source_project_id' => 'abcd1234',
'workflow' => 'review',
'machine_translation_enabled' => true,
'enable_branching' => true,
'protect_master_branch' => true,
'enable_all_data_type_translation_keys_for_translators' => true,
'enable_icu_message_format' => true,
'zero_plural_form_enabled' => true,
'autotranslate_enabled' => true,
'autotranslate_check_new_translation_keys' => true,
'autotranslate_check_new_uploads' => true,
'autotranslate_check_new_locales' => true,
'autotranslate_mark_as_unverified' => true,
'autotranslate_use_machine_translation' => true,
'autotranslate_use_translation_memory' => true,
'autotranslate_overwrite_unverified_translations' => true,
'fallback_for_unverified_translations' => false,
'autocomplete_job_enabled' => false,
'job_locking_enabled' => false,
'smart_suggest_enabled' => true,
'smart_suggest_use_glossary' => true,
'smart_suggest_use_machine_translation' => true,
'translation_keys_sort_collation' => 'unicode_ci',
'default_encoding' => 'UTF-8',
'cldr_version' => 'cldr48',
'placeholder_styles' => [
'rails_i18n',
'java_properties'
]
]),
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"
payload := strings.NewReader("{\n \"name\": \"My Android Project\",\n \"main_format\": \"yml\",\n \"media\": \"Python\",\n \"shares_translation_memory\": true,\n \"tm_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"term_base_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"project_image\": \"/path/to/my/project-screenshot.png\",\n \"remove_project_image\": null,\n \"account_id\": \"abcd1234\",\n \"point_of_contact\": \"abcd1234\",\n \"source_project_id\": \"abcd1234\",\n \"workflow\": \"review\",\n \"machine_translation_enabled\": true,\n \"enable_branching\": true,\n \"protect_master_branch\": true,\n \"enable_all_data_type_translation_keys_for_translators\": true,\n \"enable_icu_message_format\": true,\n \"zero_plural_form_enabled\": true,\n \"autotranslate_enabled\": true,\n \"autotranslate_check_new_translation_keys\": true,\n \"autotranslate_check_new_uploads\": true,\n \"autotranslate_check_new_locales\": true,\n \"autotranslate_mark_as_unverified\": true,\n \"autotranslate_use_machine_translation\": true,\n \"autotranslate_use_translation_memory\": true,\n \"autotranslate_overwrite_unverified_translations\": true,\n \"fallback_for_unverified_translations\": false,\n \"autocomplete_job_enabled\": false,\n \"job_locking_enabled\": false,\n \"smart_suggest_enabled\": true,\n \"smart_suggest_use_glossary\": true,\n \"smart_suggest_use_machine_translation\": true,\n \"translation_keys_sort_collation\": \"unicode_ci\",\n \"default_encoding\": \"UTF-8\",\n \"cldr_version\": \"cldr48\",\n \"placeholder_styles\": [\n \"rails_i18n\",\n \"java_properties\"\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")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"My Android Project\",\n \"main_format\": \"yml\",\n \"media\": \"Python\",\n \"shares_translation_memory\": true,\n \"tm_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"term_base_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"project_image\": \"/path/to/my/project-screenshot.png\",\n \"remove_project_image\": null,\n \"account_id\": \"abcd1234\",\n \"point_of_contact\": \"abcd1234\",\n \"source_project_id\": \"abcd1234\",\n \"workflow\": \"review\",\n \"machine_translation_enabled\": true,\n \"enable_branching\": true,\n \"protect_master_branch\": true,\n \"enable_all_data_type_translation_keys_for_translators\": true,\n \"enable_icu_message_format\": true,\n \"zero_plural_form_enabled\": true,\n \"autotranslate_enabled\": true,\n \"autotranslate_check_new_translation_keys\": true,\n \"autotranslate_check_new_uploads\": true,\n \"autotranslate_check_new_locales\": true,\n \"autotranslate_mark_as_unverified\": true,\n \"autotranslate_use_machine_translation\": true,\n \"autotranslate_use_translation_memory\": true,\n \"autotranslate_overwrite_unverified_translations\": true,\n \"fallback_for_unverified_translations\": false,\n \"autocomplete_job_enabled\": false,\n \"job_locking_enabled\": false,\n \"smart_suggest_enabled\": true,\n \"smart_suggest_use_glossary\": true,\n \"smart_suggest_use_machine_translation\": true,\n \"translation_keys_sort_collation\": \"unicode_ci\",\n \"default_encoding\": \"UTF-8\",\n \"cldr_version\": \"cldr48\",\n \"placeholder_styles\": [\n \"rails_i18n\",\n \"java_properties\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.phrase.com/v2/projects")
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\": \"My Android Project\",\n \"main_format\": \"yml\",\n \"media\": \"Python\",\n \"shares_translation_memory\": true,\n \"tm_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"term_base_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"project_image\": \"/path/to/my/project-screenshot.png\",\n \"remove_project_image\": null,\n \"account_id\": \"abcd1234\",\n \"point_of_contact\": \"abcd1234\",\n \"source_project_id\": \"abcd1234\",\n \"workflow\": \"review\",\n \"machine_translation_enabled\": true,\n \"enable_branching\": true,\n \"protect_master_branch\": true,\n \"enable_all_data_type_translation_keys_for_translators\": true,\n \"enable_icu_message_format\": true,\n \"zero_plural_form_enabled\": true,\n \"autotranslate_enabled\": true,\n \"autotranslate_check_new_translation_keys\": true,\n \"autotranslate_check_new_uploads\": true,\n \"autotranslate_check_new_locales\": true,\n \"autotranslate_mark_as_unverified\": true,\n \"autotranslate_use_machine_translation\": true,\n \"autotranslate_use_translation_memory\": true,\n \"autotranslate_overwrite_unverified_translations\": true,\n \"fallback_for_unverified_translations\": false,\n \"autocomplete_job_enabled\": false,\n \"job_locking_enabled\": false,\n \"smart_suggest_enabled\": true,\n \"smart_suggest_use_glossary\": true,\n \"smart_suggest_use_machine_translation\": true,\n \"translation_keys_sort_collation\": \"unicode_ci\",\n \"default_encoding\": \"UTF-8\",\n \"cldr_version\": \"cldr48\",\n \"placeholder_styles\": [\n \"rails_i18n\",\n \"java_properties\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "My Android Project",
"slug": "my-android-project",
"main_format": "xml",
"project_image_url": "http://assets.example.com/project.png",
"account": "account",
"space": "space",
"created_at": "2015-01-28T09:52:53Z",
"updated_at": "2015-01-28T09:52:53Z",
"shares_translation_memory": true,
"machine_translation_enabled": true,
"zero_plural_form_enabled": true,
"enable_all_data_type_translation_keys_for_translators": false,
"enable_icu_message_format": false,
"enable_branching": false,
"protect_master_branch": false,
"autotranslate_enabled": false,
"autotranslate_check_new_translation_keys": false,
"autotranslate_check_new_uploads": false,
"autotranslate_check_new_locales": false,
"autotranslate_mark_as_unverified": false,
"autotranslate_use_machine_translation": false,
"autotranslate_use_translation_memory": true,
"autotranslate_overwrite_unverified_translations": false,
"fallback_for_unverified_translations": false,
"autocomplete_job_enabled": false,
"default_encoding": "UTF-8",
"cldr_version": "legacy",
"translation_keys_sort_collation": "unicode_ci",
"job_locking_enabled": false,
"placeholder_styles": [
"rails_i18n",
"java_properties"
]
}{
"message": "Validation Failed",
"errors": [
{
"resource": "Resource",
"field": "name",
"message": "can't be blank"
}
]
}Create a project
Create a new project in the given account.
When source_project_id is supplied, the new project is created as a clone of that project. All locales, keys, and translations are copied asynchronously after the response is returned, so they may not be available immediately. Settings from the source project are inherited unless explicitly overridden in the request; in clone mode, the shares_translation_memory field is ignored and inherited from the source.
shares_translation_memory defaults to true when omitted on a non-clone create.
curl "https://api.phrase.com/v2/projects" \
-u USERNAME_OR_ACCESS_TOKEN \
-X POST \
-F name=My%20Android%20Project \
-F main_format=yml \
-F shares_translation_memory=truephrase projects create \
--data '{"name": "My Android Project", "main_format":"yml", "shares_translation_memory":true}' \
--access_token <token>import requests
url = "https://api.phrase.com/v2/projects"
payload = {
"name": "My Android Project",
"main_format": "yml",
"media": "Python",
"shares_translation_memory": True,
"tm_ids": ["abcd1234cdef1234abcd1234cdef1234"],
"term_base_ids": ["abcd1234cdef1234abcd1234cdef1234"],
"project_image": "/path/to/my/project-screenshot.png",
"remove_project_image": None,
"account_id": "abcd1234",
"point_of_contact": "abcd1234",
"source_project_id": "abcd1234",
"workflow": "review",
"machine_translation_enabled": True,
"enable_branching": True,
"protect_master_branch": True,
"enable_all_data_type_translation_keys_for_translators": True,
"enable_icu_message_format": True,
"zero_plural_form_enabled": True,
"autotranslate_enabled": True,
"autotranslate_check_new_translation_keys": True,
"autotranslate_check_new_uploads": True,
"autotranslate_check_new_locales": True,
"autotranslate_mark_as_unverified": True,
"autotranslate_use_machine_translation": True,
"autotranslate_use_translation_memory": True,
"autotranslate_overwrite_unverified_translations": True,
"fallback_for_unverified_translations": False,
"autocomplete_job_enabled": False,
"job_locking_enabled": False,
"smart_suggest_enabled": True,
"smart_suggest_use_glossary": True,
"smart_suggest_use_machine_translation": True,
"translation_keys_sort_collation": "unicode_ci",
"default_encoding": "UTF-8",
"cldr_version": "cldr48",
"placeholder_styles": ["rails_i18n", "java_properties"]
}
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: 'My Android Project',
main_format: 'yml',
media: 'Python',
shares_translation_memory: true,
tm_ids: ['abcd1234cdef1234abcd1234cdef1234'],
term_base_ids: ['abcd1234cdef1234abcd1234cdef1234'],
project_image: '/path/to/my/project-screenshot.png',
remove_project_image: null,
account_id: 'abcd1234',
point_of_contact: 'abcd1234',
source_project_id: 'abcd1234',
workflow: 'review',
machine_translation_enabled: true,
enable_branching: true,
protect_master_branch: true,
enable_all_data_type_translation_keys_for_translators: true,
enable_icu_message_format: true,
zero_plural_form_enabled: true,
autotranslate_enabled: true,
autotranslate_check_new_translation_keys: true,
autotranslate_check_new_uploads: true,
autotranslate_check_new_locales: true,
autotranslate_mark_as_unverified: true,
autotranslate_use_machine_translation: true,
autotranslate_use_translation_memory: true,
autotranslate_overwrite_unverified_translations: true,
fallback_for_unverified_translations: false,
autocomplete_job_enabled: false,
job_locking_enabled: false,
smart_suggest_enabled: true,
smart_suggest_use_glossary: true,
smart_suggest_use_machine_translation: true,
translation_keys_sort_collation: 'unicode_ci',
default_encoding: 'UTF-8',
cldr_version: 'cldr48',
placeholder_styles: ['rails_i18n', 'java_properties']
})
};
fetch('https://api.phrase.com/v2/projects', 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",
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' => 'My Android Project',
'main_format' => 'yml',
'media' => 'Python',
'shares_translation_memory' => true,
'tm_ids' => [
'abcd1234cdef1234abcd1234cdef1234'
],
'term_base_ids' => [
'abcd1234cdef1234abcd1234cdef1234'
],
'project_image' => '/path/to/my/project-screenshot.png',
'remove_project_image' => null,
'account_id' => 'abcd1234',
'point_of_contact' => 'abcd1234',
'source_project_id' => 'abcd1234',
'workflow' => 'review',
'machine_translation_enabled' => true,
'enable_branching' => true,
'protect_master_branch' => true,
'enable_all_data_type_translation_keys_for_translators' => true,
'enable_icu_message_format' => true,
'zero_plural_form_enabled' => true,
'autotranslate_enabled' => true,
'autotranslate_check_new_translation_keys' => true,
'autotranslate_check_new_uploads' => true,
'autotranslate_check_new_locales' => true,
'autotranslate_mark_as_unverified' => true,
'autotranslate_use_machine_translation' => true,
'autotranslate_use_translation_memory' => true,
'autotranslate_overwrite_unverified_translations' => true,
'fallback_for_unverified_translations' => false,
'autocomplete_job_enabled' => false,
'job_locking_enabled' => false,
'smart_suggest_enabled' => true,
'smart_suggest_use_glossary' => true,
'smart_suggest_use_machine_translation' => true,
'translation_keys_sort_collation' => 'unicode_ci',
'default_encoding' => 'UTF-8',
'cldr_version' => 'cldr48',
'placeholder_styles' => [
'rails_i18n',
'java_properties'
]
]),
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"
payload := strings.NewReader("{\n \"name\": \"My Android Project\",\n \"main_format\": \"yml\",\n \"media\": \"Python\",\n \"shares_translation_memory\": true,\n \"tm_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"term_base_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"project_image\": \"/path/to/my/project-screenshot.png\",\n \"remove_project_image\": null,\n \"account_id\": \"abcd1234\",\n \"point_of_contact\": \"abcd1234\",\n \"source_project_id\": \"abcd1234\",\n \"workflow\": \"review\",\n \"machine_translation_enabled\": true,\n \"enable_branching\": true,\n \"protect_master_branch\": true,\n \"enable_all_data_type_translation_keys_for_translators\": true,\n \"enable_icu_message_format\": true,\n \"zero_plural_form_enabled\": true,\n \"autotranslate_enabled\": true,\n \"autotranslate_check_new_translation_keys\": true,\n \"autotranslate_check_new_uploads\": true,\n \"autotranslate_check_new_locales\": true,\n \"autotranslate_mark_as_unverified\": true,\n \"autotranslate_use_machine_translation\": true,\n \"autotranslate_use_translation_memory\": true,\n \"autotranslate_overwrite_unverified_translations\": true,\n \"fallback_for_unverified_translations\": false,\n \"autocomplete_job_enabled\": false,\n \"job_locking_enabled\": false,\n \"smart_suggest_enabled\": true,\n \"smart_suggest_use_glossary\": true,\n \"smart_suggest_use_machine_translation\": true,\n \"translation_keys_sort_collation\": \"unicode_ci\",\n \"default_encoding\": \"UTF-8\",\n \"cldr_version\": \"cldr48\",\n \"placeholder_styles\": [\n \"rails_i18n\",\n \"java_properties\"\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")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"My Android Project\",\n \"main_format\": \"yml\",\n \"media\": \"Python\",\n \"shares_translation_memory\": true,\n \"tm_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"term_base_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"project_image\": \"/path/to/my/project-screenshot.png\",\n \"remove_project_image\": null,\n \"account_id\": \"abcd1234\",\n \"point_of_contact\": \"abcd1234\",\n \"source_project_id\": \"abcd1234\",\n \"workflow\": \"review\",\n \"machine_translation_enabled\": true,\n \"enable_branching\": true,\n \"protect_master_branch\": true,\n \"enable_all_data_type_translation_keys_for_translators\": true,\n \"enable_icu_message_format\": true,\n \"zero_plural_form_enabled\": true,\n \"autotranslate_enabled\": true,\n \"autotranslate_check_new_translation_keys\": true,\n \"autotranslate_check_new_uploads\": true,\n \"autotranslate_check_new_locales\": true,\n \"autotranslate_mark_as_unverified\": true,\n \"autotranslate_use_machine_translation\": true,\n \"autotranslate_use_translation_memory\": true,\n \"autotranslate_overwrite_unverified_translations\": true,\n \"fallback_for_unverified_translations\": false,\n \"autocomplete_job_enabled\": false,\n \"job_locking_enabled\": false,\n \"smart_suggest_enabled\": true,\n \"smart_suggest_use_glossary\": true,\n \"smart_suggest_use_machine_translation\": true,\n \"translation_keys_sort_collation\": \"unicode_ci\",\n \"default_encoding\": \"UTF-8\",\n \"cldr_version\": \"cldr48\",\n \"placeholder_styles\": [\n \"rails_i18n\",\n \"java_properties\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.phrase.com/v2/projects")
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\": \"My Android Project\",\n \"main_format\": \"yml\",\n \"media\": \"Python\",\n \"shares_translation_memory\": true,\n \"tm_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"term_base_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"project_image\": \"/path/to/my/project-screenshot.png\",\n \"remove_project_image\": null,\n \"account_id\": \"abcd1234\",\n \"point_of_contact\": \"abcd1234\",\n \"source_project_id\": \"abcd1234\",\n \"workflow\": \"review\",\n \"machine_translation_enabled\": true,\n \"enable_branching\": true,\n \"protect_master_branch\": true,\n \"enable_all_data_type_translation_keys_for_translators\": true,\n \"enable_icu_message_format\": true,\n \"zero_plural_form_enabled\": true,\n \"autotranslate_enabled\": true,\n \"autotranslate_check_new_translation_keys\": true,\n \"autotranslate_check_new_uploads\": true,\n \"autotranslate_check_new_locales\": true,\n \"autotranslate_mark_as_unverified\": true,\n \"autotranslate_use_machine_translation\": true,\n \"autotranslate_use_translation_memory\": true,\n \"autotranslate_overwrite_unverified_translations\": true,\n \"fallback_for_unverified_translations\": false,\n \"autocomplete_job_enabled\": false,\n \"job_locking_enabled\": false,\n \"smart_suggest_enabled\": true,\n \"smart_suggest_use_glossary\": true,\n \"smart_suggest_use_machine_translation\": true,\n \"translation_keys_sort_collation\": \"unicode_ci\",\n \"default_encoding\": \"UTF-8\",\n \"cldr_version\": \"cldr48\",\n \"placeholder_styles\": [\n \"rails_i18n\",\n \"java_properties\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "My Android Project",
"slug": "my-android-project",
"main_format": "xml",
"project_image_url": "http://assets.example.com/project.png",
"account": "account",
"space": "space",
"created_at": "2015-01-28T09:52:53Z",
"updated_at": "2015-01-28T09:52:53Z",
"shares_translation_memory": true,
"machine_translation_enabled": true,
"zero_plural_form_enabled": true,
"enable_all_data_type_translation_keys_for_translators": false,
"enable_icu_message_format": false,
"enable_branching": false,
"protect_master_branch": false,
"autotranslate_enabled": false,
"autotranslate_check_new_translation_keys": false,
"autotranslate_check_new_uploads": false,
"autotranslate_check_new_locales": false,
"autotranslate_mark_as_unverified": false,
"autotranslate_use_machine_translation": false,
"autotranslate_use_translation_memory": true,
"autotranslate_overwrite_unverified_translations": false,
"fallback_for_unverified_translations": false,
"autocomplete_job_enabled": false,
"default_encoding": "UTF-8",
"cldr_version": "legacy",
"translation_keys_sort_collation": "unicode_ci",
"job_locking_enabled": false,
"placeholder_styles": [
"rails_i18n",
"java_properties"
]
}{
"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)
Body
Name of the project
"My Android Project"
Main file format specified by its API Extension name. Used for locale downloads if no format is specified. For API Extension names of available file formats see Format Guide or our Formats API Endpoint.
"yml"
(Optional) Main technology stack used in the project. It affects for example the suggested placeholder style. Predefined values include: Ruby, JavaScript, AngularJS, React, iOS, Android, Python, PHP, Java, Go, Windows Phone, Rails, Node.js, .NET, Django, Symfony, Yii Framework, Zend Framework, Apple App Store Description, Google Play Description, but it can also take any other value.
"Python"
Indicates whether the project should share the account's translation memory
true
List of TMS translation memory IDs, used to provide reference translations for the AI translation agent.
["abcd1234cdef1234abcd1234cdef1234"]
List of TMS term base IDs, used to ensure consistent terminology for the AI translation agent.
["abcd1234cdef1234abcd1234cdef1234"]
Image to identify the project
Indicates whether the project image should be deleted.
null
Account ID to specify the actual account the project should be created in. Required if the requesting user is a member of multiple accounts.
"abcd1234"
(Optional) User ID of the point of contact for the project.
"abcd1234"
When a source project ID is given, a clone of that project will be created, including all locales, keys and translations as well as the main project settings if they are not defined otherwise through the params.
"abcd1234"
(Optional) Enable machine translation support in the project. Required for Pre-Translation
true
(Optional) Enable branching in the project
true
(Optional) Protect the master branch in project where branching is enabled
true
(Optional) Otherwise, translators are not allowed to edit translations other than strings
true
(Optional) Displays the input fields for the 'ZERO' plural form for every key as well although only some languages require the 'ZERO' explicitly.
true
(Optional) Requires autotranslate_enabled to be true
true
(Optional) Requires autotranslate_enabled to be true
true
(Optional) Requires autotranslate_enabled to be true
true
(Optional) Requires autotranslate_enabled to be true
true
(Optional) Requires autotranslate_enabled to be true
true
(Optional) Requires autotranslate_enabled to be true
true
(Optional) Requires autotranslate_enabled to be true
true
(Optional) When enabled, the fallback locale's translation is used on export for unverified translations in addition to empty ones. Requires a fallback locale to be configured on the locale.
false
(Optional) Enable autocomplete-job behavior so that newly created keys and locales are automatically added to in-progress jobs.
false
(Optional) When enabled, translations are locked once a job moves into review.
false
(Optional) Enable Smart Suggest for the project. Defaults to true when omitted.
true
(Optional) Allow Smart Suggest to source suggestions from the project glossary. Defaults to true when omitted.
true
(Optional) Allow Smart Suggest to source suggestions from machine translation. Defaults to true when omitted.
true
(Optional) Collation used when sorting translation keys alphabetically. Defaults to unicode_ci when omitted.
general_ci, unicode_ci "unicode_ci"
(Optional) Sets the default encoding for Uploads. If you leave it empty, we will try to guess it automatically for you when you Upload a file. You can still override this value by setting the file_encoding parameter for Uploads.
UTF-8, UTF-16, UTF-16BE, UTF-16LE, ISO-8859-1 "UTF-8"
(Optional) CLDR plural-rule version used by the project. Pass legacy for pre-CLDR pluralization behaviour, or a CLDR version string such as cldr48. Also used as the default version for the ICU skeleton endpoint (POST /icu/skeleton) when its own cldr_version parameter is omitted.
"cldr48"
(Optional) List of placeholder styles enabled for the project.
Placeholder style supported for detecting and highlighting variable placeholders in translation keys. This list may grow over time as new styles are added.
["rails_i18n", "java_properties"]
Response
Created
Show child attributes
Show child attributes
{
"id": "abcd1234",
"name": "Company Account",
"slug": "company_account",
"company": "My Awesome Company",
"created_at": "2015-01-28T09:52:53Z",
"updated_at": "2015-01-28T09:52:53Z",
"company_logo_url": "http://assets.example.com/company_logo.png"
}
Show child attributes
Show child attributes
{
"id": "2e7574e8f2372906a03110c2a7cfe671",
"name": "My first space",
"created_at": "2020-02-25T12:17:25Z",
"updated_at": "2020-03-13T14:46:57Z",
"projects_count": 2
}
Show child attributes
Show child attributes
{
"id": "abcd1234cdef1234abcd1234cdef1234",
"username": "johndoe",
"name": "John Doe",
"gravatar_uid": "205e460b479e2e5b48aec07710c08d50"
}
true
true
false
false
false
false
false
false
false
false
false
false
true
false
false
false
"UTF-8"
"legacy"
general_ci, unicode_ci "unicode_ci"
false
Placeholder style supported for detecting and highlighting variable placeholders in translation keys. This list may grow over time as new styles are added.
["rails_i18n", "java_properties"]
Show child attributes
Show child attributes
{
"name": "new-branch",
"created_at": "2015-01-28T09:52:53Z",
"updated_at": "2015-01-28T09:52:53Z",
"merged_at": "2015-01-28T09:52:53Z",
"merged_by": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"username": "joe.doe",
"name": "Joe Doe"
},
"created_by": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"username": "joe.doe",
"name": "Joe Doe"
},
"state": "success",
"child_branches": ["feature_2", "feature_3"]
}
Was this page helpful?