---
title: "Create a Repo Sync"
method: POST
path: "/accounts/{account_id}/repo_syncs"
tags: ["Repo Syncs"]
---

# Create a Repo Sync

`POST /accounts/{account_id}/repo_syncs`

Create a new Repo Sync.

## Path parameters

- `account_id` string, required

## Headers

- `X-PhraseApp-OTP` string

## Request body

- object
  - `project_id` string, required — ID of the project to connect the Repo Sync to.
  - `name` string, nullable — Optional custom display name for this repo sync. Defaults to null; when null the project name is used as the display name.
  - `git_provider` 'github' | 'gitlab' | 'bitbucket' — The Git provider to use.
  - `connection_type` 'token' | 'github_app' | 'self_hosted', 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`.
  - `repo_name` string, required — Full repository name including the owner, e.g. `my-org/my-repo`.
  - `base_branch` string — The default branch to use for imports and exports.
  - `pr_branch` string — Branch that translations are exported to before opening a pull request. If omitted, exports go directly to `base_branch`.
  - `auto_import` boolean — Enable automatic import of translations triggered by pushes to the repository.
  - `access_token` string — Personal access token for the Git provider. Required when `connection_type` is `token` or `self_hosted`. Not used for `github_app`.
  - `custom_api_endpoint` string — Custom API endpoint URL for self-hosted Git instances. Required when `connection_type` is `self_hosted`.

## Response `201`

Created

- RepoSync
  - `id` string
  - `name` string, nullable — Optional custom display name for this repo sync. When null or blank, the sync is displayed using the associated project name.
  - `project` ProjectShort
    - `id` string
    - `name` string
    - `main_format` string
    - `created_at` string, date-time
    - `updated_at` string, date-time
  - `provider` string
  - `enabled` boolean
  - `auto_import` boolean
  - `repo_name` string
  - `pr_branch` string, nullable — Branch used as the source of exports/PRs. May be `null` when the sync is configured to push directly to `base_branch`.
  - `created_at` string, date-time
  - `last_import_at` string, date-time, nullable
  - `last_export_at` string, date-time, nullable

## Other responses

- `400` — Bad request. The request could not be parsed or a parameter failed validation. Verify the request body, the content type, and the parameter types, then retry.
- `401` — Unauthorized. Authentication failed because the access token is missing, expired, or invalid. Supply a valid access token and retry.
- `403` — Forbidden. The credentials are valid but not permitted for this request: the access token may lack the required scope, the user may lack permission on the resource, or the account plan may not include the feature. Use a token with the required scope on an account and user that hold the necessary permissions.
- `404` — Not found. The requested resource does not exist or is not visible to the authenticated user. Verify the identifiers in the request path and that the token has access to them, then retry.
- `422` — Unprocessable entity. The request was well-formed but failed validation. The response body lists each offending field in the `errors` array, with its resource, field, and a human-readable message. Correct the listed fields and retry.
- `429` — Too many requests. The rate limit has been exceeded. Wait until the time indicated by the `X-Rate-Limit-Reset` response header before retrying.

---

[API](https://skmtc.net/phrase/apis/control-hub-service.md) · [All operations](https://skmtc.net/phrase/apis/control-hub-service/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/phrase/control-hub-service/revisions/98ecac7ba2bf/schema)
