Skip to content

CLI Tool

The Ned AI command-line tool for authentication and API key management.

Installation

bash
# Run directly with npx
npx @ned-ai/cli

# Or install globally
npm install -g @ned-ai/cli

Commands

Login

Authenticate with your Ned AI account via browser OAuth.

bash
ned login

This opens your browser to complete authentication. Once authenticated, your credentials are stored locally for future use.

Options:

  • --no-browser - Print the auth URL instead of opening browser

Logout

Remove stored credentials.

bash
ned logout

Who Am I

Display information about the current authenticated user.

bash
ned whoami

Output:

Logged in as:
  Store: My Awesome Store
  Email: owner@mystore.com
  Plan: Growth

API Keys

List your API keys.

bash
ned keys list

Output:

API Keys:
  • Production API (ned_live_a1b2...89ab)
    Created: 2025-01-15
    Last used: 2025-02-04

  • Development (ned_live_c3d4...cdef)
    Created: 2025-01-20
    Last used: Never

Create Key

Create a new API key.

bash
ned keys create --name "My New Key"

Options:

  • --name, -n - Name for the key (required)
  • --expires - Expiration date (optional)

Output:

✓ Created API key: My New Key

Your API key (save this - it won't be shown again):
ned_live_e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0

Add to your environment:
export NED_API_KEY="ned_live_e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0"

Revoke Key

Revoke an API key.

bash
ned keys revoke ned_live_a1b2...

You'll be prompted to confirm before the key is revoked.

Configuration

Config File Location

Credentials are stored in:

  • macOS/Linux: ~/.config/ned/credentials.json
  • Windows: %APPDATA%\ned\credentials.json

Environment Variables

You can also set credentials via environment variables:

bash
export NED_API_KEY="ned_live_your_key_here"

Usage Examples

CI/CD Integration

bash
# In your CI pipeline
ned whoami  # Verify authentication
ned keys create --name "CI Pipeline $(date +%Y%m%d)"

Shell Scripts

bash
#!/bin/bash

# Check if logged in
if ! ned whoami > /dev/null 2>&1; then
  echo "Not logged in. Please run: ned login"
  exit 1
fi

# Your script continues...
curl -H "Authorization: Bearer $NED_API_KEY" \
  "https://api.meetned.com/api/v1/sales/analytics"

Troubleshooting

"Not authenticated" error

Run ned login to authenticate.

Browser doesn't open

Use ned login --no-browser and manually open the URL.

Permission denied on credentials file

Check file permissions:

bash
# macOS/Linux
chmod 600 ~/.config/ned/credentials.json

# Windows (run as admin)
icacls "%APPDATA%\ned\credentials.json" /inheritance:r /grant:r "%USERNAME%:F"

Built with ❤️ by Ned AI