Skip to main content
Use the Algolia CLI in scripts, continuous integration (CI) pipelines, and agent workflows. The CLI supports non-interactive runs, structured output, exit codes, and dry runs. To learn more about interactive use, see Get started.

Essentials for agents

  • To get the schema of a command, run algolia describe COMMAND. This command doesn’t need credentials. The output includes the command type and the ACLs the command needs. See Command metadata.
  • For machine-readable output, add -o json if the command supports it.
  • To preview changes, use --dry-run if algolia describe COMMAND lists it in flags. See Dry runs. To skip prompts on destructive commands, use --confirm.
  • Check the exit code. On exit code 4, run algolia auth status.
  • To find docs pages, fetch algolia.com/doc/llms.txt.

Credentials in automation

For environment variables, profiles, command-line flags, precedence, and Crawler keys, see Authenticate CLI commands. Choose the credentials for your environment:
  • CI and other servers: Set ALGOLIA_APPLICATION_ID and ALGOLIA_API_KEY from the secret store of your platform. This keeps keys out of version control and configuration files.
  • Local machines, including agents that use the CLI often: Sign in once with algolia auth login. This keeps credentials out of shell history and version control.
  • Sign-in without prompts: To sign in from a script or an agent, run algolia auth login --non-interactive. Add --no-browser to print the sign-in URL instead of opening a browser. A person must open the URL on the same machine. See Sign in with OAuth.
  • One-off commands or temporary overrides: To use a different application or API key for one command, add --application-id and --api-key. See Command-line flags.

Non-interactive runs

The CLI prompts only when both standard input and standard output are terminals. If you redirect either one, such as in CI, pipes, or agent workflows, the CLI doesn’t prompt. Commands that delete or replace existing data require confirmation. To run these commands without prompts, pass --confirm or its shorthand -y. Otherwise, the command exits with the error --confirm required when non-interactive shell is detected.

Structured output and command metadata

  • JSON output: To keep standard output machine-readable, add -o json, -o jsonl, or -o ndjson if the command supports it. Errors are plain text on stderr, even with these flags. Use the exit code to detect failures.
  • Command schema: To help agents understand a command without parsing --help, run algolia describe COMMAND. This command prints JSON metadata for the command, including its flags, examples, command type, and required ACLs. See Command metadata.

Command metadata

algolia describe prints a JSON document with a schemaVersion and a command object. To describe the whole command tree, run algolia describe without arguments. To describe one command, add its path, such as algolia describe objects delete. Each command object includes these properties: Use commandType to decide whether a command changes data. read and stream commands don’t change data. For write commands, preview the change with --dry-run if the command supports it, and pass --confirm if it deletes or replaces data. The CLI derives commandType from the command name, so check the command description for commands of type other, such as algolia application upgrade. Use annotations.acls to check that your API key can run the command before you run it. Not every command has this annotation. For example, algolia describe objects delete returns "acls": "deleteObject".

Exit codes

The Algolia CLI returns these exit codes. Use them in scripts and CI to handle the result of each command. Exit code 4 means one of these problems:
  • The CLI didn’t find valid credentials.
  • The API key doesn’t have the ACLs that the command needs. The error message lists the missing ACLs.
  • The CLI couldn’t reach Algolia to check the ACLs of the key, such as during a network outage. Commands that need ACLs run this check before they start, including with --dry-run.
If the error message doesn’t list missing ACLs, run algolia auth status. This command shows which credentials the CLI uses: the session state, the current application, and a warning for each environment variable that overrides them.

Pipe data into the CLI

To import data from another command or script, add -F - to read from standard input. Depending on the command, the input is NDJSON or a single JSON object.

Debug logging

To print more error details to stderr, set DEBUG to a non-empty value, such as 1. The details are for errors from telemetry, the update notifier, and the configuration migration.

Dry runs

To validate changes and not apply them, add --dry-run. To get a structured preview, also add -o json. Not every command supports --dry-run. To check one command, run algolia describe COMMAND and look for dry-run in flags:
To list every command that supports it, filter the whole command tree:
To preview an update with structured output:
The output typically includes "dryRun": true and preview fields. The exact output depends on the command.

Environment variables reference

Last modified on November 23, 2026