Change the automatic attack switches
const url = 'https://api.nsin.ir/domains/example.com/attack-settings';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"auto_under_attack":true}'};
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/domains/example.com/attack-settings \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "auto_under_attack": true }'Send any of the switches; a missing one keeps its value.
auto_attack_rules off: attacks are still detected, recorded and
reported, but no rule is added. Rules already added are left as they
are.
auto_under_attack on: when an attack is detected and no rule is
blocking it, Under Attack Mode switches on by itself (with a 6-hour
timer) and off again when the attack ends or is marked as not an
attack. A mode you switched on yourself is never switched off. Needs a
plan with Under Attack Mode; otherwise the switch has no effect.
behaviour_detection off: changes in how the domain’s traffic behaves
(not how much of it there is) are no longer recorded as attacks.
Floods are still detected.
Requires domain.settings.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”The domain name (for example example.com) — not a numeric id.
Example
example.comRequest Body required
Section titled “Request Body required ”object
Add a dry-run rule when an attack is detected (default true).
Switch Under Attack Mode on by itself during an attack nothing blocks, and off when it ends (default false).
Record an attack when the traffic suddenly behaves differently, even at normal volume (default true). Rules still need auto_attack_rules.
False while the domain is younger than 3 days: automatic detection needs 3 days of normal traffic first. Ignored in PUT.
Example
{ "auto_under_attack": true}Responses
Section titled “ Responses ”The new switch.
object
Add a dry-run rule when an attack is detected (default true).
Switch Under Attack Mode on by itself during an attack nothing blocks, and off when it ends (default false).
Record an attack when the traffic suddenly behaves differently, even at normal volume (default true). Rules still need auto_attack_rules.
False while the domain is younger than 3 days: automatic detection needs 3 days of normal traffic first. Ignored in PUT.
Example generated
{ "auto_attack_rules": true, "auto_under_attack": true, "behaviour_detection": true}None of auto_attack_rules, auto_under_attack or behaviour_detection given as a boolean.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Example
{ "error": "read-only API key"}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"}