API v1.0

API Documentation

Build powerful integrations with Monoduty's comprehensive REST API. Manage webhooks, send alerts, and automate your incident response workflow.

Quick Start

Get up and running with the Monoduty API in minutes. All API endpoints are accessed via HTTPS and return JSON responses.

curl -X GET "https://monoduty.com/api/webhooks" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"

Authentication

The Monoduty API uses session-based authentication for web requests and API keys for programmatic access.

Note: All API requests must be made over HTTPS. Requests made over plain HTTP will fail.
// Example with session authentication
fetch('/api/webhooks', {
  method: 'GET',
  credentials: 'include',
  headers: {
    'Content-Type': 'application/json'
  }
})

Webhooks API

Manage your webhooks programmatically. Create, update, delete, and test webhooks through these endpoints.

GET /api/webhooks
Retrieve all webhooks for the authenticated user.
{
  "success": true,
  "webhooks": [
    {
      "id": "webhook-uuid",
      "name": "Production Alerts",
      "alias": "prod-alerts",
      "status": "ACTIVE",
      "webhook_url": "https://mndty.com/your-token",
      "notification_types": ["EMAIL", "SMS"],
      "statistics": {
        "total_calls": 145,
        "successful_calls": 142,
        "failed_calls": 3
      }
    }
  ],
  "total": 1
}
POST /api/webhooks
Create a new webhook with specified notification channels.
Parameter Type Required Description
name string Yes Webhook name (min 3 characters)
description string No Webhook description
notificationTypes array Yes Array of notification types: EMAIL, SMS, PUSH_NOTIF, CALL
targetChannels object No Target channels for each notification type
{
  "name": "Production Alerts",
  "description": "Critical production system alerts",
  "notificationTypes": ["EMAIL", "SMS"],
  "targetChannels": {
    "email": "admin@company.com",
    "sms": "+1234567890"
  }
}
GET /api/webhooks/:id
Get detailed information about a specific webhook.
DELETE /api/webhooks/:id
Delete a webhook and all associated data.
POST /api/webhooks/:id/test
Send a test notification through the webhook to verify configuration.

Notifications API

Manage notification preferences and retrieve notification history.

POST /api/notifications/mark-all-read
Mark all notifications as read for the current user.
GET /api/notifications/unread-count
Get the count of unread notifications.
{
  "success": true,
  "unread_count": 5
}

Reports API

Generate and download various reports about your system activity.

POST /api/reports/generate
Generate reports in various formats (JSON, CSV, PDF).
Parameter Type Required Description
type string Yes Report type: summary, detailed, incidents, performance
dateRange string No Date range in format "YYYY-MM-DD to YYYY-MM-DD"
format string No Output format: json, csv, pdf (default: json)

System Status API

Monitor system health and performance metrics.

GET /api/status
Get overall system status and health metrics.
GET /api/response-time
Get current API response time metrics.
GET /api/uptime
Get system uptime information.

Error Handling

The API uses conventional HTTP response codes to indicate the success or failure of requests.

// Error Response Format
{
  "success": false,
  "error": "Error message description",
  "code": "ERROR_CODE",
  "timestamp": "2024-01-15T10:30:00.000Z"
}
Status Code Meaning Description
200 OK Request successful
400 Bad Request Invalid request parameters
401 Unauthorized Authentication required
403 Forbidden Insufficient permissions
404 Not Found Resource not found
429 Too Many Requests Rate limit exceeded
500 Internal Server Error Server error occurred