Update outage-detection settings
const url = 'https://api.nsin.ir/uptime/settings?domain=example.com';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"enabled":true,"threshold_pct":1,"window_min":1,"min_requests":1,"min_active_min":1,"recover_min":1,"uptime_host_match_type":"","uptime_host_includes":["example"],"uptime_host_excludes":["example"],"notify_email":true,"notify_sms":true,"notify_webhook":true,"webhook_url":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url 'https://api.nsin.ir/uptime/settings?domain=example.com' \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "enabled": true, "threshold_pct": 1, "window_min": 1, "min_requests": 1, "min_active_min": 1, "recover_min": 1, "uptime_host_match_type": "", "uptime_host_includes": [ "example" ], "uptime_host_excludes": [ "example" ], "notify_email": true, "notify_sms": true, "notify_webhook": true, "webhook_url": "example" }'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.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Query Parameters
Section titled “Query Parameters ”The domain name (for example example.com). These endpoints take the
domain as a query parameter rather than a path segment.
Example
example.comRequest Body required
Section titled “Request Body required ”Every field is optional; omitted fields keep their current value.
object
Outage alerts on or off for the domain.
Per-minute origin-error percentage that counts as down (see bounds).
Minutes the error rate must stay above the threshold before an incident opens.
Minimum origin-eligible requests in the window before an incident can open.
Minimum one-minute buckets with traffic required in the window (at most window_min).
Consecutive clear minutes before an incident resolves.
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.
Send an explicit [] to clear the list — omitting the field leaves
it unchanged.
Send an explicit [] to clear the list.
Master switch for email alerts, for every recipient.
Master switch for SMS alerts. SMS also needs a plan with uptime_sms_enabled.
Turning it on requires a saved webhook_url.
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
Section titled “ Responses ”Updated settings.
object
Whether outage alerts are sent for this domain.
Per-minute origin-error percentage that counts as down.
Minutes the host must stay down before an incident opens.
Traffic floor — below this, no incident opens.
Minimum populated one-minute buckets required in the window.
Consecutive clear minutes before an incident resolves.
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.
Which subdomains the default whole-host watch covers. null or empty
means all of them. Same syntax as a rule’s host scope.
Subdomains excluded from the whole-host watch. Excludes beat includes.
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.
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.
Whether outage events are POSTed to the domain’s webhook. Default false.
Whether a webhook URL is saved. The URL itself and the signing secret
are served by GET /uptime/webhook, which needs domain.settings.
Valid range for each configurable field.
object
Lowest accepted threshold_pct.
Highest accepted threshold_pct.
Lowest accepted window_min.
Highest accepted window_min.
Lowest accepted min_requests.
Lowest accepted recover_min.
Highest accepted recover_min.
Example
{ "uptime_host_match_type": ""}The 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.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Examples
{ "error": "uptime_host_match_type must be 'exact', 'wildcard', or 'regex' when a host filter is set"}Missing, malformed, revoked or expired API key. (A valid key whose
account has been deactivated gets 403 account is inactive instead.)
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Examples
{ "error": "invalid API key"}The key is read-only, your role on the domain lacks the required permission, or the domain’s plan does not include the feature.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Example
{ "error": "read-only API key"}No such domain, or it is not visible to this account. Domains you cannot access are reported as not found rather than forbidden.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Example
{ "error": "read-only API key"}The key exceeded its request budget (300 requests per minute by default).
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Examples
{ "error": "rate limit exceeded"}