Knowledge Base

Documentation to help you use the POEditor localization platform effectively

CLI login and API tokens

Owner Admin

The POEditor CLI works with POEditor API tokens. There is no browser login: you give the CLI a token once, and it uses it for every command. This article explains where the token is kept, how to use more than one POEditor account, and how to remove a token.

How to log in

Go to your account's API access page and copy your API token (or generate one). Then run:

poeditor auth login

Paste the token when asked. It is not shown as you type. Before saving anything, the CLI checks the token with POEditor and tells you how many projects it can see. If POEditor doesn't accept the token, nothing is saved.

Where the token is kept

The token is saved in your system's keyring:

  • macOS Keychain on macOS;
  • Windows Credential Manager on Windows;
  • libsecret (for example GNOME Keyring) on Linux. On a computer with no keyring, such as a server without a desktop, the token goes into the CLI's user config file instead, readable only by you. The config file is in ~/.config/poeditor (or %AppData%\POEditor on Windows).

The token never goes into .poeditor.yml, the file you commit with your code.

How to log in from a script

To pass the token on standard input instead of typing it, add --with-token:

echo "$TOKEN" | poeditor auth login --with-token

In a CI pipeline you don't need to log in at all. See How to sync translations in CI with the POEditor CLI.

How to work with several POEditor accounts

If your projects are in more than one POEditor account, for example your own and a client's, log in to each one and give it a short name:

poeditor auth login                       # the first account is called "default"
poeditor auth login --account client-a    # every other account needs a name

Names use lower-case letters, digits, - and _.

Once you have one account, poeditor auth login without --account is refused, so you never replace a token by accident. To replace an account's token, log in again with its name, for example poeditor auth login --account client-a.

How to choose which account a command uses

One account is the default. Every command uses it unless you say otherwise. There are three ways to pick another one:

  • add --account <name> to any command, for that run only:

    poeditor api projects list --account client-a
  • in .poeditor.yml, add account: <name> to a project, so pull, push and every command that uses the project's alias use that account:

    projects:
    - id: 67890
    alias: client-site
    account: client-a
    ...
  • change the default account:
    poeditor auth default client-a

The CLI never guesses. If a project names an account you aren't logged in to, the command stops and tells you which poeditor auth login --account … to run.

How to see your accounts

$ poeditor auth list
ACCOUNT   DEFAULT  TOKEN
client-a           keyring
personal  yes      keyring

The TOKEN column says where each token comes from: keyring, config file, environment (an environment variable, see below), or missing.

How to log out

To remove an account and its saved token, run:

poeditor auth logout --account client-a

If you have only one account, --account isn't needed. If you remove the default account, the first remaining account in alphabetical order becomes the default.

Logging out only removes the token from your computer. To stop the token from working altogether, revoke or regenerate it on your account's API access page.

Tokens in environment variables

Instead of logging in, you can put a token in an environment variable. This is how CI pipelines work, and it also works on your own computer:

Variable Token for
POEDITOR_TOKEN the default account, or the only one
POEDITOR_TOKEN_<ACCOUNT> the named account, upper-cased, with - written as _. For client-a, use POEDITOR_TOKEN_CLIENT_A.

An environment variable wins over the keyring and the config file.

Things to know

The CLI can do what the token can do. A token gives access to the projects of its account, with that account's permissions. A read-only token is enough to pull and to run poeditor config check. To push or change anything in POEditor, use a token with full access.

Treat the token like a password. Don't commit it, paste it in chat, or put it in .poeditor.yml. In CI, keep it in your CI's secret store.

Additional help