POST
/
monitorings
curl --request POST \
  --url https://api.godiligent.ai/monitorings \
  --header 'Content-Type: application/json' \
  --header 'X-API-KEY: <api-key>' \
  --data '{
  "website": "https://example.com",
  "checks": [
    "non_operational_website",
    "high_risk_diligent_classification"
  ],
  "frequency": "weekly",
  "run_now": true,
  "expires_at": "2024-12-31T23:59:59.000Z"
}'
{
  "id": "d6e3b214-30b1-4401-a1b8-a1bd3c6a84e4",
  "website": "https://example.com",
  "customer_id": "<string>",
  "checks": [
    "non_operational_website"
  ],
  "frequency": "weekly",
  "is_active": true,
  "running_state": "IDLE",
  "next_run_at": "2023-11-07T05:31:56Z",
  "expires_at": "2023-11-07T05:31:56Z",
  "last_execution": "2023-11-07T05:31:56Z",
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z",
  "execution_results": [
    {}
  ]
}

Overview

Create a new monitoring configuration for a customer’s website. The monitoring will continuously check the specified website for various risk factors and operational status according to the configured frequency.

Request

  • Method: POST
  • Path: /monitorings
  • Body: JSON object with monitoring configuration

Request Body

  • website (string, required) - The URL to monitor (will be validated and sanitized)
  • checks (array, required) - Array of monitoring checks to perform:
    • "non_operational_website" - Check if website is operational
    • "high_risk_mcc" - Check for high-risk MCC
    • "high_risk_diligent_classification" - Check for high-risk classification
    • "catalog_contain_loan_flipping_indicators" - Check for loan flipping indicators
  • frequency (string, required, case-insensitive) - How often to run checks:
    • "weekly" - Every 7 days
    • "every_2_weeks" - Every 14 days (default)
    • "every_3_weeks" - Every 21 days
    • "every_4_weeks" - Every 28 days
  • expires_at (ISO8601 string, optional) - When monitoring expires (defaults to 6 months from creation)
    • Must be a future date
    • Must be at least N days ahead where N equals the frequency period
  • run_now (boolean, optional) - Execute immediately after creation (defaults to true)

Example Request

{
  "website": "https://example.com",
  "checks": ["non_operational_website", "high_risk_diligent_classification"],
  "frequency": "weekly",
  "run_now": true,
  "expires_at": "2024-12-31T23:59:59.000Z"
}

Success Response

  • Status: 201 Created
{
  "id": "d6e3b214-30b1-4401-a1b8-a1bd3c6a84e4",
  "website": "https://example.com",
  "customer_id": "customer_123",
  "checks": ["non_operational_website", "high_risk_diligent_classification"],
  "frequency": "weekly",
  "expires_at": "2024-12-31T23:59:59.000Z",
  "is_active": true,
  "running_state": "IDLE",
  "next_run_at": "2024-06-10T10:46:00.000Z",
  "last_execution": null,
  "execution_results": [],
  "created_at": "2024-06-03T10:46:00.000Z",
  "updated_at": "2024-06-03T10:46:00.000Z"
}

Error Handling

  • 400 Bad Request
    • Schema validation errors:
      { "error": [{"code": "custom", "message": "Invalid check name(s)", "path": ["checks"]}] }
      
    • Monitor already exists:
      { "error": "Monitor already exists" }
      
    • URL validation failed:
      { "error": [{"code": "custom", "message": "URL is disallowed or invalid", "path": ["website"]}] }
      
  • 401 Unauthorized
    • Missing or invalid customer authentication
  • 500 Internal Server Error
    • Unexpected server error during creation or execution

Validation Rules

  • Website URL: Must be a valid, allowed URL that passes security validation
  • Unique Checks: Each monitoring must have unique check names (no duplicates)
  • Frequency: Case-insensitive input, normalized to lowercase
  • Expiration Date: Must be future date, at least N days ahead based on frequency
  • Duplicate Prevention: Cannot create monitoring for website that already exists for this customer

Notes

  • If run_now is true, the monitoring will be queued for immediate execution via SQS
  • Frequency input is case-insensitive and normalized to lowercase
  • All URLs are validated and sanitized for security before storage
  • Default expiration is 6 months from creation if not specified

Authorizations

X-API-KEY
string
header
required

Body

application/json

Response

201
application/json

Created

The response is of type object.