Authentication
API Keys
The SDK authenticates with HubMon using API keys. Keys are sent via the X-API-Key HTTP header.
Key Format
API keys follow the format: sm_live_ followed by 32 random characters.
sm_live_TMXFO0CkgUQg2kLiCdZEHi2dGIgLBGTVCreating an API Key
- Log in to your HubMon dashboard
- Navigate to Settings > API Keys
- Click Create New Key
- Give it a descriptive name (e.g., "Production API")
- Copy the key immediately
WARNING
API keys are shown only once at creation. Store them securely (environment variables, secrets manager).
Security Best Practices
- Never commit API keys to source control
- Use environment variables or a secrets manager
- Create separate keys for each environment (dev, staging, prod)
- Rotate keys periodically
- Use the minimum required permissions
Example: Using Environment Variables
csharp
options.ApiKey = Environment.GetEnvironmentVariable("HUBMON_API_KEY")
?? throw new Exception("HUBMON_API_KEY is not set");Example: Using .NET User Secrets (Development)
bash
dotnet user-secrets set "HubMon:ApiKey" "sm_live_your_key"