Get Your API key
Sign up at console.hopx.dev to get your free API key. After creating an account, you’ll find your API key in the dashboard.Your API key is shown only once when created. Make sure to save it securely. If you lose your key, you’ll need to create a new one.
API key Format
HopX API keys follow this format:Setting Your API key
You can provide your API key in several ways. The SDKs check these sources in order:Method 1: Environment Variable (Recommended)
Set theHOPX_API_KEY environment variable. This is the most secure method and keeps your key out of your code.
- Python
- JavaScript
Method 2: Pass Directly to SDK
You can pass the API key directly when creating a sandbox:- Python
- JavaScript
Method 3: Configuration File
You can use configuration files or secret management systems:- Python (.env file)
- JavaScript (.env file)
- CLI
Using API Keys with Direct API Calls
When making direct HTTP requests to the HopX API, include your API key in the request headers:Header Format
You can use either of these header formats:Example: Creating a Sandbox
Example: Listing Sandboxes
Security Best Practices
1
1. Store Keys Securely
Never commit API keys to version control. Use environment variables, secret management services (AWS Secrets Manager, HashiCorp Vault), or secure configuration files.
2
2. Rotate Keys Regularly
Periodically rotate your API keys, especially if you suspect they may have been compromised. Create new keys in the console and update your applications.
3
3. Use Different Keys for Different Environments
Use separate API keys for development, staging, and production environments. This allows you to revoke access to specific environments without affecting others.
4
4. Monitor Key Usage
Regularly review your API key usage in the console to detect any unauthorized access or unusual activity.
5
5. Restrict Key Permissions
If your organization supports it, create API keys with limited permissions for specific use cases (e.g., read-only keys for monitoring).
Testing Your API key
You can test your API key by making a simple API call:- Python
- JavaScript
- cURL
Troubleshooting
Invalid API key Error
If you receive an authentication error:- Verify the key format: Ensure your key starts with
hopx_live_and contains both the key ID and secret separated by a dot. - Check for extra spaces: Make sure there are no leading or trailing spaces when copying the key.
- Verify environment variable: If using environment variables, confirm it’s set correctly:
- Check key status: Log into console.hopx.dev to verify your key is active and not revoked.
Key Not Found
If the SDK can’t find your API key:- Check environment variable name: Ensure it’s exactly
HOPX_API_KEY(case-sensitive on some systems). - Restart your terminal/IDE: Environment variables may not be loaded in your current session.
- Verify the key is set: Use the troubleshooting commands above to confirm the variable is set.
Rate Limiting
If you receive rate limit errors:- Your API key has usage limits based on your plan
- Wait a few moments and retry your request
- Consider implementing exponential backoff in your application
- Upgrade your plan if you need higher rate limits
Related
- API Authentication - Learn about API authentication
- Python SDK Quickstart - Get started with the Python SDK
- JavaScript SDK Quickstart - Get started with the JavaScript SDK
- API Quickstart - Make your first API request
Next Steps
- Follow the Quickstart Guide to create your first sandbox
- Learn about Supported Languages for code execution
- Explore MCP Integration for AI assistant integration

