curl "https://api.phrase.com/v2/formats" \
-u USERNAME_OR_ACCESS_TOKENphrase formats list \
--access_token <token>import requests
url = "https://api.phrase.com/v2/formats"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.phrase.com/v2/formats', 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/formats",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.phrase.com/v2/formats"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.phrase.com/v2/formats")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.phrase.com/v2/formats")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body[
{
"name": "Ruby/Rails YAML",
"api_name": "yml",
"description": "YAML file format for use with Ruby/Rails applications",
"extension": "yml",
"default_encoding": "UTF-8",
"importable": true,
"exportable": true,
"default_file": "./config/locales/<locale_name>.yml",
"renders_default_locale": false,
"includes_locale_information": false
},
{
"name": "Simple JSON",
"api_name": "simple_json",
"description": "A flat key/value JSON format",
"extension": "json",
"default_encoding": "UTF-8",
"importable": true,
"exportable": true,
"default_file": "./config/locales/<locale_name>.json",
"renders_default_locale": false,
"includes_locale_information": false
}
]List formats
Returns all file formats that Phrase Strings supports. Use the api_name value from each format as the file_format parameter when uploading or downloading locale files. Not every format supports both directions: check the importable and exportable fields before using a format in a workflow. This endpoint does not require authentication and is not subject to rate limiting.
curl "https://api.phrase.com/v2/formats" \
-u USERNAME_OR_ACCESS_TOKENphrase formats list \
--access_token <token>import requests
url = "https://api.phrase.com/v2/formats"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.phrase.com/v2/formats', 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/formats",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.phrase.com/v2/formats"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.phrase.com/v2/formats")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.phrase.com/v2/formats")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body[
{
"name": "Ruby/Rails YAML",
"api_name": "yml",
"description": "YAML file format for use with Ruby/Rails applications",
"extension": "yml",
"default_encoding": "UTF-8",
"importable": true,
"exportable": true,
"default_file": "./config/locales/<locale_name>.yml",
"renders_default_locale": false,
"includes_locale_information": false
},
{
"name": "Simple JSON",
"api_name": "simple_json",
"description": "A flat key/value JSON format",
"extension": "json",
"default_encoding": "UTF-8",
"importable": true,
"exportable": true,
"default_file": "./config/locales/<locale_name>.json",
"renders_default_locale": false,
"includes_locale_information": false
}
]Authorizations
Enter your token in the format token TOKEN
Response
OK
Human-readable display name of the format.
"Ruby/Rails YAML"
Identifier used to reference this format in API requests, such as the file_format parameter on the uploads and downloads endpoints.
"yml"
Human-readable summary of the format and its typical use case.
"YAML file format for use with Ruby/Rails applications"
Default file extension associated with this format.
"yml"
Default character encoding used when reading or writing files in this format.
"UTF-8"
Whether locale files can be imported using this format.
true
Whether locale files can be exported using this format.
true
Conventional file path pattern for this format. Contains locale_name as a placeholder for the locale identifier.
"./config/locales/<locale_name>.yml"
When true, exported files contain the default locale's content for any key that has no translation in the target locale.
false
When true, files in this format embed locale information so Phrase can detect the locale automatically on import.
false
Was this page helpful?