In general, use an API key with minimal permissions, just enough to run the commands you want to run.
For more information, see API keys.
Environment variables
Set these environment variables:ALGOLIA_APPLICATION_IDALGOLIA_API_KEY
Command-line options
Provide these options when running commands:--application-id--api-key
Profiles
Store your application ID and API key under a friendly name. Instead of providing the command-line options with every command, you can refer to the profile with the--profile option.
For example: algolia index list -p PROFILE_NAME.
For more information, see algolia profile add.
Profiles are stored in plain-text in the file
~/.config/algolia/config.toml.
If you manage your configuration files (“dotfiles”) with GitHub,
don’t commit this file.--profile option when using the default profile.
To change the default profile, see algolia profile setdefault.
Manage applications
Usealgolia application (alias app) to list, create, and select applications in your Algolia account with the Dashboard API.
Before running these commands, authenticate with:
Set the active application
After authenticating, runalgolia application select to set the active application for the CLI. The command:
- Checks if a local profile exists for the application
- Creates a profile if needed
- Ensures the profile has an API key (creates one with the required permissions if needed)
- Sets this profile as the default for subsequent commands
--application-id or --api-key.
Use --app-name to select an application by name without an interactive prompt.
Crawler commands
Crawler commands require different credentials: a Crawler user ID, and a Crawler API key. You can find them 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.
Environment variables
Export your Algolia Crawler user ID and Crawler API key as environment variables:ALGOLIA_CRAWLER_USER_ID
and ALGOLIA_CRAWLER_API_KEY.
Profiles
Add the keyscrawler_user_id and crawler_api_key
to an application profile in ~/.config/algolia/config.toml.
An example profile for an Algolia application with Crawler
could look like the following: