Skip to content

CLI reference

Configuration

A committed langctl.json describes how your repository syncs; environment variables and flags handle credentials and per-run settings.

langctl.json

langctl init creates this file. Commit it — then langctl pull and langctl push work with no arguments, on every machine and in CI.

langctl.json
{
"project": "web-app",
"format": "json",
"output": "src/locales/{lang}.json"
}
FieldDescription
projectProject slug (see langctl projects list).
formatjson (default), nested-json, android, ios or arb. See formats.
outputPath template for translation files, relative to langctl.json.
languagesLanguages to pull, e.g. ["en", "es"] (default: all project languages).
sourceLanguageLanguage push uploads by default (default: the project’s default language).
includeDraftsAlso pull unpublished keys (default false).
moduleOnly pull/push keys in this module.

Path template variables:

VariableExample for pt-BRTypical use
{lang}pt-BRlocales/{lang}.json, {lang}.lproj/Localizable.strings
{lang_}pt_BRFlutter: lib/l10n/app_{lang_}.arb
{android}values-pt-rBR (default language: values)res/{android}/strings.xml

langctl looks for langctl.json in the current directory and then its parents, so commands work from any subfolder. Command-line flags override the file. Unknown fields are reported as errors, so typos don’t fail silently.

Environment variables

VariablePurpose
LANGCTL_API_KEYAPI key — the standard way to authenticate in CI. Overrides the stored key.
LANGCTL_API_URLAPI base URL (default https://api.langctl.com/api/v1).
LANGCTL_TIMEOUTRequest timeout in seconds (default 30).
LANGCTL_CONFIG_DIRWhere the user config is stored (default ~/.langctl).
CIWhen set, langctl never prompts and shows no spinners. Set automatically by most CI providers.
NO_COLORDisable colored output.
NODE_EXTRA_CA_CERTSTrust a corporate proxy’s certificate authority.

Global flags

These work with every command, before or after it (langctl --json pull or langctl pull --json):

FlagDescription
--jsonMachine-readable JSON on stdout (errors too).
-q, --quietOnly print results and errors.
--verboseLog each HTTP request (method, path, status, time) to stderr.
-y, --yesSkip confirmation prompts. Required for destructive commands when not interactive.
--api-key <key>API key for this run (prefer LANGCTL_API_KEY).
--api-url <url>API base URL for this run.
--timeout <seconds>Request timeout for this run.
--no-colorDisable colors.

Output

Results go to stdout; progress, warnings and errors go to stderr. With --json, stdout contains only JSON, so it is safe to pipe:

terminal
langctl projects list --json | jq -r '.[].slug'
langctl push --dry-run --json | jq '.results[].created'

Failures with --json print an error object to stdout as well:

terminal
$ langctl pull missing-project --json
{
"error": {
  "message": "Project \"missing-project\" not found.",
  "exitCode": 4,
  "hint": "Available projects: web-app, mobile-app",
  "status": null
}
}

Exit codes

CodeMeaning
0Success
1Error — including a cancelled confirmation or pull --require-complete finding missing translations
2Invalid usage — unknown flag, language or format; destructive command refused without --yes
3Not authenticated, invalid or revoked key, or missing scope
4Project, key, member or file not found
5Network error, timeout, or the API is unavailable
6Plan limit reached
7pull --check: translation files are out of date

Reliability

  • Requests time out after 30 seconds (--timeout).
  • Safe-to-repeat requests (reads, imports, publishes) are retried up to 3 times with backoff on network errors, 429 and 5xx, honoring Retry-After.
  • Large uploads are split into chunks automatically.
  • Files are only rewritten when their translations change, and output is sorted without timestamps — a pull never creates a noisy diff.

Stored user config

~/.langctl/config.json holds the API key saved by langctl auth / init. It is written with owner-only permissions (600). langctl config prints the effective configuration and the source of each value:

terminal
$ langctl config
api url       https://api.langctl.com/api/v1
api key       lc_3f1a…9c2e  (LANGCTL_API_KEY)
user config   /home/ci/.langctl/config.json
project file  /work/app/langctl.json
project: "web-app"
format: "json"
output: "src/locales/{lang}.json"

Tip

langctl config makes no network calls — it’s a quick way to debug “which key and project is this pipeline using?”.