> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scrapegraphai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Getting started with just-scrape

> Install and configure the just-scrape CLI in minutes

`just-scrape` is the official command-line interface for ScrapeGraphAI. It gives you AI-powered web scraping, data extraction, search, and crawling directly from your terminal.

## Installation

<CodeGroup>
  ```bash npm theme={null}
  npm install -g just-scrape
  ```

  ```bash pnpm theme={null}
  pnpm add -g just-scrape
  ```

  ```bash yarn theme={null}
  yarn global add just-scrape
  ```

  ```bash bun theme={null}
  bun add -g just-scrape
  ```

  ```bash npx (no install) theme={null}
  npx just-scrape --help
  ```

  ```bash bunx (no install) theme={null}
  bunx just-scrape --help
  ```
</CodeGroup>

Package: [just-scrape](https://www.npmjs.com/package/just-scrape) on npm | [GitHub](https://github.com/ScrapeGraphAI/just-scrape)

## Setting up your API key

The CLI needs a ScrapeGraphAI API key. Get one from the [dashboard](https://scrapegraphai.com/dashboard). The CLI checks for it in this order:

1. **Environment variable** — `export SGAI_API_KEY="sgai-..."`
2. **`.env` file** — `SGAI_API_KEY=sgai-...` in the project root
3. **Config file** — `~/.scrapegraphai/config.json`
4. **Interactive prompt** — the CLI will ask and save it automatically

The easiest approach for a new machine is to just run any command — the CLI will prompt you for the key and save it to `~/.scrapegraphai/config.json` so you never need to set it again.

## Environment variables

| Variable       | Description                          | Default                                |
| -------------- | ------------------------------------ | -------------------------------------- |
| `SGAI_API_KEY` | ScrapeGraphAI API key                | —                                      |
| `SGAI_API_URL` | Override the API base URL            | `https://api.scrapegraphai.com/api/v2` |
| `SGAI_TIMEOUT` | Request timeout in seconds           | `120`                                  |
| `SGAI_DEBUG`   | Set to `1` to log requests/responses | —                                      |

Legacy variables are still bridged transparently: `JUST_SCRAPE_API_URL` → `SGAI_API_URL`, `JUST_SCRAPE_TIMEOUT_S` / `SGAI_TIMEOUT_S` → `SGAI_TIMEOUT`, `JUST_SCRAPE_DEBUG` → `SGAI_DEBUG`.

## Verify your setup

Check your credit balance to confirm the key is valid:

```bash theme={null}
just-scrape credits
```

## Your first scrape

```bash theme={null}
just-scrape extract https://news.ycombinator.com \
  -p "Extract the top 5 story titles and their URLs"
```

<Note>
  See the [full CLI reference](/services/cli) for all commands and options.
</Note>
