nsindocs Search the docs⌘K
  1. Docs
  2. API reference
  3. Uptime

Enable or disable an uptime monitor

patchhttps://api.nsin.ir/uptime/monitors/{id}/enabled

Auth: Authorization: Bearer nsin_… or X-Api-Key: nsin_… — see API keys.

The cheap toggle behind a monitor list's switch — it changes nothing else. Requires domain.settings. Disabling closes the monitor's open incident silently, with no recovery notification.

Path parameters

  • idintegerrequiredpath

Query parameters

  • domainstringrequiredquery

    The domain name (for example example.com). These endpoints take the domain as a query parameter rather than a path segment.

Request body

Content type: application/json · required

  • enabledbooleanrequired

Responses

200The updated monitor.

Content type: application/json

  • idinteger
  • domain_idinteger
  • namestring

    Optional label, up to 64 characters. It is what the outage SMS and the incident list call this watch, so a domain with two monitors on one host sends two distinguishable alerts.

  • enabledboolean
  • host_patternstring

    Legacy single-entry host scope, kept for parity with rules. It is folded into host_includes when the scope is compiled.

  • host_match_typestring

    Empty when the monitor has no host scope, i.e. it watches every subdomain.

    One of: "" "exact" "wildcard" "regex"
  • host_includesarray | null

    null or empty means every subdomain of this domain.

  • host_excludesarray | null

    Excludes beat includes.

  • path_match_typestring

    How the path lists are read.

    One of: "wildcard" "regex"
  • path_includesarray of string

    Request paths this monitor watches. Defaults to ["/*"] — every path — when you send an empty list.

  • path_excludesarray of string

    Paths dropped from the scope. Excludes beat includes.

  • created_atstring (date-time)
  • updated_atstring (date-time)
json
{
  "id": 0,
  "domain_id": 0,
  "name": "string",
  "enabled": true,
  "host_pattern": "string",
  "host_match_type": "",
  "host_includes": [
    "string"
  ],
  "host_excludes": [
    "string"
  ],
  "path_match_type": "wildcard",
  "path_includes": [
    "string"
  ],
  "path_excludes": [
    "string"
  ],
  "created_at": "2026-01-01T00:00:00Z",
  "updated_at": "2026-01-01T00:00:00Z"
}
400Invalid monitor id, or an invalid body.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only API key"
}
401Missing, malformed, revoked or expired API key. (A valid key whose account has been deactivated gets 403 account is inactive instead.)

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "invalid API key"
}
403The key is read-only, your role on the domain lacks the required permission, or the domain's plan does not include the feature.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only API key"
}
404No such monitor on this domain. A monitor id belonging to another domain is reported the same way, so an id can never be used to probe another tenant.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "monitor not found"
}
429The key exceeded its request budget (300 requests per minute by default).

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "rate limit exceeded"
}

Example request

bash
curl -X PATCH "https://api.nsin.ir/uptime/monitors/0/enabled?domain=example.com" \
  -H "Authorization: Bearer $NSIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "enabled": true
}'
esc