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

Change the automatic attack switches

puthttps://api.nsin.ir/domains/{domain}/attack-settings

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

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.

Path parameters

  • domainstringrequiredpath

    The domain name (for example example.com) — not a numeric id.

Request body

Content type: application/json · required

  • auto_attack_rulesboolean

    Add a dry-run rule when an attack is detected (default true).

  • auto_under_attackboolean

    Switch Under Attack Mode on by itself during an attack nothing blocks, and off when it ends (default false).

  • behaviour_detectionboolean

    Record an attack when the traffic suddenly behaves differently, even at normal volume (default true). Rules still need auto_attack_rules.

  • detection_readyboolean

    False while the domain is younger than 3 days: automatic detection needs 3 days of normal traffic first. Ignored in PUT.

Responses

200The new switch.

Content type: application/json

  • auto_attack_rulesboolean

    Add a dry-run rule when an attack is detected (default true).

  • auto_under_attackboolean

    Switch Under Attack Mode on by itself during an attack nothing blocks, and off when it ends (default false).

  • behaviour_detectionboolean

    Record an attack when the traffic suddenly behaves differently, even at normal volume (default true). Rules still need auto_attack_rules.

  • detection_readyboolean

    False while the domain is younger than 3 days: automatic detection needs 3 days of normal traffic first. Ignored in PUT.

json
{
  "auto_attack_rules": true,
  "auto_under_attack": true,
  "behaviour_detection": true,
  "detection_ready": true
}
400None of auto_attack_rules, auto_under_attack or behaviour_detection given as a boolean.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only API key"
}
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/domains/example.com/attack-settings" \
  -H "Authorization: Bearer $NSIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "auto_under_attack": true
}'
esc