API Keys Guide
API keys are how you securely connect your AI assistant to your Ranch.Bot account. This guide explains everything you need to know about creating, managing, and securing your API keys.
An API key is a secret token that authenticates your AI assistant (like Claude Desktop) with your Ranch.Bot account. It works like a password, but specifically for programmatic access.
When you configure your AI assistant with a Ranch.Bot API key, it can:
- Access your farm data
- Create and update animals
- Record treatments and movements
- Query your herd information
- Manage groups and records
From the Dashboard
- Go to Settings → API Keys
- Click "Create API Key"
- Enter a name (e.g., "Claude Desktop", "ChatGPT")
- Optionally select a default farm
- Click "Create"
- Copy the API key immediately.
ImportantYou'll only see the full API key once. If you lose it, you'll need to create a new one.
API Key Format
Ranch.Bot API keys follow this format:
rb_sk_[32-character-secret]
Example: rb_sk_1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p
rb- Ranch.Bot identifiersk- Secret key type[secret]- Your unique 32-character secret
Name
A friendly name to help you remember where this key is used.
- Good: "Claude Desktop - Mac", "ChatGPT Work", "Gemini Mobile"
- Avoid: "key1", "test", "asdf"
Default Farm
Optionally set a default farm for this API key. When set, MCP operations will automatically use this farm unless you specify otherwise.
Benefits:
- Faster queries - don't need to specify farm each time
- Cleaner prompts - "List my animals" instead of "List animals in Smith Ranch"
- Better UX - AI assistant knows your context
Status
- Active - Key is working and can be used
- Revoked - Key has been disabled (can be deleted)
- Expired - Key has passed its expiration date (auto-revoked)
Editing a Key
You can update:
- Name - Change the friendly name
- Default Farm - Change or remove the default farm
- The key itself - Cannot be changed (create a new key instead)
Revoking a Key
When to revoke:
- The key was compromised or leaked
- You're no longer using that AI assistant
- You want to rotate keys for security
How to revoke:
- Go to Settings → API Keys
- Find the key you want to revoke
- Click "Revoke"
- Confirm the action
TipRevoked keys can be deleted permanently. Active keys cannot be deleted (must revoke first).
Deleting a Key
You can only delete revoked or expired keys. This prevents accidental deletion of active keys.
- Revoke the key first
- Click "Delete"
- Confirm (this cannot be undone)
Best Practices
DO:
- Store keys securely in your AI assistant's config file
- Use different keys for different devices/applications
- Revoke keys immediately if compromised
- Set expiration dates for temporary access
- Monitor usage regularly
- Use descriptive names
DON'T:
- Share your API key publicly (GitHub, forums, screenshots)
- Email or message API keys
- Use the same key everywhere
- Keep unused keys active
- Store keys in plain text files
Monitoring Usage
Track your API key activity:
- Go to Settings → API Keys
- View "Last Used" timestamp for each key
- Check usage patterns for anomalies
Security AlertIf you see unexpected usage or unfamiliar "Last Used" timestamps, revoke the key immediately and create a new one.
Personal Use (Single Device)
Name: "Claude Desktop - Personal"
Default Farm: [Your primary farm]
Multiple Devices
Key 1: "Claude Desktop - Mac"
Key 2: "ChatGPT - iPhone"
Key 3: "Gemini - Work Laptop"
Team Collaboration
Key 1: "John - Claude Desktop"
Key 2: "Sarah - ChatGPT"
Key 3: "Mike - Gemini"
Development/Testing
Name: "Development Testing"
Default Farm: "Test Farm"
Expiration: 7 days
API Key Not Working
Error: "Invalid API key" or "Unauthorized"
Solutions:
- Verify you copied the entire key (starts with
rb_sk_) - Check the key hasn't been revoked (Settings → API Keys)
- Confirm the key hasn't expired
- Ensure there are no extra spaces or line breaks in your config
- Try creating a new key
Can't See Full Key
Problem: Lost or forgot to copy the API key.
Solution: You cannot recover the full key. Create a new one:
- Revoke the old key (if you can identify it)
- Create a new API key
- Update your AI assistant configuration
- This time, save the key in a password manager.
Key Shows as Expired
Problem: Key has passed its expiration date.
Solution:
- The key is automatically revoked and cannot be used
- Create a new API key
- Update your AI assistant configuration
Usage Not Showing
Problem: "Last Used" shows "Never" but you've been using it.
Explanation: Usage tracking updates every few minutes. Wait a bit and refresh the page. If it still shows "Never" after 5 minutes:
- Verify your AI assistant is properly configured
- Check that requests are actually reaching Ranch.Bot
- Contact support if issue persists
Scopes and Permissions (Coming Soon)
Future versions will support granular permissions:
read:animals- Read-only access to animalswrite:animals- Full access to animalsread:records- Read-only access to recordswrite:records- Full access to records
API Key Rotation
For enhanced security, rotate keys periodically:
- Create a new API key
- Update your AI assistant config with the new key
- Test that the new key works
- Revoke the old key
- Delete the old key after confirming everything works
Recommended rotation schedule: Every 90 days for production use
Multiple Farms
If you manage multiple farms:
- Create separate API keys for each farm
- Set the default farm for each key
- Name them clearly: "Claude - North Ranch", "Claude - South Ranch"
- This keeps your data organized and queries fast
Common Issues:
- MCP Server Setup Guide - Full setup instructions
- Troubleshooting - Support chat
Still need help?
- Contact Support
- Email: support@ranch.bot
- Phone: 587-329-3438
Next: MCP Server Setup →