Authentication
How to authenticate API requests to CommHero.
Getting Your API Token
- 1.Go to Dashboard → Settings → API Keys
- 2.Click "Generate New Key"
- 3.Give it a name (e.g., "Production API")
- 4.Copy the token and store it securely
Never commit API tokens to git. Use environment variables instead.
Making Authenticated Requests
Include the API token in the Authorization header:
curl -X GET https://api.commhero.io/v1/incidents -H "Authorization: Bearer YOUR_API_TOKEN" -H "Content-Type: application/json"Replace `YOUR_API_TOKEN` with your actual token.
Example: JavaScript
const token = process.env.COMMHERO_API_TOKEN;
const response = await fetch('https://api.commhero.io/v1/incidents', {
method: 'GET',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
}
});
const incidents = await response.json();
console.log(incidents);API tokens can be scoped to specific permissions. Use minimal permissions for security—if you only need to read incidents, don't grant write permissions.