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

Attacks with rule hits

gethttps://api.nsin.ir/analytics/security/attacks

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

The 50 newest attacks on the domain, each with how often its rule acted (rule_hits, enforced and dry run).

Query parameters

  • domainstringrequiredquery

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

Responses

200The figures.

Content type: application/json

  • availableboolean

    False when rule hits cannot be read yet (they are then zeros).

  • attacksarray of object
    Item fields
    • idinteger
    • domain_idinteger
    • domain_namestring
    • statusstring
      One of: "detected" "mitigating" "ended" "ignored"
    • kindstring

      volume: a flood, far more requests than usual. behaviour: the traffic suddenly behaves differently (for example no CSS/JS/image requests, no cookies, one HTTP version only), even at normal volume. A behaviour attack ends after 30 minutes without the change.

      One of: "volume" "behaviour"
    • driftarray of AttackDrift

      What changed (behaviour attacks; empty for floods), strongest first, at most 8.

      Item fields
      • featurestring
        One of: "asset" "html" "api" "no_referer" "no_cookie" "many_cookie" "s2" "s3" "s4" "s404" "s5" "post" "other_method" "h1" "h2" "h3" "bot_low" "bot_high" "req_per_path" "req_per_ip"
      • groupstring
        One of: "assets" "cookies" "status" "protocol" "bot" "paths" "ips"
      • unitstring

        share: 0–1 of requests. ratio: requests per path or per IP.

        One of: "share" "ratio"
      • normalnumber

        The usual value at this hour of day.

      • nownumber

        The value during the attack.

      • znumber

        How unusual the change is (larger = stronger).

    • started_atstring (date-time)
    • ended_atstring (date-time) | null
    • calm_sincestring (date-time) | null
    • peak_rpminteger

      Highest requests per minute seen.

    • baseline_rpmnumber

      Usual requests per minute for this hour of day.

    • signatureobject
      Fields
      • featuresarray of AttackSignatureFeature
        Item fields
        • fieldstring
          One of: "ja4h" "ja4" "user_agent" "cookie" "header_set_hash" "path" "method" "asn" "country"
        • keystring

          The cookie name for cookie; else empty.

        • valuestring
        • coveragenumber

          Share of the attack's requests with this value (0–1).

        • baseline_sharenumber

          Share of normal requests with this value (0–1).

      • expressionstring

        The rule's conditions as text; empty without a rule.

      • attack_requestsinteger
      • baseline_requestsinteger
      • baseline_windowstring

        reference_day: the same time on the most normal recent day (behaviour attacks).

        One of: "hour_before" "day_before" "reference_day" "none"
    • coveragenumber

      Share of the attack the rule matches.

    • fp_estimatenumber

      Share of normal requests the rule would have hit; -1 = unknown.

    • rule_idinteger | null
    • ruleobject | null
      Fields
      • idinteger
      • namestring
      • enabledboolean
      • action_modestring
        One of: "enforce" "dry_run"
    • enforced_bystring

      "", "user:" or "admin:".

    • notestring
    • created_atstring (date-time)
    • updated_atstring (date-time)
    • rule_hitsobject
      Fields
      • enforcedinteger
      • dry_runinteger
json
{
  "available": true,
  "attacks": [
    {
      "id": 0,
      "domain_id": 0,
      "domain_name": "string",
      "status": "detected",
      "kind": "volume",
      "drift": [
        {
          "feature": "asset",
          "group": "assets",
          "unit": "share",
          "normal": 0,
          "now": 0,
          "z": 0
        }
      ],
      "started_at": "2026-01-01T00:00:00Z",
      "ended_at": "2026-01-01T00:00:00Z",
      "calm_since": "2026-01-01T00:00:00Z",
      "peak_rpm": 0,
      "baseline_rpm": 0,
      "signature": {
        "features": [
          {
            "field": "ja4h",
            "key": null,
            "value": null,
            "coverage": null,
            "baseline_share": null
          }
        ],
        "expression": "string",
        "attack_requests": 0,
        "baseline_requests": 0,
        "baseline_window": "hour_before"
      },
      "coverage": 0,
      "fp_estimate": 0,
      "rule_id": 0,
      "rule": {
        "id": 0,
        "name": "string",
        "enabled": true,
        "action_mode": "enforce"
      },
      "enforced_by": "string",
      "note": "string",
      "created_at": "2026-01-01T00:00:00Z",
      "updated_at": "2026-01-01T00:00:00Z",
      "rule_hits": {
        "enforced": 0,
        "dry_run": 0
      }
    }
  ]
}
400The domain query parameter is missing.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "domain is required"
}
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"
}
402The domain has no active plan at all, so no plan feature is available on it. Buy or renew a plan for the domain. (A plan that is active but does not include the feature answers 403 instead.)

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "This domain does not have an active plan."
}
403The domain's plan does not include the feature this endpoint needs (monitoring for most sections, logs for raw and top-N request data).

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"
}
503Either the analytics backend is temporarily unreachable (retry; no data is lost), or the answer is still being computed. The per-domain sections and the cached account-wide views (domains-overview, global-summary, global-summary/peak, requests-compare, bandwidth-overview, nodes-overview) wait at most about 25 seconds for their query; past that they answer 503 with pending: true and a Retry-After header, while the query keeps running and caches its result, so the retry is served from that cache instead of starting the same scan again. Identical concurrent requests share one computation.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

  • pendingboolean

    true when the query is still running rather than failing. Retry after Retry-After seconds.

json
{
  "error": "analytics unavailable"
}
504The query ran out of time for this period. Retrying the same request runs the same query again, so ask for a shorter period (or narrow it with hostname/path) instead.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "summary timed out for this period; try a shorter one"
}

Example request

bash
curl -X GET "https://api.nsin.ir/analytics/security/attacks?domain=example.com" \
  -H "Authorization: Bearer $NSIN_API_KEY"
esc