semrush cli

Get started

Install the CLI, pair your Semrush web account, and run your first query.

semrush-cli connects your terminal and AI agents to your Semrush web account for keyword research, rank tracking, site audits, and project management.

Prerequisites

  • Node.js 22 or newer
  • An active Semrush web account

Interactive browser sign-in requires a graphical desktop. Headless servers can import an existing browser session instead (see authentication).

The package includes precompiled Galleton daemon binaries for Linux (x64, arm64), macOS (Apple silicon, Intel), and Windows (x64). No Go compiler or Python installation is required.

Quickstart

1. Install the CLI

Install the executable globally using npm:

npm install -g semrush-cli

2. Initialize dependencies

Download the headless browser and start the background session daemon:

semrush setup

3. Sign in to Semrush

Launch interactive sign-in:

semrush auth login

Complete sign-in in the browser window that opens. The CLI stores your session cookies in an encrypted local vault and closes the browser. The terminal never handles your password.

4. Verify your environment

Check that the local daemon, browser, and session are operational:

semrush doctor

5. Run your first queries

Query keyword metrics or inspect domain rankings:

semrush keyword-overview --keyword typescript --json
semrush domain-keywords --domain example.com --json

Output format

Commands return a JSON object containing authenticated: true, the snake_case report name, and a data field holding the result object or array. Pass --json to output compact, single-line JSON. Failures write diagnostics to standard error. Service and authentication failures exit with code 1; invalid arguments exit with code 2. See scripting for all exit codes.

Next steps

On this page