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

Update outage-detection settings

puthttps://api.nsin.ir/uptime/settings

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

Partial update — omitted fields keep their current value. Values are clamped to the ranges reported in bounds. Requires domain.settings (not analytics read access: retuning detection is a settings change).

Narrowing uptime_host_includes / uptime_host_excludes can strand an open incident on a subdomain that is no longer watched. The detector closes it on its next tick, without a recovery notification.

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

  • enabledboolean

    Outage alerts on or off for the domain.

  • threshold_pctinteger

    Per-minute origin-error percentage that counts as down (see bounds).

  • window_mininteger

    Minutes the error rate must stay above the threshold before an incident opens.

  • min_requestsinteger

    Minimum origin-eligible requests in the window before an incident can open.

  • min_active_mininteger

    Minimum one-minute buckets with traffic required in the window (at most window_min).

  • recover_mininteger

    Consecutive clear minutes before an incident resolves.

  • uptime_host_match_typestring

    Required to be exact, wildcard or regex once either host list is non-empty; it is forced back to empty when both lists are cleared.

    One of: "" "exact" "wildcard" "regex"
  • uptime_host_includesarray of string

    Send an explicit [] to clear the list — omitting the field leaves it unchanged.

  • uptime_host_excludesarray of string

    Send an explicit [] to clear the list.

  • notify_emailboolean

    Master switch for email alerts, for every recipient.

  • notify_smsboolean

    Master switch for SMS alerts. SMS also needs a plan with uptime_sms_enabled.

  • notify_webhookboolean

    Turning it on requires a saved webhook_url.

  • webhook_urlstring

    http:// or https://. No username/password, and no private, loopback or link-local address. Send "" to remove the webhook, which also switches notify_webhook off. The signing secret is generated when the first URL is saved and survives URL edits.

Responses

200Updated settings.

Content type: application/json

  • enabledboolean

    Whether outage alerts are sent for this domain.

  • threshold_pctinteger

    Per-minute origin-error percentage that counts as down.

  • window_mininteger

    Minutes the host must stay down before an incident opens.

  • min_requestsinteger

    Traffic floor — below this, no incident opens.

  • min_active_mininteger

    Minimum populated one-minute buckets required in the window.

  • recover_mininteger

    Consecutive clear minutes before an incident resolves.

  • uptime_host_match_typestring

    How uptime_host_includes / uptime_host_excludes are read. Empty when no host filter is set, which is the default and means every subdomain is watched.

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

    Which subdomains the default whole-host watch covers. null or empty means all of them. Same syntax as a rule's host scope.

  • uptime_host_excludesarray | null

    Subdomains excluded from the whole-host watch. Excludes beat includes.

  • notify_emailboolean

    Master switch for email alerts on this domain. It applies to the owner and to every member, on top of each member's own preferences. Default true.

  • notify_smsboolean

    Master switch for SMS alerts. Default true. SMS also needs a plan with uptime_sms — on a plan without it no SMS is sent, whatever this says.

  • notify_webhookboolean

    Whether outage events are POSTed to the domain's webhook. Default false.

  • webhook_configuredboolean

    Whether a webhook URL is saved. The URL itself and the signing secret are served by GET /uptime/webhook, which needs domain.settings.

  • boundsUptimeSettingsBounds

    Valid range for each configurable field.

    Fields
    • threshold_pct_mininteger

      Lowest accepted threshold_pct.

    • threshold_pct_maxinteger

      Highest accepted threshold_pct.

    • window_min_mininteger

      Lowest accepted window_min.

    • window_min_maxinteger

      Highest accepted window_min.

    • min_requests_mininteger

      Lowest accepted min_requests.

    • recover_min_mininteger

      Lowest accepted recover_min.

    • recover_min_maxinteger

      Highest accepted recover_min.

json
{
  "enabled": true,
  "threshold_pct": 0,
  "window_min": 0,
  "min_requests": 0,
  "min_active_min": 0,
  "recover_min": 0,
  "uptime_host_match_type": "",
  "uptime_host_includes": [
    "string"
  ],
  "uptime_host_excludes": [
    "string"
  ],
  "notify_email": true,
  "notify_sms": true,
  "notify_webhook": true,
  "webhook_configured": true,
  "bounds": {
    "threshold_pct_min": 0,
    "threshold_pct_max": 0,
    "window_min_min": 0,
    "window_min_max": 0,
    "min_requests_min": 0,
    "recover_min_min": 0,
    "recover_min_max": 0
  }
}
400The domain query parameter is missing, the body is malformed, a threshold is out of range, or the host scope is invalid — a match type other than exact/wildcard/regex while a host filter is set, too many entries, an over-long entry, or a regex that does not compile.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "uptime_host_match_type must be 'exact', 'wildcard', or 'regex' when a host filter is set"
}
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 domain, or it is not visible to this account. Domains you cannot access are reported as not found rather than forbidden.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only API key"
}
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 PUT "https://api.nsin.ir/uptime/settings?domain=example.com" \
  -H "Authorization: Bearer $NSIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "enabled": true,
  "threshold_pct": 0,
  "window_min": 0,
  "min_requests": 0,
  "min_active_min": 0,
  "recover_min": 0,
  "uptime_host_match_type": "",
  "uptime_host_includes": [
    "string"
  ],
  "uptime_host_excludes": [
    "string"
  ],
  "notify_email": true,
  "notify_sms": true,
  "notify_webhook": true,
  "webhook_url": "string"
}'
esc