- Environment variables
- Command-line flags
- The application you selected when you signed in or ran
algolia application select - Profiles in
config.toml(deprecated)
Sign in with OAuth
Sign in with OAuth so the CLI manages your credentials for you. You don’t need to copy or manage API keys.algolia auth signup.
After you sign in, select an application.
If you don’t have an application, the CLI creates one.
The CLI sets this application as your current application.
To switch applications later, run algolia application select.
To select an application without an interactive prompt, use --app-name.
The CLI also prints the sign-in URL and waits until you complete the sign-in.
To print the URL and not open a browser, add --no-browser.
For example, use this flag when an agent runs the CLI.
Open the URL on the same machine, because the CLI waits for a redirect to localhost.
On machines without a browser, such as CI servers, provide credentials directly instead.
To sign in without prompts, such as in a script or an agent workflow, run algolia auth login --non-interactive.
The CLI prints JSON and doesn’t configure an application unless you pass --app-name.
For more information, see Use the CLI in automation.
The CLI stores your sign-in session and the application’s API key in your system keychain.
It stores your current application and its alias in state.toml, in the same folder as config.toml.
The API key has read and write ACLs, such as search, addObject, and editSettings.
To use a key with fewer permissions, see Provide credentials directly.
To check your sign-in and current application, run algolia auth status.
For the full list of authentication commands, see algolia auth.
Provide credentials directly
For CI pipelines, scripts, or if you prefer to manage credentials yourself, provide your application ID and API key instead of signing in. You can find both in the Algolia dashboard.Environment variables
Set these environment variables:ALGOLIA_APPLICATION_IDALGOLIA_API_KEY
Command-line flags
To provide credentials for one command, add these flags to the command:--application-id--api-key
These flags work on macOS, Linux, and Windows Subsystem for Linux (WSL).
The native Windows build of the Algolia CLI ignores them.
Crawler credentials
Crawler commands require separate Crawler API credentials. Configure them in one of the following ways.Get the Crawler API key after you sign in
If you’ve signed in with OAuth and selected an application, run:Crawler environment variables
Export your Crawler user ID and Crawler API key as environment variables:ALGOLIA_CRAWLER_USER_ID and ALGOLIA_CRAWLER_API_KEY.
You can find both in the Algolia dashboard:
- Go to the Algolia dashboard and select your Algolia application.
- On the left sidebar, select Data sources.
- Select Crawler and go to the Settings tab.
Crawler profiles
Like the--profile flag, manually managed crawler profiles are deprecated.
Configure the Crawler API key with algolia auth crawler instead.
To use a crawler profile, add crawler_user_id and crawler_api_key
to an application profile in config.toml:
Profiles
Profiles are the legacy way to store credentials. Each named profile stores an application ID and an API key inconfig.toml.
This file is in ~/.config/algolia.
If you set XDG_CONFIG_HOME, the file is in $XDG_CONFIG_HOME/algolia.
When you sign in with OAuth, the CLI doesn’t store credentials in this file.
The --profile flag is deprecated.
Sign in with algolia auth login and select an application with algolia application select instead.
To use a profile, add the --profile flag or its shorthand -p to a command,
for example: algolia indices list -p PROFILE_NAME.
For the deprecated profile commands, see algolia profile.