Skip to main content

Configuration

Crowdin CLI uses a YAML configuration file that contains a description of the resources to manage: files to be uploaded into Crowdin and the locations of the corresponding translations.

To use Crowdin CLI, you should first generate your configuration file and then run the tool. By default, Crowdin CLI looks for a configuration file named crowdin.yaml or crowdin.yml (so you don’t have to specify the file name unless it’s different from crowdin.yaml).

To create the configuration file run the following command:

crowdin init

When calling Crowdin CLI in terminal make sure you are in your project root directory. Otherwise, you need to specify a configuration file path using --config option:

crowdin upload sources --config /path/to/your/config/file

Sample configuration file​

crowdin.yml
"project_id": "12"
"api_token": "54e01--your-personal-token--2724a"
"base_path": "."
"base_url": "https://api.crowdin.com"

"preserve_hierarchy": true

"files": [
{
"source" : "/locales/**/*",
"translation" : "/%two_letters_code%/%original_file_name%"
}
]

Credentials configuration:

NameDescription
project_idCrowdin Project ID
api_tokenCrowdin personal access token. The token owner should have at least Manager permissions in the project
base_urlCrowdin API base URL. Can be omitted for crowdin.com. For Crowdin Enterprise use the https://{organization-name}.api.crowdin.com
info

For more information how to configure Crowdin CLI, check the Configuration File article.

Environment Variables​

Crowdin CLI supports the use of environment variables for configuration. For example, you can load the API credentials from an environment variable:

crowdin.yml
"project_id_env": "CROWDIN_PROJECT_ID"
"api_token_env": "CROWDIN_PERSONAL_TOKEN"
"base_path_env": "CROWDIN_BASE_PATH"
"base_url_env": "CROWDIN_BASE_URL"

Environment variables have lower priority and will be used if any of the parameters are missing:

crowdin.yml
"project_id_env": "CROWDIN_PROJECT_ID"      # Low priority
"api_token_env": "CROWDIN_PERSONAL_TOKEN" # Low priority
"base_path_env": "CROWDIN_BASE_PATH" # Low priority
"base_url_env": "CROWDIN_BASE_PATH" # Low priority

"project_id": "project-id" # High priority
"api_token": "personal-access-token" # High priority
"base_path": "/project-base-path" # High priority
"base_url": "https://api.crowdin.com" # High priority

The CLI will also automatically pick up the environment variables if they are set in the shell. The supported environment variables are:

Variable NameDescription
CROWDIN_PERSONAL_TOKENPersonal Access Token required for authentication
CROWDIN_PROJECT_IDNumerical ID of the Crowdin project
CROWDIN_BASE_URLBase URL of Crowdin server for API requests execution (https://api.crowdin.com for crowdin.com, https://{organization-name}.api.crowdin.com for Crowdin Enterprise)
CROWDIN_BASE_PATHPath to your project directory on a local machine (default: .)

Further Reading​