Overview
API keys provide secure, programmatic access to your Stanna workspace data. Each API key is tied to your specific workspace and allows access to all endpoints with the same permissions as your user account.Creating Your First API Key
When you first access Stanna, you’ll need to create an API key to unlock programmatic access to your data:- Automatic Prompt: If you don’t have any API keys, Stanna will automatically prompt you to create one when you first access the dashboard
- Manual Creation: You can also create additional keys through the Settings page
Step-by-Step Guide
1
Access Settings
Navigate to the Settings page in your Stanna dashboard
2
Go to API Keys
Click on the API Keys tab in the settings menu
3
Create New Key
Click the Create New Key button
4
Name Your Key
Enter a descriptive name for your API key (e.g., “Production Dashboard”, “Analytics Script”, “Mobile App”)
5
Save Securely
Copy your new API key immediately and store it securely - you won’t be able to see it again
API Key Security
Best Practices
- Never expose API keys in client-side code - Only use them in server-side applications
- Store keys securely - Use environment variables or secure credential management systems
- Use descriptive names - Name your keys based on their intended use to track access
- Rotate keys regularly - Delete old keys and create new ones periodically
- Limit key scope - Create separate keys for different applications or environments
What Not to Do
❌ Don’t commit API keys to version control❌ Don’t share API keys via email, chat, or other insecure channels
❌ Don’t use the same API key across multiple applications
❌ Don’t store API keys in browser localStorage for production apps
Managing Existing API Keys
Viewing Your Keys
In the Settings → API Keys section, you can view all your existing API keys with:- Key Name: The descriptive name you assigned
- Key Preview: A masked version of the key (e.g.,
sk-1234...abcd) - Created Date: When the key was created
- Last Used: When the key was last used (helps identify inactive keys)
- Status: Whether the key is active or inactive
Deleting API Keys
To delete an API key:- Go to Settings → API Keys
- Find the key you want to delete
- Click the delete button (trash icon)
- Confirm the deletion
Using API Keys in Your Code
Environment Variables (Recommended)
Store your API key in environment variables:Python Example
cURL Example
Troubleshooting
Common Issues
401 Unauthorized Error- Check that your API key is correct and hasn’t been deleted
- Ensure you’re including the
sk-prefix - Verify you’re using the correct header format
- Make sure you have access to the specified workspace
- Check that your API key belongs to the correct workspace
- Verify the key is active in your settings
- Try creating a new API key to test
- Check for extra spaces or characters when copying the key
Getting Help
If you’re still having issues with API keys:- Check the API Reference for authentication examples
- Verify your requests match the expected format
- Contact support if you continue to experience issues
Rate Limits
API keys are subject to rate limiting to ensure fair usage:- Rate Limit: 1000 requests per hour per API key
- Burst Limit: 100 requests per minute
- Headers: Rate limit information is included in response headers