# Imperva Cloud Application Security

> Manage the websites Imperva protects: block IP addresses, countries and URLs, set threat protection, add custom rules, apply policies, purge the cache, and read visits, statistics and audit events.

App · 22 actions. Web page: https://docs.lodol.com/docs/integrations/imperva

## Actions

### Add site

Add a website to the account. If it's already there, its status comes back.

**Inputs**

- Domain (`domain`, text, required): The website's domain, such as www.example.com.
- Account ID (`account_id`, text): A sub-account or managed account to act on. Leave empty for the connected account.
- Send setup emails (`send_site_setup_emails`, true/false): Email the account's users the DNS and SSL setup steps. Defaults to off.
- Reference ID (`ref_id`, text): Your own reference for the site.

**Outputs**

- `data` (object): The response from Imperva Cloud Application Security.

**Example output**

```json
{
  "data": {
    "acceleration_level": "example",
    "account_id": 1,
    "active": "example",
    "display_name": "example",
    "dns": [
      {
        "dns_record_name": "example",
        "set_data_to": [
          "example"
        ],
        "set_type_to": "example"
      }
    ],
    "domain": "example",
    "ips": [
      "example"
    ],
    "original_dns": [
      {
        "dns_record_name": "example",
        "set_data_to": [
          "example"
        ],
        "set_type_to": "example"
      }
    ],
    "res": 1,
    "res_message": "example",
    "security": {},
    "site_creation_date": 1,
    "site_id": 1,
    "status": "example",
    "warnings": [
      {}
    ]
  }
}
```

### Apply policy to site

Apply a policy to a website.

**Inputs**

- Site (`site_id`, number, required): The website, by its Imperva site ID. At least 1.
- Policy (`policy_id`, text, required): The policy.

**Outputs**

- `data` (object): The response from Imperva Cloud Application Security.

**Example output**

```json
{
  "data": {
    "applied": true,
    "policy_id": "example",
    "site_id": "example"
  }
}
```

### Create custom rule

Add a custom security rule to a website: alert on, block or challenge the requests its filter matches.

**Inputs**

- Site (`site_id`, number, required): The website, by its Imperva site ID. At least 1.
- Name (`name`, text, required): The rule's name.
- Action (`rule_action`, text, required): What the rule does to matching requests. One of: `RULE_ACTION_ALERT` (Alert), `RULE_ACTION_BLOCK` (Block the request), `RULE_ACTION_BLOCK_USER` (Block the session), `RULE_ACTION_BLOCK_IP` (Block the IP address), `RULE_ACTION_CAPTCHA` (Require a CAPTCHA), `RULE_ACTION_RETRY` (Require cookie support), `RULE_ACTION_INTRUSIVE_HTML` (Require JavaScript support).
- Filter (`filter`, text): Which requests the rule matches, in Imperva's rule syntax, such as ClientIP == 192.0.2.10. Leave empty to match every request.
- Enabled (`enabled`, true/false): Whether the rule is on. Defaults to on.

**Outputs**

- `data` (object): The response from Imperva Cloud Application Security.

**Example output**

```json
{
  "data": {
    "action": "example",
    "enabled": true,
    "filter": "example",
    "name": "example",
    "rule_id": 1
  }
}
```

### Delete custom rule

Delete a website's custom rule.

**Inputs**

- Site (`site_id`, number, required): The website, by its Imperva site ID. At least 1.
- Rule ID (`rule_id`, number, required): The rule's ID, which Create custom rule and List site rules return. At least 1.

**Outputs**

- `data` (object): The response from Imperva Cloud Application Security.

**Example output**

```json
{
  "data": {
    "deleted": true,
    "rule_id": "example"
  }
}
```

### Delete site

Remove a website from Imperva. Its traffic stops being protected.

**Inputs**

- Site (`site_id`, number, required): The website, by its Imperva site ID. At least 1.

**Outputs**

- `data` (object): The response from Imperva Cloud Application Security.

**Example output**

```json
{
  "data": {
    "res": 1,
    "res_message": "example"
  }
}
```

### Get account

Get the account's plan, name and settings.

**Inputs**

- Account ID (`account_id`, text): A sub-account or managed account to act on. Leave empty for the connected account.

**Outputs**

- `data` (object): The response from Imperva Cloud Application Security.

**Example output**

```json
{
  "data": {
    "account": {},
    "res": 1,
    "res_message": "example"
  }
}
```

### Get audit events

List who did what in the account: sign-ins, setting changes and API calls.

**Inputs**

- Account ID (`account_id`, text): A sub-account or managed account to act on. Leave empty for the connected account.
- Time range (`time_range`, text): A named time range. Use From and To instead for your own range. One of: `today`, `last_7_days` (Last 7 days), `last_30_days` (Last 30 days), `last_90_days` (Last 90 days), `month_to_date` (Month to date).
- From (`start_time`, date and time): The start of your own time range.
- To (`end_time`, date and time): The end of your own time range.
- Event type (`type`, text): Only events of this type, such as audit.account_login.
- Page size (`page_size`, number): How many to return, up to 100. From 1 to 100.
- Page (`page_num`, number): The page to return, counting from 0. At least 0.

**Outputs**

- `data` (object): The response from Imperva Cloud Application Security.

**Example output**

```json
{
  "data": {
    "audit_events": [
      {}
    ],
    "res": 1,
    "res_message": "example"
  }
}
```

### Get custom rule

Get a website's custom rule.

**Inputs**

- Site (`site_id`, number, required): The website, by its Imperva site ID. At least 1.
- Rule ID (`rule_id`, number, required): The rule's ID, which Create custom rule and List site rules return. At least 1.

**Outputs**

- `data` (object): The response from Imperva Cloud Application Security.

**Example output**

```json
{
  "data": {
    "action": "example",
    "enabled": true,
    "filter": "example",
    "name": "example",
    "rule_id": 1
  }
}
```

### Get policy

Get a policy with its settings.

**Inputs**

- Policy (`policy_id`, text, required): The policy.

**Outputs**

- `data` (object): The response from Imperva Cloud Application Security.

**Example output**

```json
{
  "data": {
    "isError": true,
    "value": {
      "accountId": 1,
      "description": "example",
      "enabled": true,
      "id": 1,
      "isMarkedAsDefault": true,
      "name": "example",
      "policySettings": [
        {
          "data": {},
          "policySettingType": "example",
          "settingsAction": "example"
        }
      ],
      "policyType": "example"
    }
  }
}
```

### Get site

Get a website's status, DNS records to set, and security settings, optionally running checks first.

**Inputs**

- Site (`site_id`, number, required): The website, by its Imperva site ID. At least 1.
- Checks (`tests`, list): Checks to run before answering. One or more of: `domain_validation` (Domain validation), `services`, `dns`.

**Outputs**

- `data` (object): The response from Imperva Cloud Application Security.

**Example output**

```json
{
  "data": {
    "acceleration_level": "example",
    "account_id": 1,
    "active": "example",
    "display_name": "example",
    "dns": [
      {
        "dns_record_name": "example",
        "set_data_to": [
          "example"
        ],
        "set_type_to": "example"
      }
    ],
    "domain": "example",
    "ips": [
      "example"
    ],
    "original_dns": [
      {
        "dns_record_name": "example",
        "set_data_to": [
          "example"
        ],
        "set_type_to": "example"
      }
    ],
    "res": 1,
    "res_message": "example",
    "security": {},
    "site_creation_date": 1,
    "site_id": 1,
    "status": "example",
    "warnings": [
      {}
    ]
  }
}
```

### Get traffic statistics

Get visits, hits, bandwidth, caching, threats and custom rule statistics for the account or one website.

**Inputs**

- Statistics (`stats`, list, required): The statistics to get. One or more of: `visits_timeseries` (Visits timeseries), `hits_timeseries` (Hits timeseries), `bandwidth_timeseries` (Bandwidth timeseries), `requests_geo_dist_summary` (Requests by country), `visits_dist_summary` (Visits by client), `caching`, `caching_timeseries` (Caching timeseries), `threats`, `incap_rules` (Custom rules), `incap_rules_timeseries` (Custom rules over time).
- Site (`site_id`, number): One website. Leave empty for the whole account. At least 1.
- Account ID (`account_id`, text): A sub-account or managed account to act on. Leave empty for the connected account.
- Time range (`time_range`, text): A named time range. Defaults to the last 7 days; use From and To for your own range. One of: `today`, `last_7_days` (Last 7 days), `last_30_days` (Last 30 days), `last_90_days` (Last 90 days), `month_to_date` (Month to date).
- From (`start_time`, date and time): The start of your own time range.
- To (`end_time`, date and time): The end of your own time range.

**Outputs**

- `data` (object): The response from Imperva Cloud Application Security.

**Example output**

```json
{
  "data": {
    "bandwidth_timeseries": [
      {}
    ],
    "caching": {},
    "caching_timeseries": [
      {}
    ],
    "hits_timeseries": [
      {}
    ],
    "incap_rules": [
      {}
    ],
    "incap_rules_timeseries": [
      {}
    ],
    "requests_geo_dist_summary": {},
    "res": 1,
    "res_message": "example",
    "threats": [
      {}
    ],
    "visits_dist_summary": [
      {}
    ],
    "visits_timeseries": [
      {}
    ]
  }
}
```

### Get visits

List recent visits to a website, newest first, optionally only those Imperva acted on, or from one country or IP address.

**Inputs**

- Site (`site_id`, number, required): The website, by its Imperva site ID. At least 1.
- Time range (`time_range`, text): A named time range. Use From and To instead for your own range. One of: `today`, `last_7_days` (Last 7 days), `last_30_days` (Last 30 days), `last_90_days` (Last 90 days), `month_to_date` (Month to date).
- From (`start_time`, date and time): The start of your own time range.
- To (`end_time`, date and time): The end of your own time range.
- Security events (`security`, list): Only visits Imperva handled this way, such as blocked IP addresses or SQL injection. One or more of: `api.threats.action.block_request` (Block the request), `api.threats.action.block_user` (Block the user), `api.threats.action.block_ip` (Block the IP address), `api.threats.action.alert` (Alert only), `api.threats.sql_injection` (SQL injection), `api.threats.cross_site_scripting` (Cross-site scripting), `api.threats.illegal_resource_access` (Illegal resource access), `api.threats.remote_file_inclusion` (Remote file inclusion), `api.threats.backdoor` (Backdoor protection).
- Country (`country`, text): Only visits from this two-letter country code.
- IP address (`ip`, text): Only visits from this IP address.
- Include live visits (`list_live_visits`, true/false): Include visits still in progress. Defaults to on.
- Page size (`page_size`, number): How many to return, up to 100. From 1 to 100.
- Page (`page_num`, number): The page to return, counting from 0. At least 0.

**Outputs**

- `data` (object): The response from Imperva Cloud Application Security.

**Example output**

```json
{
  "data": {
    "res": 1,
    "res_message": "example",
    "visits": [
      {
        "actions": [
          {}
        ],
        "clientApplication": "example",
        "clientIPs": [
          "example"
        ],
        "clientType": "example",
        "country": [
          "example"
        ],
        "countryCode": [
          "example"
        ],
        "endTime": 1,
        "entryPage": "example",
        "hits": 1,
        "id": "example",
        "pageViews": 1,
        "securitySummary": {},
        "siteId": 1,
        "startTime": 1,
        "userAgent": "example"
      }
    ]
  }
}
```

### List data centers

List a website's origin data centers and their servers.

**Inputs**

- Site (`site_id`, number, required): The website, by its Imperva site ID. At least 1.

**Outputs**

- `data` (object): The response from Imperva Cloud Application Security.

**Example output**

```json
{
  "data": {
    "DCs": [
      {}
    ],
    "res": 1,
    "res_message": "example"
  }
}
```

### List policies

List the account's security policies: access lists, allow lists and WAF settings shared across websites.

**Inputs**: None.

**Outputs**

- `data` (object): The response from Imperva Cloud Application Security.

**Example output**

```json
{
  "data": {
    "isError": true,
    "value": [
      {
        "accountId": 1,
        "description": "example",
        "enabled": true,
        "id": 1,
        "isMarkedAsDefault": true,
        "name": "example",
        "policySettings": [
          {
            "data": {},
            "policySettingType": "example",
            "settingsAction": "example"
          }
        ],
        "policyType": "example"
      }
    ]
  }
}
```

### List site rules

List a website's custom security rules and delivery rules.

**Inputs**

- Site (`site_id`, number, required): The website, by its Imperva site ID. At least 1.
- Security rules (`include_security_rules`, true/false): Include the security rules. Defaults to on.
- Delivery rules (`include_delivery_rules`, true/false): Include the delivery rules (redirects and rewrites). Defaults to on.
- Page size (`page_size`, number): How many to return, up to 100. From 1 to 100.
- Page (`page_num`, number): The page to return, counting from 0. At least 0.

**Outputs**

- `data` (object): The response from Imperva Cloud Application Security.

**Example output**

```json
{
  "data": {
    "delivery_rules": {},
    "incap_rules": {},
    "res": 1,
    "res_message": "example"
  }
}
```

### List sites

List the websites the account protects, 50 at a time unless a page size is given.

**Inputs**

- Account ID (`account_id`, text): A sub-account or managed account to act on. Leave empty for the connected account.
- Page size (`page_size`, number): How many to return, up to 100. From 1 to 100.
- Page (`page_num`, number): The page to return, counting from 0. At least 0.

**Outputs**

- `data` (object): The response from Imperva Cloud Application Security.

**Example output**

```json
{
  "data": {
    "res": 1,
    "res_message": "example",
    "sites": [
      {
        "acceleration_level": "example",
        "account_id": 1,
        "active": "example",
        "display_name": "example",
        "dns": [
          {
            "dns_record_name": "example",
            "set_data_to": [
              "example"
            ],
            "set_type_to": "example"
          }
        ],
        "domain": "example",
        "ips": [
          "example"
        ],
        "original_dns": [
          {
            "dns_record_name": "example",
            "set_data_to": [
              "example"
            ],
            "set_type_to": "example"
          }
        ],
        "security": {},
        "site_creation_date": 1,
        "site_id": 1,
        "status": "example",
        "warnings": [
          {}
        ]
      }
    ]
  }
}
```

### List sub-accounts

List the sub-accounts the account manages.

**Inputs**

- Account ID (`account_id`, text): A sub-account or managed account to act on. Leave empty for the connected account.
- Page size (`page_size`, number): How many to return, up to 100. From 1 to 100.
- Page (`page_num`, number): The page to return, counting from 0. At least 0.

**Outputs**

- `data` (object): The response from Imperva Cloud Application Security.

**Example output**

```json
{
  "data": {
    "res": 1,
    "res_message": "example",
    "resultList": [
      {}
    ]
  }
}
```

### Purge site cache

Clear a website's cached content, or only the resources matching a pattern.

**Inputs**

- Site (`site_id`, number, required): The website, by its Imperva site ID. At least 1.
- Pattern (`purge_pattern`, text): Only resources whose names match: name (contains), ^name (starts with) or name$ (ends with). Leave empty to purge everything.

**Outputs**

- `data` (object): The response from Imperva Cloud Application Security.

**Example output**

```json
{
  "data": {
    "res": 1,
    "res_message": "example"
  }
}
```

### Remove policy from site

Stop applying a policy to a website.

**Inputs**

- Site (`site_id`, number, required): The website, by its Imperva site ID. At least 1.
- Policy (`policy_id`, text, required): The policy.

**Outputs**

- `data` (object): The response from Imperva Cloud Application Security.

**Example output**

```json
{
  "data": {
    "applied": true,
    "policy_id": "example",
    "site_id": "example"
  }
}
```

### Set blocked or allowed list

Replace a website's blocked IP addresses, allowed IP addresses, blocked countries or blocked URLs with the values given. An empty list clears it.

**Inputs**

- Site (`site_id`, number, required): The website, by its Imperva site ID. At least 1.
- List (`rule_id`, text, required): Which list to replace. One of: `api.acl.blacklisted_ips` (Blocked IP addresses), `api.acl.whitelisted_ips` (Allowed IP addresses), `api.acl.blacklisted_countries` (Blocked countries and continents), `api.acl.blacklisted_urls` (Blocked URLs).
- IP addresses (`ips`, list): For an IP list: IP addresses, ranges or CIDR blocks, such as 192.0.2.1, 192.0.2.1-192.0.2.100 or 192.0.2.0/24.
- Countries (`countries`, list): For blocked countries: two-letter country codes, such as RU.
- Continents (`continents`, list): For blocked countries: continent codes (AF, AN, AS, EU, NA, OC, SA). One or more of: `AF`, `AN`, `AS`, `EU`, `NA`, `OC`, `SA`.
- URLs (`urls`, list): For blocked URLs: paths on the site, such as /admin.
- URL match (`url_pattern`, text): For blocked URLs: how each path is matched. Defaults to contains. One of: `contains`, `equals`, `prefix`, `suffix`, `not_equals` (Not equals), `not_contains` (Not contains), `not_prefix` (Not prefix), `not_suffix` (Not suffix).

**Outputs**

- `data` (object): The response from Imperva Cloud Application Security.

**Example output**

```json
{
  "data": {
    "res": 1,
    "res_message": "example"
  }
}
```

### Set threat protection

Choose what Imperva does when it finds SQL injection, cross-site scripting, illegal resource access, remote file inclusion or a backdoor on a website.

**Inputs**

- Site (`site_id`, number, required): The website, by its Imperva site ID. At least 1.
- Threat (`rule_id`, text, required): The threat. One of: `api.threats.sql_injection` (SQL injection), `api.threats.cross_site_scripting` (Cross-site scripting), `api.threats.illegal_resource_access` (Illegal resource access), `api.threats.remote_file_inclusion` (Remote file inclusion), `api.threats.backdoor` (Backdoor protection).
- Action (`security_rule_action`, text, required): What to do when it's found. One of: `api.threats.action.block_request` (Block the request), `api.threats.action.block_user` (Block the user), `api.threats.action.block_ip` (Block the IP address), `api.threats.action.alert` (Alert only), `api.threats.action.quarantine_url` (Quarantine the URL (backdoors only)), `api.threats.action.disabled` (Ignore).

**Outputs**

- `data` (object): The response from Imperva Cloud Application Security.

**Example output**

```json
{
  "data": {
    "res": 1,
    "res_message": "example"
  }
}
```

### Update custom rule

Replace a custom rule's name, action, filter and whether it's on.

**Inputs**

- Site (`site_id`, number, required): The website, by its Imperva site ID. At least 1.
- Rule ID (`rule_id`, number, required): The rule's ID, which Create custom rule and List site rules return. At least 1.
- Name (`name`, text, required): The rule's name.
- Action (`rule_action`, text, required): What the rule does to matching requests. One of: `RULE_ACTION_ALERT` (Alert), `RULE_ACTION_BLOCK` (Block the request), `RULE_ACTION_BLOCK_USER` (Block the session), `RULE_ACTION_BLOCK_IP` (Block the IP address), `RULE_ACTION_CAPTCHA` (Require a CAPTCHA), `RULE_ACTION_RETRY` (Require cookie support), `RULE_ACTION_INTRUSIVE_HTML` (Require JavaScript support).
- Filter (`filter`, text): Which requests the rule matches, in Imperva's rule syntax, such as ClientIP == 192.0.2.10. Leave empty to match every request.
- Enabled (`enabled`, true/false): Whether the rule is on. Defaults to on.

**Outputs**

- `data` (object): The response from Imperva Cloud Application Security.

**Example output**

```json
{
  "data": {
    "action": "example",
    "enabled": true,
    "filter": "example",
    "name": "example",
    "rule_id": 1
  }
}
```
