Skip to main content
GET
/
formats
cURL
curl "https://api.phrase.com/v2/formats" \
  -u USERNAME_OR_ACCESS_TOKEN
phrase 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

Authorization
string
header
required

Enter your token in the format token TOKEN

Response

OK

name
string
required

Human-readable display name of the format.

Example:

"Ruby/Rails YAML"

api_name
string
required

Identifier used to reference this format in API requests, such as the file_format parameter on the uploads and downloads endpoints.

Example:

"yml"

description
string
required

Human-readable summary of the format and its typical use case.

Example:

"YAML file format for use with Ruby/Rails applications"

extension
string
required

Default file extension associated with this format.

Example:

"yml"

default_encoding
string
required

Default character encoding used when reading or writing files in this format.

Example:

"UTF-8"

importable
boolean
required

Whether locale files can be imported using this format.

Example:

true

exportable
boolean
required

Whether locale files can be exported using this format.

Example:

true

default_file
string
required

Conventional file path pattern for this format. Contains locale_name as a placeholder for the locale identifier.

Example:

"./config/locales/<locale_name>.yml"

renders_default_locale
boolean
required

When true, exported files contain the default locale's content for any key that has no translation in the target locale.

Example:

false

includes_locale_information
boolean
required

When true, files in this format embed locale information so Phrase can detect the locale automatically on import.

Example:

false