JWT Tokens
Best for: User sessions, interactive applications
- Short-lived access tokens (1 hour)
- Refresh tokens for renewal
- User-scoped permissions
- SSO integration support
Complete guide to authenticating with the Overwatch API using JWT tokens, API keys, and SSO.
JWT Tokens
Best for: User sessions, interactive applications
API Keys
Best for: Service integrations, automation
Request:
curl -X POST "https://your-org.overwatch.com/api/v1/auth/login" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "username=user@company.com&password=your-password"Response:
{ "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "token_type": "bearer", "expires_in": 3600}Include the access token in the Authorization header:
curl -X GET "https://your-org.overwatch.com/api/v1/incidents" \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."Refresh the access token before it expires:
curl -X POST "https://your-org.overwatch.com/api/v1/auth/refresh" \ -H "Content-Type: application/json" \ -d '{"refresh_token": "your-refresh-token"}'Response:
{ "access_token": "new-access-token", "token_type": "bearer", "expires_in": 3600}Invalidate current session and tokens:
curl -X POST "https://your-org.overwatch.com/api/v1/auth/logout" \ -H "Authorization: Bearer your-token"Create an API key via dashboard or API:
curl -X POST "https://your-org.overwatch.com/api/v1/api-keys" \ -H "Authorization: Bearer your-jwt-token" \ -H "Content-Type: application/json" \ -d '{ "name": "CI/CD Integration", "permissions": [ "incidents:read", "incidents:create", "procedures:execute" ], "ip_whitelist": ["10.0.0.0/8"], "expires_at": "2026-12-31T23:59:59Z" }'Response:
{ "id": "key-uuid", "name": "CI/CD Integration", "api_key": "overwatch_ak_1234567890abcdef", "permissions": ["incidents:read", "incidents:create", "procedures:execute"], "created_at": "2025-10-15T10:30:00Z", "expires_at": "2026-12-31T23:59:59Z"}Include the API key in the X-API-Key header:
curl -X GET "https://your-org.overwatch.com/api/v1/incidents" \ -H "X-API-Key: overwatch_ak_1234567890abcdef"View all API keys for your organization:
curl -X GET "https://your-org.overwatch.com/api/v1/api-keys" \ -H "Authorization: Bearer your-token"Revoke an API key immediately:
curl -X DELETE "https://your-org.overwatch.com/api/v1/api-keys/{key_id}" \ -H "Authorization: Bearer your-token"Initiate SSO
curl -X GET "https://your-org.overwatch.com/api/v1/auth/sso/initiate?provider=azure"User Authenticates
Handle Callback
curl -X POST "https://your-org.overwatch.com/api/v1/auth/sso/callback" \ -H "Content-Type: application/json" \ -d '{"code": "auth-code", "state": "state-value"}'Receive JWT Token
Format: resource:action
| Permission | Description |
|---|---|
incidents:read | View incidents |
incidents:create | Create new incidents |
incidents:update | Update incident details |
incidents:delete | Delete incidents |
incidents:assign | Assign incidents to users |
| Permission | Description |
|---|---|
procedures:read | View procedures |
procedures:create | Create new procedures |
procedures:update | Update procedure definitions |
procedures:delete | Delete procedures |
procedures:execute | Execute procedures |
procedures:approve | Approve procedure execution |
| Permission | Description |
|---|---|
analytics:read | View analytics data |
analytics:export | Export analytics reports |
| Permission | Description |
|---|---|
settings:read | View settings |
settings:update | Update configuration |
| Permission | Description |
|---|---|
users:read | View user profiles |
users:create | Create new users |
users:update | Update user details |
users:delete | Delete users |
users:manage | Full user management |
Permission Restrictions:
{ "name": "DevOps API Key", "permissions": [ "incidents:*", // All incident operations "procedures:read", // Read procedures only "procedures:execute" // Execute procedures ], "ip_whitelist": [ "10.0.0.0/8", // Corporate network "172.16.0.0/12" // VPN network ], "rate_limit": 10000, // Custom rate limit "expires_at": "2026-12-31T23:59:59Z"}Retrieve current user profile and permissions:
curl -X GET "https://your-org.overwatch.com/api/v1/auth/me" \ -H "Authorization: Bearer your-token"Response:
{ "id": "user-uuid", "email": "user@company.com", "name": "John Doe", "role": "engineer", "organization": { "id": "org-uuid", "name": "Acme Corporation" }, "permissions": [ "incidents:read", "incidents:create", "procedures:read", "procedures:execute" ], "last_login": "2025-10-15T10:30:00Z"}401 Unauthorized - Invalid Token:
{ "error": { "code": "INVALID_TOKEN", "message": "JWT token has expired", "details": { "expired_at": "2025-10-15T09:30:00Z" } }}401 Unauthorized - Invalid API Key:
{ "error": { "code": "INVALID_API_KEY", "message": "API key not found or revoked" }}403 Forbidden - Insufficient Permissions:
{ "error": { "code": "INSUFFICIENT_PERMISSIONS", "message": "User does not have permission to perform this action", "details": { "required_permission": "incidents:delete", "user_permissions": ["incidents:read", "incidents:create"] } }}const { OverwatchClient } = require('@overwatch/api-client');
// Using JWTconst client = new OverwatchClient({ baseURL: 'https://your-org.overwatch.com', username: 'user@company.com', password: 'your-password'});
await client.login();
// Using API Keyconst clientWithKey = new OverwatchClient({ baseURL: 'https://your-org.overwatch.com', apiKey: 'overwatch_ak_1234567890abcdef'});
// Automatic token refreshclient.on('token.expired', async () => { await client.refresh();});from overwatch import OverwatchClient
# Using JWTclient = OverwatchClient( base_url='https://your-org.overwatch.com', username='user@company.com', password='your-password')
client.login()
# Using API Keyclient_with_key = OverwatchClient( base_url='https://your-org.overwatch.com', api_key='overwatch_ak_1234567890abcdef')
# Automatic token refreshclient.auto_refresh = TrueFor authentication issues, contact support@overwatch-observability.com.
Related Documentation: