Skip to content

Create an uptime monitor

POST
/uptime/monitors
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.

domain
required
string

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

Example
example.com
Media type application/json

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
name
string
<= 64 characters
enabled
boolean
default: true
host_pattern
string
host_match_type

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.

string
Allowed values: "" exact wildcard regex
host_includes
Array<string>
<= 200 items
host_excludes
Array<string>
<= 200 items
path_match_type
string
default: wildcard
Allowed values: wildcard regex
path_includes

Defaults to ["/*"] when empty.

Array<string>
<= 50 items
path_excludes
Array<string>
<= 50 items

The created monitor.

Media type application/json

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
id
integer
domain_id
integer
name

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.

string
enabled
boolean
host_pattern

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

string
host_match_type

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

string
Allowed values: "" exact wildcard regex
host_includes

null or empty means every subdomain of this domain.

Array<string>
nullable
host_excludes

Excludes beat includes.

Array<string>
nullable
path_match_type

How the path lists are read.

string
Allowed values: wildcard regex
path_includes

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

Array<string>
path_excludes

Paths dropped from the scope. Excludes beat includes.

Array<string>
created_at
string format: date-time
updated_at
string format: date-time
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.

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Examples
{
"error": "a monitor must narrow something: set a subdomain scope or a path scope"
}

Missing, malformed, revoked or expired API key — or the owning account is inactive.

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Examples
Example invalidKey
{
"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.

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
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.

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Example
{
"error": "read-only API key"
}

The key exceeded its request budget (300 requests per minute by default).

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Examples
Example limited
{
"error": "rate limit exceeded"
}