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

# CLI Tool

> Manage SQR records from the terminal.

The SQR CLI is a single-file Python script for managing records, templates, and API keys from the terminal.

## Install

```bash theme={null}
pip install requests
curl -o sqr https://raw.githubusercontent.com/your-org/yys-sqr-render/main/cli/sqr.py
chmod +x sqr
```

Or clone the repo and run directly:

```bash theme={null}
python3 cli/sqr.py <command>
```

## Configure

Save your API URL and key so you don't have to pass them every time:

```bash theme={null}
sqr configure
```

This creates `~/.sqr/config.json`:

```json theme={null}
{
  "api_url": "https://yys-sqr-render-bsbe.onrender.com",
  "api_key": "your-api-key"
}
```

## Commands

### Health check

```bash theme={null}
sqr health
```

### Templates

```bash theme={null}
sqr templates list
sqr templates get pharma
```

### Records

```bash theme={null}
# List all records
sqr records list

# Get a specific record
sqr records get SQR-A1B2C

# Create a record
sqr records create -t pharma -i label.jpg \
  --set product_name="Aspirin" \
  --set dosage="100mg"

# Update metadata
sqr records update SQR-A1B2C --set dosage="200mg"
```

### Scanning

```bash theme={null}
sqr scan photo.jpg
```

### Embedding

```bash theme={null}
sqr embed -i label.jpg -m A1B2C
```

### API keys

```bash theme={null}
sqr keys create --name "ci-pipeline"
sqr keys list
sqr keys revoke 3
```

## Environment variables

Instead of `sqr configure`, you can set environment variables:

```bash theme={null}
export SQR_API_URL="https://yys-sqr-render-bsbe.onrender.com"
export SQR_API_KEY="your-api-key"
```

Environment variables take precedence over `~/.sqr/config.json`.
