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

# Authentication

> Authenticate API requests with a personal API key.

Create a personal API key from your MapX account by opening
`https://app.mapxagent.com?open=api-keys` (or app → Profile/Account → API Keys).
The raw key (for example `mkx_...`) is shown only once, so save it immediately.

The backend stores only a SHA-256 hash of the key. If a key is leaked, revoke it
from your account and create a new one.

## API requests

Send the key as a bearer token:

```bash theme={null}
curl https://api.mapxagent.com/api/sessions \
  -H "Authorization: Bearer mkx_..."
```

## CLI requests

Save the key locally once, then let the CLI reuse it:

```bash theme={null}
mapx auth login <mkx_...>
mapx auth status
```

`mapx auth login` stores the key in `~/.mapx/config.json` (0600 permissions);
`mapx auth logout` removes it. Environment variables remain supported as a
fallback:

```bash theme={null}
export MAPX_API_URL="https://api.mapxagent.com"
export MAPX_API_KEY="mkx_..."
mapx auth status
```

Every command also accepts `--api-key` and `--url` overrides. All operations are
scoped to the account that owns the key, and project ownership is enforced by
the backend.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.