Skip to main content
GET
/
projects
/
{project_id}
/
branches
/
{name}
/
compare
cURL
curl "https://api.phrase.com/v2/projects/:project_id/branches/:name/compare?name=my-branch" \
  -u USERNAME_OR_ACCESS_TOKEN
phrase branches compare \
--project_id <project_id> \
--name <name> \
--name my-branch \
--access_token <token>
import requests

url = "https://api.phrase.com/v2/projects/{project_id}/branches/{name}/compare"

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/projects/{project_id}/branches/{name}/compare', 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}/branches/{name}/compare",
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/projects/{project_id}/branches/{name}/compare"

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/projects/{project_id}/branches/{name}/compare")
.header("Authorization", "<api-key>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.phrase.com/v2/projects/{project_id}/branches/{name}/compare")

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
{
  "translation_keys": {
    "base_changes": [
      {
        "from": {
          "name": "welcome.title",
          "description": null,
          "name_plural": null,
          "is_plural": false,
          "data_type": "string",
          "max_characters_allowed": null,
          "deleted_at": null,
          "locations": [],
          "options": {}
        },
        "to": {
          "name": "welcome.heading",
          "description": null,
          "name_plural": null,
          "is_plural": false,
          "data_type": "string",
          "max_characters_allowed": null,
          "deleted_at": null,
          "locations": [],
          "options": {}
        }
      }
    ],
    "head_changes": [],
    "conflicts": {}
  },
  "translations": {
    "base_changes": [],
    "head_changes": [
      {
        "from": {
          "state": "unverified",
          "content": "Hello",
          "changed_in_main_locale": false,
          "excluded_from_export": false,
          "plural_suffix": null
        },
        "to": {
          "state": "translated",
          "content": "Hello World",
          "changed_in_main_locale": false,
          "excluded_from_export": false,
          "plural_suffix": null
        }
      }
    ],
    "conflicts": {}
  },
  "locales": {
    "base_changes": [],
    "head_changes": [],
    "conflicts": {}
  },
  "tags": {
    "base_changes": [],
    "head_changes": [],
    "conflicts": {}
  }
}

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

name
string
required

name

Query Parameters

name
string

Name of the branch

Response

OK

Comparison result of a branch against its base branch. Top-level properties correspond to resource types. Each resource type lists changes made in the base branch (base_changes), changes made in the feature branch (head_changes), and conflicting entries (conflicts).

translation_keys
branch_comparison_diff · object
translations
branch_comparison_diff · object
locales
branch_comparison_diff · object
tags
branch_comparison_diff · object