Create an uptime monitor
const url = 'https://api.nsin.ir/uptime/monitors?domain=example.com';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","enabled":true,"host_pattern":"example","host_match_type":"","host_includes":["example"],"host_excludes":["example"],"path_match_type":"wildcard","path_includes":["example"],"path_excludes":["example"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url 'https://api.nsin.ir/uptime/monitors?domain=example.com' \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "enabled": true, "host_pattern": "example", "host_match_type": "", "host_includes": [ "example" ], "host_excludes": [ "example" ], "path_match_type": "wildcard", "path_includes": [ "example" ], "path_excludes": [ "example" ] }'Requires domain.settings. A monitor must narrow something — a monitor
with neither a host scope nor a path scope is just a duplicate of the
whole-host watch and is rejected. At most max monitors per domain
(see the list endpoint); the cap is a detection-cost ceiling, not a plan
limit.
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. On create, omitted fields take their default;
on update, omitted fields keep their current value and an explicit []
clears a list.
A monitor must narrow SOMETHING: one with no host scope and a path scope of every path duplicates the whole-host watch (a second incident and a second SMS for the same outage) and is rejected. Regex entries are compiled at write time — an uncompilable pattern is refused here rather than breaking detection later.
object
Required to be exact, wildcard or regex once a host filter is
set; defaults to wildcard if you set one without saying how to
read it.
Defaults to ["/*"] when empty.
Responses
Section titled “ Responses ”The created monitor.
A path-scoped uptime watch. It runs the SAME detector as the whole-host watch — same thresholds, same window, same incident machinery — narrowed to the host and path scope declared here. Thresholds are inherited from the domain’s uptime settings and cannot be overridden per monitor.
object
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.
Legacy single-entry host scope, kept for parity with rules. It is
folded into host_includes when the scope is compiled.
Empty when the monitor has no host scope, i.e. it watches every subdomain.
null or empty means every subdomain of this domain.
Excludes beat includes.
How the path lists are read.
Request paths this monitor watches. Defaults to ["/*"] — every
path — when you send an empty list.
Paths dropped from the scope. Excludes beat includes.
Example
{ "host_match_type": "", "path_match_type": "wildcard"}The domain query parameter is missing, the body is malformed, a scope
entry is too long, a regex entry does not compile, the monitor narrows
nothing, or the domain is already at its monitor cap.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Examples
{ "error": "a monitor must narrow something: set a subdomain scope or a path scope"}{ "error": "a domain may have at most 10 uptime monitors"}Missing, malformed, revoked or expired API key — or the owning account is inactive.
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"}