Skip to main content

Authentication

RequestHunt supports two authentication methods: browser login (primary) and manual API keys (for CI and automation).

Browser Login (Recommended)

The fastest way to authenticate. The CLI displays a short verification code and opens your browser. Enter the code to approve, and credentials are saved locally.

Browser Login
requesthunt auth login
# Visit: https://requesthunt.com/device
# Code:  ABCD-EFGH
# Enter the code in your browser → credentials saved

requesthunt auth status
# Shows logged-in user, email, and tier

Credentials are stored in credentials.json with restricted permissions (0600). They persist until you run requesthunt auth logout.

Manual API Key (CI / Automation)

For headless environments where browser login is not available.

Getting an API Key

  1. Log in to your dashboard
  2. Navigate to the "API" tab
  3. Click "Create Key" and give it a name
  4. Copy the key immediately — it won't be shown again

Three ways to provide a manual key:

Manual Key Options
# Option 1: Environment variable
export REQUESTHUNT_API_KEY="rh_live_your_key"

# Option 2: Save to config file
requesthunt config set-key rh_live_your_key

# Option 3: Per-command flag
requesthunt --api-key rh_live_your_key search "dark mode"

Credential Resolution Order

When multiple credentials are present, the CLI uses the highest priority source:

  1. Browser login credentials.json from auth login
  2. --api-key flag— per-command override
  3. REQUESTHUNT_API_KEY— environment variable
  4. config.toml — from config set-key

REST API Authentication

For direct HTTP requests, include your API key in the Authorization header with the Bearer prefix:

curl -X GET "https://requesthunt.com/api/v1/requests" \
  -H "Authorization: Bearer rh_live_your_api_key_here" \
  -H "Content-Type: application/json"

API Key Format

rh_live_[32 random characters]

Example: rh_live_k9tcn0zs48v311krjx1m1d6emuiah6z3

Error Response

If authentication fails, you'll receive a 401 response:

401 Unauthorized
{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Invalid API key"
  }
}