API Overview

The SystemOK API provides programmatic access to monitor management, check results, and notification channels. All API endpoints are RESTful and return JSON responses.

Base URL: https://api.systemok.net/api/
All endpoints are relative to this base URL.

Response Format

All API responses follow a consistent format:

{
  "success": true,
  "data": {
    // Response data here
  },
  "error": null
}

Error Responses

When an error occurs, the response will include an error message:

{
  "success": false,
  "data": null,
  "error": "Error message describing what went wrong"
}

HTTP Status Codes

Code Description
200 Success - Request completed successfully
201 Created - Resource created successfully
400 Bad Request - Invalid parameters
401 Unauthorized - Authentication required
402 Payment Required - Subscription required
403 Forbidden - Access denied
404 Not Found - Resource not found
429 Too Many Requests - Rate limit exceeded
500 Internal Server Error

Authentication

The SystemOK API uses session-based authentication. You must first authenticate via the login endpoint to receive a session cookie.

POST /auth/login.php

Request Body

{
  "email": "user@example.com",
  "password": "your_password"
}

Response

{
  "success": true,
  "user": {
    "id": 1,
    "email": "user@example.com",
    "name": "John Doe"
  }
}

Using the Session

After successful authentication, include the session cookie in all subsequent requests:

curl -X GET "https://api.systemok.net/api/user-endpoints/monitors/list.php" \
  -H "Cookie: PHPSESSID=your_session_id"

Rate Limiting

API requests are rate limited to prevent abuse and ensure service stability.

Endpoint Type Rate Limit
Authentication 5 requests per minute
Monitor Operations 100 requests per minute
Check Data 300 requests per minute

Note: Rate limit headers are included in all responses:
X-RateLimit-Limit: Maximum requests per window
X-RateLimit-Remaining: Requests remaining
X-RateLimit-Reset: Unix timestamp when limit resets

List Monitors

Retrieve a list of all monitors for the authenticated user.

GET /user-endpoints/monitors/list.php

Query Parameters

Parameter Type Required Description
status string No Filter by status (active, paused)
type string No Filter by type (http, https, ping, port, keyword)

Response

{
  "success": true,
  "monitors": [
    {
      "id": 1,
      "name": "Example Website",
      "type": "https",
      "target": "https://example.com",
      "interval_minutes": 5,
      "is_active": true,
      "current_status": "up",
      "last_check": "2025-09-26T10:30:00Z",
      "uptime_percentage": 99.9
    }
  ],
  "total": 1
}

Example Request

curl -X GET "https://api.systemok.net/api/user-endpoints/monitors/list.php?status=active" \
  -H "Cookie: PHPSESSID=your_session_id"

Create Monitor

Create a new monitor for the authenticated user.

POST /user-endpoints/monitors/create.php

Request Body

Field Type Required Description
name string Yes Monitor name
type string Yes Monitor type (http, https, ping, port, keyword)
target string Yes URL, IP address, or domain to monitor
interval_minutes integer No Check interval in minutes (default: 5)
port integer No* Port number (required for port monitoring)
keyword string No* Keyword to search (required for keyword monitoring)
keyword_type string No Keyword match type: present or absent (default: present)
timeout_seconds integer No Timeout in seconds (default: 30)
preferred_location string No Preferred monitoring location

Example Request

curl -X POST "https://api.systemok.net/api/user-endpoints/monitors/create.php" \
  -H "Cookie: PHPSESSID=your_session_id" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My Website",
    "type": "https",
    "target": "https://mywebsite.com",
    "interval_minutes": 5,
    "timeout_seconds": 30
  }'

Response

{
  "success": true,
  "monitor": {
    "id": 123,
    "name": "My Website",
    "type": "https",
    "target": "https://mywebsite.com",
    "interval_minutes": 5,
    "is_active": true,
    "created_at": "2025-09-26T10:00:00Z"
  }
}

Note: Monitors with intervals less than 5 minutes require a subscription.

Update Monitor

Update an existing monitor.

PUT /user-endpoints/monitors/update.php

Request Body

Include the monitor ID and any fields you want to update:

{
  "id": 123,
  "name": "Updated Website Name",
  "interval_minutes": 10,
  "is_active": false
}

Response

{
  "success": true,
  "monitor": {
    "id": 123,
    "name": "Updated Website Name",
    "interval_minutes": 10,
    "is_active": false,
    "updated_at": "2025-09-26T11:00:00Z"
  }
}

Delete Monitor

Permanently delete a monitor and all its check history.

DELETE /user-endpoints/monitors/delete.php

Request Body

{
  "id": 123
}

Response

{
  "success": true,
  "message": "Monitor deleted successfully"
}

Warning: This action is permanent and cannot be undone. All check history for this monitor will be deleted.

Bulk Update Monitors

Update multiple monitors at once.

POST /user-endpoints/monitors/bulk-update.php

Request Body

{
  "monitor_ids": [123, 124, 125],
  "updates": {
    "interval_minutes": 10,
    "is_active": true
  }
}

Allowed Update Fields

  • interval_minutes - Check interval
  • is_active - Active/paused status
  • preferred_location - Monitoring location
  • timeout_seconds - Request timeout

Response

{
  "success": true,
  "updated": 3,
  "message": "Updated 3 monitors"
}

List Monitor Checks

Retrieve check history for a specific monitor.

GET /user-endpoints/monitors/checks.php

Query Parameters

Parameter Type Required Description
monitor_id integer Yes Monitor ID
limit integer No Number of results (default: 100, max: 1000)
offset integer No Offset for pagination (default: 0)
start_date string No Start date (YYYY-MM-DD)
end_date string No End date (YYYY-MM-DD)

Response

{
  "success": true,
  "checks": [
    {
      "id": 1234,
      "status": "up",
      "response_time_ms": 234,
      "status_code": 200,
      "checked_at": "2025-09-26T10:30:00Z",
      "location": "us-east-1",
      "error_message": null
    }
  ],
  "total": 1,
  "monitor": {
    "id": 123,
    "name": "My Website"
  }
}

Get Uptime Statistics

Retrieve uptime statistics for a monitor over different time periods.

GET /user-endpoints/monitors/uptime-stats.php

Query Parameters

Parameter Type Required Description
monitor_id integer Yes Monitor ID
period string No Time period: 24h, 7d, 30d, 90d (default: 24h)

Response

{
  "success": true,
  "stats": {
    "uptime_percentage": 99.95,
    "total_checks": 288,
    "up_count": 287,
    "down_count": 1,
    "avg_response_time_ms": 234,
    "min_response_time_ms": 180,
    "max_response_time_ms": 520,
    "last_downtime": "2025-09-25T14:30:00Z"
  },
  "monitor": {
    "id": 123,
    "name": "My Website"
  }
}

List Notification Channels

Retrieve all notification channels for the authenticated user.

GET /user-endpoints/notifications/channels/list.php

Response

{
  "success": true,
  "channels": [
    {
      "id": 1,
      "type": "email",
      "name": "Primary Email",
      "config": {
        "email": "user@example.com"
      },
      "is_active": true,
      "created_at": "2025-09-26T10:00:00Z"
    },
    {
      "id": 2,
      "type": "slack",
      "name": "Team Slack",
      "config": {
        "webhook_url": "https://hooks.slack..."
      },
      "is_active": true,
      "created_at": "2025-09-26T10:00:00Z"
    }
  ]
}

Example Request

curl -X GET "https://api.systemok.net/api/user-endpoints/notifications/channels/list.php" \
  -H "Cookie: PHPSESSID=your_session_id"

Create Notification Channel

Create a new notification channel.

POST /user-endpoints/notifications/channels/create.php

Request Body

Field Type Required Description
type string Yes Channel type: email, webhook, slack, sms
name string Yes Friendly name for the channel
config object Yes Configuration specific to channel type

Configuration by Type

Email
{
  "type": "email",
  "name": "Alert Email",
  "config": {
    "email": "alerts@example.com"
  }
}
Webhook
{
  "type": "webhook",
  "name": "My Webhook",
  "config": {
    "url": "https://example.com/webhook",
    "method": "POST"
  }
}
Slack
{
  "type": "slack",
  "name": "Team Notifications",
  "config": {
    "webhook_url": "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXX"
  }
}
SMS
{
  "type": "sms",
  "name": "Emergency SMS",
  "config": {
    "phone": "+1234567890"
  }
}

Response

{
  "success": true,
  "channel": {
    "id": 3,
    "type": "email",
    "name": "Alert Email",
    "config": {
      "email": "alerts@example.com"
    },
    "is_active": true,
    "created_at": "2025-09-26T12:00:00Z"
  }
}

Update Notification Channel

Update an existing notification channel.

PUT /user-endpoints/notifications/channels/update.php

Request Body

Include the channel ID and any fields you want to update:

{
  "id": 3,
  "name": "Updated Channel Name",
  "config": {
    "email": "newemail@example.com"
  },
  "is_active": false
}

Response

{
  "success": true,
  "message": "Notification channel updated successfully"
}

Delete Notification Channel

Delete a notification channel.

DELETE /user-endpoints/notifications/channels/delete.php

Request Body

{
  "id": 3
}

Response

{
  "success": true,
  "message": "Notification channel deleted successfully"
}

Test Notification Channel

Send a test notification to verify channel configuration.

POST /user-endpoints/notifications/test.php

Request Body

{
  "channel_id": 3
}

Response

{
  "success": true,
  "message": "Test notification sent successfully"
}

Example Request

curl -X POST "https://api.systemok.net/api/user-endpoints/notifications/test.php" \
  -H "Cookie: PHPSESSID=your_session_id" \
  -H "Content-Type: application/json" \
  -d '{"channel_id": 3}'

Note: Test notifications will send a sample alert message to the configured channel. This helps verify that the channel is properly configured and can receive notifications.

Get Monitor Notification Settings

Get notification settings for a specific monitor.

GET /user-endpoints/notifications/monitor/get.php

Query Parameters

Parameter Type Required Description
monitor_id integer Yes Monitor ID

Response

{
  "success": true,
  "monitor": {
    "id": 123,
    "name": "My Website"
  },
  "notifications": {
    "enabled_channels": [1, 2],
    "failure_threshold": 1,
    "success_threshold": 1
  }
}

Update Monitor Notification Settings

Configure which notification channels are enabled for a specific monitor.

POST /user-endpoints/notifications/monitor/update.php

Request Body

Field Type Required Description
monitor_id integer Yes Monitor ID
channel_ids array Yes Array of notification channel IDs to enable
failure_threshold integer No Number of failures before notification (default: 1)
success_threshold integer No Number of successes before recovery notification (default: 1)

Example Request

{
  "monitor_id": 123,
  "channel_ids": [1, 2, 3],
  "failure_threshold": 2,
  "success_threshold": 1
}

Response

{
  "success": true,
  "message": "Monitor notification settings updated successfully"
}

Get Subscription Details

Retrieve subscription information including monitor credits, billing history, and current usage.

GET /subscriptions/get.php

Response

{
  "success": true,
  "subscription": {
    "monitor_credits": 10,
    "billing_day": 15,
    "next_billing_date": "2025-10-15",
    "subscription_status": "active",
    "price_per_credit": 0.40,
    "created_at": "2025-09-15T10:00:00Z"
  },
  "status": {
    "free_used": 5,
    "free_limit": 5,
    "paid_used": 3,
    "paid_limit": 10,
    "has_subscription": true,
    "can_add_free": false,
    "can_add_paid": true
  },
  "billing_history": [
    {
      "billing_date": "2025-09-15T10:00:00Z",
      "amount": -4.00,
      "status": "completed",
      "credits_billed": 10
    }
  ],
  "pricing": {
    "per_monitor_credit": 0.40,
    "currency": "USD"
  }
}

Example Request

curl -X GET "https://api.systemok.net/api/subscriptions/get.php" \
  -H "Cookie: PHPSESSID=your_session_id"

Note: To update your subscription, please use the web interface at https://systemok.net/members/subscriptions.php. Subscription changes require payment processing through the secure web portal.

Monitor Dependencies

Dependencies allow you to create parent-child relationships between monitors to suppress notifications when parent monitors are down. This prevents alert storms when infrastructure components fail.

List Dependencies

Get all dependencies and monitors with dependencies for the authenticated user.

GET /user-endpoints/dependencies/list.php

Response

{
  "success": true,
  "dependencies": [
    {
      "id": 1,
      "parent_monitor_id": 5,
      "child_monitor_id": 10,
      "suppress_notifications": 1,
      "description": "Router provides connectivity",
      "created_at": "2024-01-15 10:30:00",
      "parent_name": "Office Router",
      "parent_type": "ping",
      "child_name": "Web Server",
      "child_type": "http"
    }
  ],
  "monitors": [
    {
      "id": 5,
      "name": "Office Router",
      "type": "ping",
      "target": "192.168.1.1",
      "is_active": 1,
      "has_children": 1,
      "current_status": "up"
    }
  ],
  "tree": [
    {
      "id": 5,
      "name": "Office Router",
      "children": [
        {
          "id": 10,
          "name": "Web Server",
          "children": []
        }
      ]
    }
  ]
}

Example Request

curl -X GET "https://api.systemok.net/api/user-endpoints/dependencies/list.php" \
  -H "Cookie: PHPSESSID=your_session_id"

Create Dependency

Create a new parent-child dependency between two monitors.

POST /user-endpoints/dependencies/create.php

Request Body

{
  "parent_monitor_id": 5,
  "child_monitor_id": 10,
  "suppress_notifications": true,
  "description": "Router provides connectivity for web server"
}

Parameters

Parameter Type Required Description
parent_monitor_id integer Yes ID of the parent monitor
child_monitor_id integer Yes ID of the child monitor
suppress_notifications boolean No Whether to suppress child notifications when parent is down (default: true)
description string No Optional description of the dependency relationship

Response

{
  "success": true,
  "message": "Dependency created successfully",
  "dependency_id": 15
}

Example Request

curl -X POST "https://api.systemok.net/api/user-endpoints/dependencies/create.php" \
  -H "Cookie: PHPSESSID=your_session_id" \
  -H "Content-Type: application/json" \
  -d '{
    "parent_monitor_id": 5,
    "child_monitor_id": 10,
    "suppress_notifications": true
  }'

Update Dependency

Update an existing dependency's settings.

PUT /user-endpoints/dependencies/update.php

Request Body

{
  "id": 15,
  "suppress_notifications": 0,
  "description": "Updated description"
}

Parameters

Parameter Type Required Description
id integer Yes ID of the dependency to update
suppress_notifications integer No 0 or 1 to enable/disable suppression
description string No Updated description

Response

{
  "success": true,
  "message": "Dependency updated successfully"
}

Example Request

curl -X PUT "https://api.systemok.net/api/user-endpoints/dependencies/update.php" \
  -H "Cookie: PHPSESSID=your_session_id" \
  -H "Content-Type: application/json" \
  -d '{
    "id": 15,
    "suppress_notifications": 0
  }'

Delete Dependency

Remove a dependency relationship between monitors.

DELETE /user-endpoints/dependencies/delete.php

Request Body

{
  "id": 15
}

Response

{
  "success": true,
  "message": "Dependency deleted successfully"
}

Example Request

curl -X DELETE "https://api.systemok.net/api/user-endpoints/dependencies/delete.php" \
  -H "Cookie: PHPSESSID=your_session_id" \
  -H "Content-Type: application/json" \
  -d '{"id": 15}'

Get Dependency Suggestions

Get intelligent suggestions for potential monitor dependencies based on monitor types and names.

GET /user-endpoints/dependencies/suggestions.php

Response

{
  "success": true,
  "suggestions": [
    {
      "parent_id": 5,
      "parent_name": "Office Router",
      "child_id": 10,
      "child_name": "Web Server",
      "reason": "Host connectivity check for service",
      "confidence": 0.8
    }
  ],
  "total": 3
}

Example Request

curl -X GET "https://api.systemok.net/api/user-endpoints/dependencies/suggestions.php" \
  -H "Cookie: PHPSESSID=your_session_id"

Note: Suggestions are based on monitor types (ping monitors as parents for services) and naming patterns (routers, gateways, firewalls).

Get User Profile

Retrieve the authenticated user's profile information.

GET /user-endpoints/profile/get.php

Response

{
  "success": true,
  "user": {
    "id": 1,
    "email": "user@example.com",
    "name": "John Doe",
    "timezone": "America/New_York",
    "credit_balance": 25.50,
    "is_admin": false,
    "created_at": "2025-01-15T10:00:00Z",
    "last_login": "2025-09-26T08:30:00Z",
    "monitor_count": 8,
    "notification_channels": 3
  }
}

Example Request

curl -X GET "https://api.systemok.net/api/user-endpoints/profile/get.php" \
  -H "Cookie: PHPSESSID=your_session_id"

Update User Profile

Update the authenticated user's profile information.

PUT /user-endpoints/profile/update.php

Request Body

Field Type Required Description
name string No Display name
email string No Email address
timezone string No Timezone (e.g., "America/New_York")
current_password string No* Required when changing password
new_password string No New password (min 8 characters)

Example Request

curl -X PUT "https://api.systemok.net/api/user-endpoints/profile/update.php" \
  -H "Cookie: PHPSESSID=your_session_id" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Jane Doe",
    "timezone": "Europe/London"
  }'

Response

{
  "success": true,
  "message": "Profile updated successfully",
  "user": {
    "id": 1,
    "email": "user@example.com",
    "name": "Jane Doe",
    "timezone": "Europe/London"
  }
}

List Transactions

Retrieve transaction history for the authenticated user's account.

GET /user-endpoints/transactions/list.php

Query Parameters

Parameter Type Required Description
type string No Filter by type: credit, debit, subscription, refund
status string No Filter by status: completed, pending, failed
start_date string No Start date (YYYY-MM-DD)
end_date string No End date (YYYY-MM-DD)
limit integer No Number of results (default: 100, max: 500)
offset integer No Offset for pagination (default: 0)

Response

{
  "success": true,
  "transactions": [
    {
      "id": 456,
      "type": "credit",
      "amount": 10.00,
      "description": "Account top-up",
      "balance_after": 35.50,
      "status": "completed",
      "created_at": "2025-09-26T10:00:00Z"
    },
    {
      "id": 455,
      "type": "subscription",
      "amount": -4.00,
      "description": "Monthly monitor subscription",
      "balance_after": 25.50,
      "status": "completed",
      "created_at": "2025-09-15T02:00:00Z",
      "json_data": {
        "credits": 10,
        "price_per_credit": 0.40,
        "billing_period": "September 2025"
      }
    }
  ],
  "total": 2,
  "summary": {
    "total_credits": 50.00,
    "total_debits": -24.50,
    "current_balance": 25.50
  }
}

Example Request

curl -X GET "https://api.systemok.net/api/user-endpoints/transactions/list.php?type=subscription&limit=10" \
  -H "Cookie: PHPSESSID=your_session_id"

Note: To add funds to your account, please use the web interface at https://systemok.net/members/transactions.php. Payment processing requires secure authentication through the web portal.