Makes the keys of a branch match the source strings you send, like ct push. A branch that does not exist is created. Translations of changed strings go back to draft.
HTTP
POST /projects/{projectId}/pushAccess: Session token, or an API key with the keys:write scope.
Role: Any role in the project for an API key. A session token needs the manager role.
Path parameters #
| Parameter | Description |
|---|---|
projectId | The id of the project. |
Request body #
JSON.
| Field | Type | Required | Description |
|---|---|---|---|
branch | string | yes | The branch name. Letters, digits, ., _, - and /, starting with a letter or digit. At most 60 characters. Use main for the protected branch. |
keys | object | yes | The source strings as { "key.name": "text" }. At most 20000 keys. A name has at most 190 characters without control characters; a text at most 5000 characters. |
base | string | no | The branch to create a new branch from. Default main. Ignored when the branch exists. |
prune | boolean | no | true deletes keys of the branch that are not in keys. Default false. |
dryRun | boolean | no | true saves nothing and reports what would happen. The branch must exist. Default false. |
translations | object | no | Translations to import as { "de-de": { "key.name": "text" } }. Needs the translations:write scope. Existing translations are only replaced when the project allows overwriting on import, and imported translations go to review unless the project says otherwise. |
JSON
{
"branch": "main",
"keys": { "checkout.title": "Checkout", "checkout.pay": "Pay now" },
"prune": false
}Response 200 #
What changed.
JSON
{
"branch": "main",
"added": 1,
"changed": 0,
"removed": 0,
"unchanged": 1,
"keysSkipped": 0,
"translationsImported": 0,
"translationsSkipped": { "unknownKey": 0, "unknownLanguage": 0, "empty": 0, "existing": 0 },
"dryRun": false
}Response fields #
| Field | Type | Description |
|---|---|---|
branch | string | The branch name. |
added | integer | New keys. |
changed | integer | Keys whose source text changed. |
removed | integer | Keys deleted because of prune. |
unchanged | integer | Keys that already matched. |
keysSkipped | integer | New keys that were left out because a session token was used and the project does not allow creating keys on import. |
translationsImported | integer | Translations saved from translations. |
translationsSkipped | object | Translations left out: unknownKey, unknownLanguage (not a language of the project or inactive), empty (empty or longer than 5000 characters) and existing (already translated and overwriting is off). |
dryRun | boolean | Whether this was a dry run. |
Errors #
| Status | error | When |
|---|---|---|
| 401 | unauthenticated | The token is missing or not valid. |
| 404 | not_found | The project does not exist in your organisation, you have no access to it, or projectId is not a UUID. |
| 403 | forbidden | You use a session token and are not a manager. |
| 403 | insufficient_scope | translations is sent and the key has no translations:write scope. |
| 409 | project_frozen | The project is frozen, see the freeze flag in Get project settings. |
| 409 | branch_frozen | The branch is frozen. |
| 402 | plan_limit | New keys on main would pass the key limit of the plan. |
| 404 | not_found | dryRun is true and the branch does not exist. |
| 422 | invalid_request | keys is not an object of texts, a name or text is not valid, branch is not a valid name, or base is not a branch (unknown). |
| 429 | rate_limited | Too many requests, see Rate limiting. |
See Errors for the error format.