API Keys
Generate and manage API keys for programmatic access to RoleDream
What are API Keys?
API keys provide a simple way to authenticate your applications and scripts when accessing the RoleDream API. They are best suited for server-to-server integrations where you need programmatic access without user interaction.
Security Notice
API keys grant full access to your company's data. Keep them secure and never expose them in client-side code or public repositories.
Creating API Keys
Navigate to Integrations
Go to Integrations > API Keys in the main navigation menu.
Create New Key
Click "Create API Key" and provide a descriptive name for your key (e.g., "Production Sync Script").
Copy Your Key
Copy the generated key immediately. For security, the full key is only shown once during creation.
Using API Keys
Include your API key in the X-API-Key header of your HTTP requests:
curl -X GET "https://your-api-domain.com/api/customer" \
-H "X-API-Key: your_api_key_here" \
-H "Content-Type: application/json"JavaScript Example
const response = await fetch('https://your-api-domain.com/api/customer', {
headers: {
'X-API-Key': process.env.ROLEDREAM_API_KEY,
'Content-Type': 'application/json'
}
});
const customers = await response.json();Key Management
autorenew Regenerating Keys
If a key is compromised, regenerate it immediately. The old key will be invalidated and a new one will be generated.
delete Revoking Keys
Revoke keys that are no longer needed. This immediately invalidates the key and prevents further access.
Best Practices
- check_circleUse environment variables - Never hardcode API keys in your source code.
- check_circleOne key per integration - Create separate keys for different applications or environments.
- check_circleRegular rotation - Periodically regenerate keys as a security measure.
- check_circleUse descriptive names - Name keys clearly to identify their purpose later.