Authentication
API Authentication
Learn how to authenticate your requests to the FailSafe Monitor API using JWT tokens.
Required Headers
All API requests must include the following headers for authentication:
x-api-keyYour JWT API token
Content-Typeapplication/json (for POST/PUT requests)
Getting Your Credentials
- 1
Create an Account
Sign up at monitor.getfailsafe.com
- 2
Access the Dashboard
Log in to your dashboard and navigate to the API settings section
- 3
Generate API Key
Create a new API key and copy the key for authentication
Example Request
Here's an example of how to make an authenticated request using cURL:
curl -X GET \
'https://api.monitor.getfailsafe.com/server/v1/bots' \
-H 'Content-Type: application/json' \
-H 'x-api-key: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
JavaScript Example
Example using the Fetch API in JavaScript:
const response = await fetch('https://api.monitor.getfailsafe.com/server/v1/bots', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'your-jwt-token'
}
});
const data = await response.json();
console.log(data);
Authentication Errors
Common authentication error responses:
401 Unauthorized
{
"error": "Unauthorized",
"message": "Invalid or missing API key"
}
403 Forbidden
{
"error": "Forbidden",
"message": "Insufficient permissions"
}
Security Best Practices
- • Never expose your API key in client-side code
- • Store API keys securely using environment variables
- • Rotate your API keys regularly
- • Use HTTPS for all API requests
- • Monitor your API usage for suspicious activity