Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/LENINMORENO13/OpsMind/llms.txt

Use this file to discover all available pages before exploring further.

The Create Monitor endpoint registers a new HTTP endpoint with OpsMind so it can be tracked, checked on a recurring schedule, and included in status reports. Once created, the monitor is immediately available for real-time health checks and historical log collection. Both name and url are required — OpsMind will reject requests that omit either field or attempt to register a URL that is already in use by another monitor.

Endpoint

POST /api/v1/monitors
All requests must include a valid JWT in the Authorization header. Missing or expired tokens result in a 401 Unauthorized response before any validation is performed.

Request

Headers

HeaderValueRequired
AuthorizationBearer <token>✅ Yes
Content-Typeapplication/json✅ Yes

Body Parameters

name
string
required
A human-readable label for the monitor. This value is used as the lookup key by GET /api/v1/monitors/status/:site, which performs a case-insensitive name match — so choose a name that uniquely identifies the service.
url
string
required
The full HTTP/HTTPS URL of the endpoint to monitor. Must be unique across all monitors in OpsMind. Attempting to register a URL that already exists returns a 400 error with the conflicting monitor object included in the response.
Use descriptive, slug-style names — for example "payments-service" or "auth-api-prod" — because GET /api/v1/monitors/status/:site looks up monitors by name. If two monitors share a similar name, the status endpoint will match whichever record appears first in a case-insensitive search.

Curl Example

curl --request POST \
  --url https://your-opsmind-host/api/v1/monitors \
  --header "Authorization: Bearer <your_jwt_token>" \
  --header "Content-Type: application/json" \
  --data '{
    "name": "payments-service",
    "url": "https://api.payments.internal/health"
  }'

Response

201 — Created

Returns a JSON envelope with the newly created Monitor object inside data.
{
  "success": true,
  "message": "Monitor created successfully",
  "data": {
    "id": 3,
    "url": "https://api.payments.internal/health",
    "name": "payments-service",
    "isActive": true,
    "checkInterval": 300,
    "lastStatus": "PENDING",
    "createdAt": "2024-11-20T10:05:00.000Z",
    "updatedAt": "2024-11-20T10:05:00.000Z"
  }
}
A newly created monitor always starts with lastStatus: "PENDING" and isActive: true. The checkInterval defaults to 300 seconds (five minutes) and can be managed directly in the database or via future update endpoints.

Error Responses

400 — Missing Required Fields

Returned when name or url (or both) are absent from the request body.
{
  "success": false,
  "error": "The 'name' and 'url' properties are absolutely mandatory."
}

400 — Duplicate URL

Returned when the submitted url is already registered on another monitor. The conflicting monitor object is included in the response to help with deduplication.
{
  "success": false,
  "error": "Monitor with this URL already exists",
  "monitor": {
    "id": 1,
    "url": "https://api.payments.internal/health",
    "name": "payments-service",
    "isActive": true,
    "checkInterval": 300,
    "lastStatus": "UP",
    "createdAt": "2024-11-01T08:00:00.000Z",
    "updatedAt": "2024-11-15T14:32:10.000Z"
  }
}

401 — Unauthorized

Returned when the Authorization header is missing, malformed, or the token has expired.
{
  "success": false,
  "error": "Unauthorized"
}

500 — Internal Server Error

Returned when an unexpected error occurs while persisting the new monitor record.
{
  "success": false,
  "error": "Failed to create monitor"
}

Build docs developers (and LLMs) love