Skip to main content
POST
/
accounts
/
{account_id}
/
repo_syncs
cURL
curl "https://api.phrase.com/v2/accounts/ab12cd34/repo_syncs" \
  -u USERNAME_OR_ACCESS_TOKEN \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
    "project_id": "abcd1234abcd1234abcd1234abcd1234",
    "git_provider": "github",
    "connection_type": "github_app",
    "repo_name": "my-org/my-repo",
    "base_branch": "main"
  }'
{
  "id": "abcd1234cdef1234abcd1234cdef1234",
  "project": {
    "id": "abcd1234cdef1234abcd1234cdef1234",
    "name": "My Android Project",
    "main_format": "xml",
    "created_at": "2015-01-28T09:52:53Z",
    "updated_at": "2015-01-28T09:52:53Z"
  },
  "provider": "github",
  "enabled": true,
  "auto_import": true,
  "repo_name": "organization/repo",
  "created_at": "2015-01-28T09:52:53Z",
  "last_import_at": "2015-01-28T09:52:53Z",
  "last_export_at": "2015-01-28T09:52:53Z"
}

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

Body

application/json
project_id
string
required

ID of the project to connect the Repo Sync to.

Example:

"abcd1234abcd1234abcd1234abcd1234"

connection_type
enum<string>
required

The authentication method used to connect to the Git provider. Defaults to token if not specified.

Valid values:

  • token — Personal access token stored on the Repo Sync. Supported by all providers.
  • github_app — Authenticate via the Phrase GitHub App installation on your account. GitHub only. The account must already have the GitHub App installed; if not, the response will include a github_app_installation_url.
  • self_hosted — Token-based auth for self-hosted Git instances. Requires custom_api_endpoint.
Available options:
token,
github_app,
self_hosted
Example:

"github_app"

repo_name
string
required

Full repository name including the owner, e.g. my-org/my-repo.

Example:

"my-org/my-repo"

git_provider
enum<string>
default:github

The Git provider to use.

Available options:
github,
gitlab,
bitbucket
Example:

"github"

base_branch
string

The default branch to use for imports and exports.

Example:

"main"

pr_branch
string

Branch that translations are exported to before opening a pull request. If omitted, exports go directly to base_branch.

Example:

"phrase-translations"

auto_import
boolean

Enable automatic import of translations triggered by pushes to the repository.

Example:

false

access_token
string

Personal access token for the Git provider. Required when connection_type is token or self_hosted. Not used for github_app.

Example:

"ghp_xxxxxxxxxxxxxxxxxxxx"

custom_api_endpoint
string

Custom API endpoint URL for self-hosted Git instances. Required when connection_type is self_hosted.

Example:

"https://git.example.com/api/v4"

Response

Created

id
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"
}
provider
string
enabled
boolean
auto_import
boolean
repo_name
string
created_at
string<date-time>
last_import_at
string<date-time>
last_export_at
string<date-time>