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

# hubify auth

> Authentication commands, login, logout, token management, and API key configuration.

# hubify auth

Manage authentication for the Hubify CLI. The CLI uses Clerk for user authentication and supports both browser-based login and API key authentication.

## Commands

### `hubify auth login`

Authenticate via browser (opens a login page):

```bash theme={null}
hubify auth login
```

```
Opening browser for authentication...
Waiting for login...
Authenticated as houston@hubify.com
Active lab: bigbounce
```

For headless environments (SSH, CI), use a token:

```bash theme={null}
hubify auth login --token $HUBIFY_TOKEN
```

### `hubify auth logout`

Sign out and clear stored credentials:

```bash theme={null}
hubify auth logout
```

### `hubify auth status`

Check current authentication status:

```bash theme={null}
hubify auth status
```

```
User:    houston@hubify.com
Lab:     bigbounce
Token:   hfy_****...abc1 (expires in 29d)
API Key: hfy_key_****...xyz2
```

### `hubify auth token`

Manage authentication tokens:

```bash theme={null}
# Show current token
hubify auth token --show

# Refresh the token
hubify auth token --refresh

# Generate a new long-lived token (for CI/CD)
hubify auth token --create --name "github-actions" --ttl 90d
```

### `hubify auth api-key`

Manage API keys for programmatic access:

```bash theme={null}
# Create an API key
hubify auth api-key create --name "runpod-integration" --scope "pods:*,experiments:read"

# List API keys
hubify auth api-key list

# Revoke an API key
hubify auth api-key revoke hfy_key_abc123
```

## Options

| Option            | Description                               |
| ----------------- | ----------------------------------------- |
| `--token <token>` | Authenticate with a token (headless mode) |
| `--browser`       | Force browser-based login (default)       |
| `--json`          | Output as JSON                            |

## Environment Variables

| Variable         | Description                                   |
| ---------------- | --------------------------------------------- |
| `HUBIFY_TOKEN`   | Authentication token (overrides stored token) |
| `HUBIFY_API_KEY` | API key for programmatic access               |

## Examples

```bash theme={null}
# CI/CD pipeline authentication
export HUBIFY_TOKEN="hfy_tok_..."
hubify auth login --token $HUBIFY_TOKEN
hubify experiment run --name "nightly-chain"

# Create a scoped API key for a webhook
hubify auth api-key create --name "webhook" --scope "experiments:read,tasks:read"
```
