Quickstart
Prerequisites
- Authentication set up. See the Authentication guide. The token needs the write scope to create a repo sync.
- A project ID, the project code taken from the project in Phrase.
- Your account ID. Repo sync calls are scoped to it.
- A
.phrase.ymlfile in the repository. It maps files to languages; runphrase initto scaffold one. - Git provider access: a personal access token for GitHub, GitLab, or Bitbucket, or the Phrase GitHub App installed.
How-to
A repo sync is the connection between one Phrase project and one git repository. With auto-import on, a push to the base branch triggers Phrase to read the changed files and import their keys. The sync is created once; after that the import runs on its own.-
Create the repo sync with auto-import on. Create the sync against your account, pointing it at the project and repository. The
project_id,repo_name, andconnection_typefields are required. Setauto_importtotrueso pushes trigger an import. Useconnection_typetoken with anaccess_tokenfield for a personal access token, orgithub_appif the Phrase GitHub App is installed. If creation returns 403, the account lacks the repo sync feature, the token lacks the write scope, or you lack permission to manage syncs. A 422 means a field failed validation, often arepo_namenot inowner/repoform; theerrorsarray names it, so correct it and retry. - Register the webhook on the repository. Auto-import needs a push webhook on the git side so the provider tells Phrase about each push. Add the webhook Phrase generates for the sync to the repository settings, and make sure the shared secret matches. This step happens in the git provider, not the API. If pushes never trigger an import, the most common cause is a webhook secret that does not match the one Phrase stored, so re-copy it. A push to a branch other than the base branch is ignored on purpose.
-
Confirm the import ran. Each push creates an import event on the sync. Read the event history to confirm the import ran and check its outcome. Each event has a type of import or export, a status of running, success, or failure, and an
auto_importflag showing whether a push triggered it. On a failure, theerrorsarray explains why, so you can fix the file or config and push again. -
When a CI upload fits better. To push keys from your pipeline instead of a git webhook, upload the file directly. Use the file upload endpoint, which imports a whole file in one request, rather than a loop that creates one key at a time. Repo sync and direct upload are two paths to the same result, so pick one.
When it breaks: common errors
A 4xx response tells you what to fix. For a 422, theerrors array names the exact field.
403: forbidden
The account lacks the repo sync feature, the token lacks the write scope, or you lack permission to manage syncs. Enable the feature or use a write-scoped token.
422: invalid field
A field failed validation, often a
repo_name that is not in owner/repo form. The errors array names it, so fix it and retry.404: not found
The account or repo sync ID does not resolve. Check each ID in the path and that the token can access it.
No import on push
A push did not import, usually because the webhook secret does not match Phrase’s, or you pushed to a branch other than the base branch. Re-copy the secret; push to the base branch.
429: rate limited
A
429 means too many requests in a short time: wait for the window to reset, then retry. Webhooks are exempt.Troubleshooting
Status
Check the Phrase status page before assuming your own request is wrong.
Where to get help
If Phrase is healthy and the
errors array does not explain the failure, contact support.Help center
Support articles and answers to common Phrase questions.
Next steps
- Review the reference pages this guide calls: Create a repo sync, Repository syncs history, and Upload a new file.
- To wire the full loop from push to live translations, see Build your CI/CD pipeline.