# Getting Started

This guide covers quick-start instructions for each type of MorganaBench user.

## UI

1. Navigate to the MorganaBench application in your browser.
2. Log in with your credentials.
3. Use the **Sandbox** to test benchmark generation against a small sample — documents or tool definitions — before working with your own corpora. To see the full workflow on ready-made data, open the [example resources](ui-guide/example-resources.md).

From the UI you can manage corpora, edit specifications, generate benchmarks, evaluate your agent, and view evaluation results.

## REST API

### Authentication

All API requests require a Bearer token. Obtain one by logging in:

<!--email_off-->
```txt
POST /api/v1/auth/login
Content-Type: application/json

{
  "email": "you@example.com",
  "password": "your-password"
}
```
<!--email_on-->

The response contains your tokens:

```json
{
  "access_token": "eyJhbG...",
  "refresh_token": "eyJhbG...",
  "token_type": "bearer",
  "expires_in": 3600
}
```

The `expires_in` value is in seconds. Use the `access_token` as a Bearer token in subsequent requests.

### curl Example

<!--email_off-->
```bash
# Log in
TOKEN=$(curl -s -X POST /api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com", "password": "your-password"}' \
  | jq -r '.access_token')

# List corpora
curl -s /api/v1/corpora \
  -H "Authorization: Bearer $TOKEN"
```
<!--email_on-->

### Python Example

<!--email_off-->
```python
import requests

base_url = "https://your-morganabench-instance"

# Authenticate
resp = requests.post(f"{base_url}/api/v1/auth/login", json={
    "email": "you@example.com",
    "password": "your-password",
})
token = resp.json()["access_token"]

headers = {"Authorization": f"Bearer {token}"}

# List corpora
corpora = requests.get(f"{base_url}/api/v1/corpora", headers=headers)
print(corpora.json())
```
<!--email_on-->

## CLI

Install the `mb` binary (see [CLI Guide](cli-guide/index.md) for full installation options):

```bash
curl -fsSL https://raw.githubusercontent.com/morganalabs/mb-cli/main/install.sh | bash
```

Quick start (RAG benchmark):

```bash
# Authenticate
mb login --email you@example.com --password your-password

# Upload a document corpus
mb corpus create "My Corpus" --file data.tgz --type docs

# Generate a benchmark (waits for completion)
mb benchmark create --corpus <corpus-id> -n 10 --name "My Benchmark"

# Evaluate
mb eval create "My Eval" --file executed.jsonl --benchmark <benchmark-id>
```

Quick start (tool-calling benchmark):

```bash
# Upload a tools corpus (MCP-formatted JSON)
mb corpus create "My Tools" --file tools.json --type tools

# Generate a tool-calling benchmark
mb benchmark create --corpus <corpus-id> -n 10 --name "My Tools Benchmark"

# Evaluate with tool_call_correctness metric
mb eval create "My Eval" --file executed.jsonl --benchmark <benchmark-id> --metrics tool_call_correctness
```

For scripting and CI, pass `--url`, `--token`, and `--output json` to skip stored config:

```bash
mb --url https://morganabench.example.com --token "$JWT" --output json corpus list | jq '.[].id'
```

See the full [CLI Guide](cli-guide/index.md) for all commands, workflows, and configuration.