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

# EdgeFinder Authentication: Magic Link & API Key Setup

> Authenticate with EdgeFinder using a magic link email flow or by setting your API key manually via environment variable or config file.

EdgeFinder supports two ways to authenticate: a magic link flow that saves your API key automatically, and a manual method where you supply the key yourself. Both approaches store credentials in `~/.edgefinder/config.json` with permissions set to `0600`, so only your user account can read the file. This page covers both methods, how to check your account status, and how to clear your credentials.

## Method 1: Magic link (recommended)

The magic link flow handles everything for you — it sends an email, waits for you to click the link, and saves your API key automatically.

<Steps>
  <Step title="Run the login command">
    ```bash theme={null}
    edgefinder login
    ```
  </Step>

  <Step title="Enter your email">
    EdgeFinder prompts you for your email address. Enter the address associated with your EdgeFinder account.
  </Step>

  <Step title="Click the link in your inbox">
    Check your email and click the magic link. EdgeFinder polls in the background and saves your API key as soon as you authenticate.

    <Note>
      The login session expires after 10 minutes. If the link expires before you click it, run `edgefinder login` again.
    </Note>
  </Step>

  <Step title="Confirm your subscription">
    After authentication, EdgeFinder checks your subscription. If you don't have a paid plan yet, it offers to open the subscription page in your browser.

    CLI access requires an active Starter ($20/mo), Pro ($50/mo), or Ultimate (\$150/mo) subscription.
  </Step>
</Steps>

## Method 2: Manual API key

If you already have an API key — for example, when configuring the MCP server or a CI environment — you can provide it directly instead of going through the magic link flow.

Get your API key from [chat.edgefinder.io/settings/integrations](https://chat.edgefinder.io/settings/integrations).

<Tabs>
  <Tab title="Environment variable">
    Set `EDGEFINDER_API_KEY` in your shell. This takes precedence over the config file.

    ```bash theme={null}
    export EDGEFINDER_API_KEY=ef_live_...
    ```

    To make it permanent, add the line to your shell profile (e.g., `~/.bashrc`, `~/.zshrc`).
  </Tab>

  <Tab title="Config file">
    Save the key to `~/.edgefinder/config.json` using the `config set` command:

    ```bash theme={null}
    edgefinder config set api-key ef_live_...
    ```

    API keys must start with `ef_live_`. The CLI rejects keys with any other prefix.
  </Tab>

  <Tab title="MCP server">
    When running EdgeFinder as an MCP server, pass the key as an environment variable in your client config:

    ```json theme={null}
    {
      "mcpServers": {
        "edgefinder": {
          "command": "npx",
          "args": ["-y", "@edgefinder/cli", "mcp"],
          "env": {
            "EDGEFINDER_API_KEY": "ef_live_..."
          }
        }
      }
    }
    ```
  </Tab>
</Tabs>

## Check your account status

Run `edgefinder status` to see your current plan, subscription state, and whether you have active access:

```bash theme={null}
edgefinder status
```

Example output:

```
Plan:           pro
Status:         active
Access:         Yes (active subscription)
Unlimited:      No
```

Add `--json` to get machine-readable output:

```bash theme={null}
edgefinder status --json
```

## Verify your config

Use `edgefinder config show` to see what credentials are currently stored and where:

```bash theme={null}
edgefinder config show
```

```
API Key:     ef_live_abc123...
Base URL:    https://chat.edgefinder.io
Config file: /home/you/.edgefinder/config.json
```

The API key is always truncated in output for security.

## Log out

To remove your credentials from the config file:

```bash theme={null}
edgefinder logout
```

This deletes the API key from `~/.edgefinder/config.json`. If you set the key via the `EDGEFINDER_API_KEY` environment variable, unset it separately:

```bash theme={null}
unset EDGEFINDER_API_KEY
```

## Error reference

| Error              | Meaning                                | Fix                                                          |
| ------------------ | -------------------------------------- | ------------------------------------------------------------ |
| `401 Unauthorized` | Your API key is invalid or has expired | Run `edgefinder login` to get a new key                      |
| `403 Forbidden`    | Your plan limit has been reached       | Upgrade your subscription or wait for the next billing cycle |

<Warning>
  If you see a 403 error, your current plan's usage limit is exhausted. Visit [chat.edgefinder.io/subscription](https://chat.edgefinder.io/subscription) to upgrade.
</Warning>
