Get Your API Key
Authentication with Surfa is simple - you just need an API key.Success! You now have your API key. Keep it secure and never commit it to Git.
Using Your API Key
Building your own integration? See the API Reference for endpoint details, payload schemas, and request/response examples.
For SDK (Tracking Events)
Use your API key when initializing the Surfa SDK:.env file:
For MCP Server (Querying Analytics)
Add your API key to Claude Desktop config: macOS:~/Library/Application Support/Claude/claude_desktop_config.json
API Key Types
Surfa uses different key prefixes for different environments:| Prefix | Environment | Use Case |
|---|---|---|
sk_live_ | Production | Live data, production MCP servers |
sk_test_ | Testing | Development and testing |
Test keys are isolated from production data. Use them for development and CI/CD.
Security Best Practices
Never commit keys to Git
Never commit keys to Git
Bad:Good:Add
.env to your .gitignore:Use environment variables
Use environment variables
Store keys in environment variables, not in code:Development:Production:
Set environment variables in your deployment platform:
- Vercel: Settings → Environment Variables
- Railway: Variables tab
- Fly.io:
fly secrets set SURFA_INGEST_KEY=...
Rotate keys regularly
Rotate keys regularly
Rotate your API keys periodically for security:
- Create a new key in dashboard
- Update environment variables
- Deploy changes
- Delete old key
Use separate keys per environment
Use separate keys per environment
Use different keys for different environments:
- Production:
sk_live_prod_abc123 - Staging:
sk_live_staging_xyz789 - Development:
sk_test_dev_123456
Workspace Isolation
Each API key is tied to a specific workspace. This means:- ✅ Data isolation - You only see your workspace’s data
- ✅ Multi-tenant safe - No cross-workspace leakage
- ✅ Team collaboration - Share workspace access with team members
Want to track multiple projects? Create separate workspaces in your dashboard.
Troubleshooting
'Invalid API key' error
'Invalid API key' error
Possible causes:
- Key is incorrect or has typos
- Key was deleted from dashboard
- Using test key in production (or vice versa)
- Verify key in dashboard
- Check environment variables are set correctly
- Ensure no extra spaces or quotes
'Unauthorized' error
'Unauthorized' error
Events not appearing in dashboard
Events not appearing in dashboard
Check:
- API key is correct
- API URL is correct (
https://surfa-web.vercel.app) - No firewall blocking outbound requests
- Events are being tracked (check logs)
Rate Limits
The Ingest API is rate limited to prevent abuse:- 1,000 events per minute per API key
- 60 second sliding window
The MCP Query API (for Claude Desktop) currently has no rate limits.