---
updatedAt: 2026-09-03T16:17:32.000Z
agentTools:
  siteIndex: https://techdocs.akamai.com/llms.txt
  projectIndex: https://techdocs.akamai.com/terraform/llms.txt
---

# AI rules

akamai_appsec_waf_ai_rules

Get information about your AI rules.

```json Query
data "akamai_appsec_waf_ai_rules" "my_ai_rules" {
  config_id          = 12345
  security_policy_id = "abcd_123456"
}
```
```json Output
Changes to Outputs:
my_ai_rules = {
  ai_rule_status     = "ENABLED"
  ai_rules           = [
    {
      action              = "alert"
      condition_exception = jsonencode([])
      risk_score_group    = "XSS_AI"
      rule_description    = "According to OWASP, Cross-Site Scripting attacks are a type of injection problem, in which malicious scripts are injected into the otherwise benign and trusted web sites. Cross-Site Scripting (XSS) attacks occur when an attacker uses a web application to send malicious code, generally in the form of a browser side script, to a different end user. Flaws that allow these attacks to succeed are quite widespread and occur anywhere a web application uses input from a user in the output it generates without validating or encoding it. An attacker can use XSS to send a malicious script to an unsuspecting user.||In order to mount a Cross-Site Scripting attack, hackers are constantly trying to find and exploit new XSS vulnerabilities by embedding malicious code in client-side scripts. Hackers also employ AI based tools to detect XSS vulnerabilities and generate attacks.||This rule is operated by AI that targets Cross-Site Scripting Attacks. The protections of this rule evolves as new type of attacks are identified by AI. The group exceptions for Cross-Site Scripting (XSS) attack group will apply here."
      rule_id             = 3001001
      rule_version        = 1
      title               = "AI-Detected XSS Attack"
    },
    {
      action              = "alert"
      condition_exception = jsonencode([])
      risk_score_group    = "SQL_AI"
      rule_description    = "A SQL Injection attack consists of insertion or \"injection\" of a SQL query via the input data from the client to the application. A successful SQL injection exploit can read sensitive data from the database, modify database data (Insert/Update/Delete), execute administration operations on the database (such as shutdown the DBMS), recover the content of a given file present on the DBMS file system and in some cases issue commands to the operating system.||In order to perform SQL Injection attacks, hackers are constantly trying to find and exploit new SQL vulnerabilities. Hackers also employ AI based tools to detect SQL vulnerabilities and generate attacks.||This rule is operated by AI that targets SQL Injection Attacks. The protections of this rule evolves as new type of attacks are identified by AI. The group exceptions for SQL Injection attack group will apply here."
      rule_id             = 3001000
      rule_version        = 1
      title               = "AI-Detected SQL Injection Attack"
    },
  ]
  config_id          = 12345
  id                 = "12345:abcd_123456"
  security_policy_id = "abcd_123456"
}
```

## Arguments

Pass a security configuration and policy ID to get your AI rule details.

| Argument             | Required | Description                       |
| -------------------- | :------: | --------------------------------- |
| `config_id`          |    ✔️    | Your security configuration's ID. |
| `security_policy_id` |    ✔️    | Your security policy's ID.        |

## Attributes

Returned to you are your AI rule settings.

| Attribute        | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ai_rule_status` | The security policy's AI rules enablement state. Possible values are:<ul><li class="ps-li"><code>ENABLED</code></li><li class="ps-li"><code>DISABLED</code></li><li class="ps-li"><code>NOT\_ENROLLED</code></li></ul><blockquote><strong>Note:</strong> A value of <code>NOT\_ENROLLED</code> occurs when the security policy does not have AI rules enabled.</blockquote>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `ai_rules`       | A list of your security policy's AI rules. Contains:<ul><li><code>rule\_id</code>. The AI rule's ID.</li><li><code>rule\_version</code>. The AI rule's version.</li><li><code>title</code>. The name of your AI rule.</li><li><code>risk\_score\_group</code>. The risk score group to which the AI rule belongs.</li><li><code>rule\_description</code>. A human-readable statement about what the AI rule detects.</li><li><code>action</code>. The action taken on trigger of the AI rule. Possible values are:<ul><li><code>alert</code>. Records the event.</li><li><code>deny</code>. Blocks the event.</li><code>deny\_custom\_{custom_deny_id}</code>. Takes your custom action against the event.</li><li><code>none</code>. No action taken.</li></ul></li><li><code>condition\_exception</code>. A JSON-encoded list of group-level condition exceptions for the AI rule. </li></ul> |

# Sibling pages

* [AAP selected hostnames](https://techdocs.akamai.com/terraform/docs/as-ds-aap-selected-hostnames.md)
* [API endpoints](https://techdocs.akamai.com/terraform/docs/as-ds-api-endpoints.md)
* [API request constraints](https://techdocs.akamai.com/terraform/docs/as-ds-api-request-constraints.md)
* [ASE penalty box settings](https://techdocs.akamai.com/terraform/docs/as-ds-ase-penalty-box-settings.md)
* [Attack groups](https://techdocs.akamai.com/terraform/docs/as-ds-attack-groups.md)
* [Attack payload logging](https://techdocs.akamai.com/terraform/docs/as-ds-attack-payload-logging.md)
* [Bypass network lists](https://techdocs.akamai.com/terraform/docs/as-ds-bypass-network-lists.md)
* [Configuration](https://techdocs.akamai.com/terraform/docs/as-ds-configuration.md)
* [Configuration version](https://techdocs.akamai.com/terraform/docs/as-ds-configuration-version.md)
* [Contracts groups](https://techdocs.akamai.com/terraform/docs/as-ds-contracts-groups.md)
* [Custom deny](https://techdocs.akamai.com/terraform/docs/as-ds-custom-deny.md)
* [Custom rule actions](https://techdocs.akamai.com/terraform/docs/as-ds-custom-rule-actions.md)
* [Custom rules](https://techdocs.akamai.com/terraform/docs/as-ds-custom-rules.md)
* [Eval group](https://techdocs.akamai.com/terraform/docs/as-ds-eval-group.md)
* [Eval penalty box](https://techdocs.akamai.com/terraform/docs/as-ds-eval-penalty.md)
* [Eval penalty box conditions](https://techdocs.akamai.com/terraform/docs/as-ds-eval-penalty-box-conditions.md)
* [Eval rules](https://techdocs.akamai.com/terraform/docs/as-ds-eval-rules.md)
* [Evasive path match](https://techdocs.akamai.com/terraform/docs/as-ds-evasive-path-match.md)
* [Failover hostnames](https://techdocs.akamai.com/terraform/docs/as-ds-failover-hostnames.md)
* [Hostname coverage](https://techdocs.akamai.com/terraform/docs/as-ds-hostname-coverage.md)
* [Hostname coverage match targets](https://techdocs.akamai.com/terraform/docs/as-ds-hostname-coverage-match-targets.md)
* [Hostname coverage overlapping](https://techdocs.akamai.com/terraform/docs/as-ds-hostname-coverage-overlapping.md)
* [IP geo](https://techdocs.akamai.com/terraform/docs/as-ds-ip-geo.md)
* [JA4 fingerprint](https://techdocs.akamai.com/terraform/docs/as-ds-ja4-fingerprint.md)
* [Malware content types](https://techdocs.akamai.com/terraform/docs/as-ds-malware-content-types.md)
* [Malware policies](https://techdocs.akamai.com/terraform/docs/as-ds-malware-policies.md)
* [Malware policy actions](https://techdocs.akamai.com/terraform/docs/as-ds-malware-policy-actions.md)
* [Match targets](https://techdocs.akamai.com/terraform/docs/as-ds-match-targets.md)
* [Penalty box](https://techdocs.akamai.com/terraform/docs/as-ds-penalty-box.md)
* [Penalty box conditions](https://techdocs.akamai.com/terraform/docs/as-ds-penalty-box-conditions.md)
* [PII learning](https://techdocs.akamai.com/terraform/docs/as-ds-pii-learning.md)
* [Policy actions](https://techdocs.akamai.com/terraform/docs/as-ds-policy-actions.md)
* [Pragma header](https://techdocs.akamai.com/terraform/docs/as-ds-pragma-header.md)
* [Prefetch](https://techdocs.akamai.com/terraform/docs/as-ds-prefetch.md)
* [Rapid rules](https://techdocs.akamai.com/terraform/docs/as-ds-rapid-rules.md)
* [Rate policies](https://techdocs.akamai.com/terraform/docs/as-ds-rate-policies.md)
* [Reputation profile actions](https://techdocs.akamai.com/terraform/docs/as-ds-reputation-profile-actions.md)
* [Reputation profile analysis](https://techdocs.akamai.com/terraform/docs/as-ds-reputation-profile-analysis.md)
* [Reputation profiles](https://techdocs.akamai.com/terraform/docs/as-ds-reputation-profiles.md)
* [Request body settings](https://techdocs.akamai.com/terraform/docs/as-ds-request-body-settings.md)
* [Rule upgrade details](https://techdocs.akamai.com/terraform/docs/as-ds-rule-upgrade-details.md)
* [Rules](https://techdocs.akamai.com/terraform/docs/as-ds-rules.md)
* [Security policy](https://techdocs.akamai.com/terraform/docs/as-ds-security-policy.md)
* [Security policy protections](https://techdocs.akamai.com/terraform/docs/as-ds-security-policy-protections.md)
* [Selectable hostnames](https://techdocs.akamai.com/terraform/docs/as-ds-selectable-hostnames.md)
* [Siem definitions](https://techdocs.akamai.com/terraform/docs/as-ds-siem-definitions.md)
* [Siem settings](https://techdocs.akamai.com/terraform/docs/as-ds-siem-settings.md)
* [Slow POST](https://techdocs.akamai.com/terraform/docs/as-ds-slow-post.md)
* [Threat intel](https://techdocs.akamai.com/terraform/docs/as-ds-threat-intel.md)
* [Tuning recommendations](https://techdocs.akamai.com/terraform/docs/as-ds-tuning-recommendations.md)
* [Version notes](https://techdocs.akamai.com/terraform/docs/as-ds-version-notes.md)
* [WAF mode](https://techdocs.akamai.com/terraform/docs/as-ds-waf-mode.md)
* [WAF rule set](https://techdocs.akamai.com/terraform/docs/as-ds-waf-rule-set.md)
* [URL evasion defense](https://techdocs.akamai.com/terraform/docs/as-ds-url-evasion-defense.md)
* [URL protection policy](https://techdocs.akamai.com/terraform/docs/as-ds-url-protection-policy.md)
* [URL protection policies](https://techdocs.akamai.com/terraform/docs/as-ds-url-protection-policies.md)
* [URL protection policy actions](https://techdocs.akamai.com/terraform/docs/as-ds-url-protection-policy-actions.md)
* [URL protection policies actions](https://techdocs.akamai.com/terraform/docs/as-ds-url-protection-policies-actions.md)