API Token Authentication¶
Connect to EcoSemantic using API tokens for direct, simple access. Perfect for development, testing, and automation.
Overview¶
API tokens provide straightforward authentication:
- ⚡ Quick Setup - Get started in minutes
- 🔧 Development Friendly - Perfect for testing
- 🤖 Automation Ready - Great for scripts
- 🔑 Long-Lived - Tokens don't expire automatically
Getting Your API Token¶
Step 1: Sign Up¶
- Go to ecosemantic.com
- Click "Sign Up"
- Complete registration
- Verify your email
Step 2: Generate Token¶
- Log in to your dashboard
- Navigate to Settings → API Tokens
- Click "Generate New Token"
- Give your token a descriptive name (e.g., "Claude Desktop")
- Click "Create"
- Copy the token immediately - you won't see it again!
:::warning Keep Your Token Secure API tokens provide full access to your account. Never commit them to version control or share them publicly. :::
Using with Claude Desktop¶
Configuration File Location¶
Choose based on your operating system:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
Configuration Example¶
{
"mcpServers": {
"EcoSemantic": {
"command": "npx",
"args": [
"mcp-remote",
"https://mcp.ecosemantic.com/mcp",
"--header",
"Authorization:Bearer your-api-token-here"
]
}
}
}
Step-by-Step Setup¶
- Open the configuration file in a text editor
- Replace
your-api-token-herewith your actual token - Save the file
- Restart Claude Desktop completely
- Test the connection with a simple query
Test Your Connection¶
Try this prompt in Claude:
Claude should use the user_information tool and return your account details.
Token Management¶
Viewing Your Tokens¶
Dashboard → Settings → API Tokens shows: - Token name - Creation date - Last used - Number of API calls
Regenerating Tokens¶
If you suspect your token is compromised:
- Go to Settings → API Tokens
- Click "Revoke" on the compromised token
- Generate a new token
- Update your configuration files
Token Rotation¶
Best practices for token management:
- 🔄 Rotate tokens every 90 days
- 🗑️ Delete unused tokens
- 📝 Use descriptive names
- 🔒 Store securely (use environment variables)
Security Best Practices¶
DO ✅¶
- Store tokens in environment variables
- Use different tokens for different environments
- Revoke tokens when no longer needed
- Monitor token usage regularly
- Use descriptive token names
DON'T ❌¶
- Commit tokens to git repositories
- Share tokens between team members
- Use the same token everywhere
- Leave unused tokens active
- Post tokens in public forums
Environment Variables¶
For better security, use environment variables:
macOS/Linux¶
Windows¶
# PowerShell
$env:ECOSEMANTIC_API_KEY="your-token-here"
# Or set permanently
[System.Environment]::SetEnvironmentVariable("ECOSEMANTIC_API_KEY", "your-token-here", "User")
Claude Configuration with Env Vars¶
{
"mcpServers": {
"EcoSemantic": {
"command": "npx",
"args": [
"mcp-remote",
"https://mcp.ecosemantic.com/mcp",
"--header",
"Authorization:Bearer ${ECOSEMANTIC_API_KEY}"
]
}
}
}
Troubleshooting¶
Invalid Token Error¶
Symptoms: "Invalid API token" or "Authentication failed"
Solutions: 1. Verify token was copied correctly (no extra spaces) 2. Check token hasn't been revoked 3. Ensure token is from the correct account 4. Generate a new token if needed
Token Not Working¶
Symptoms: Tools not available or permission errors
Solutions: 1. Restart Claude Desktop completely 2. Verify configuration file path 3. Check JSON syntax is valid 4. Ensure token has required permissions
Rate Limiting¶
Symptoms: "Rate limit exceeded" errors
Solutions: 1. Check your subscription tier limits 2. Upgrade to a higher tier 3. Purchase call packs 4. Implement request throttling
API Token vs OAuth¶
| Feature | API Token | OAuth 2.1 |
|---|---|---|
| Setup | Very Easy | Medium |
| Security | High | Highest |
| Token Management | Manual | Automatic |
| Best For | Development | Production |
| Expiration | No (manual revoke) | Yes (auto-refresh) |
| User Authorization | Not required | Required |