Skip to main content
POST
/
waap
/
v1
/
domains
/
{domain_id}
/
custom-rules
Python
import os
from gcore import Gcore

client = Gcore(
    api_key=os.environ.get("GCORE_API_KEY"),  # This is the default and can be omitted
)
waap_custom_rule = client.waap.domains.custom_rules.create(
    domain_id=1,
    action={},
    conditions=[{}],
    enabled=True,
    name="Block foobar bot",
)
print(waap_custom_rule.id)
{
  "name": "<string>",
  "enabled": true,
  "action": {
    "allow": {},
    "block": {
      "status_code": 403,
      "action_duration": "<string>"
    },
    "captcha": {},
    "handshake": {},
    "monitor": {}
  },
  "conditions": [
    {
      "owner_types": {
        "negation": false,
        "owner_types": [
          "COMMERCIAL"
        ]
      }
    }
  ],
  "id": 123,
  "description": "<string>"
}

Authorizations

Authorization
string
header
required

API key for authentication. Make sure to include the word apikey, followed by a single space and then your token. Example: apikey 1234$abcdef

Path Parameters

domain_id
integer
required

The domain ID

Body

application/json

A request to create a new WAAP rule

name
string
required

The name assigned to the rule

Required string length: 1 - 100
Pattern: ^[A-Za-z0-9\s.:'";<>?&|\\]+$
Example:

"Block foobar bot"

enabled
boolean
required

Whether or not the rule is enabled

action
CustomerRuleAction · object
required

The action that the rule takes when triggered. Only one action can be set per rule.

conditions
CustomRuleCondition · object[]
required

The conditions required for the WAAP engine to trigger the rule. Rules may have between 1 and 5 conditions. All conditions must pass for the rule to trigger

Required array length: 1 - 5 elements
description
string

The description assigned to the rule

Maximum string length: 100

Response

Successful Response

An WAAP rule applied to a domain

name
string
required

The name assigned to the rule

Required string length: 1 - 100
Pattern: ^[A-Za-z0-9\s.:'";<>?&|\\]+$
Example:

"Block foobar bot"

enabled
boolean
required

Whether or not the rule is enabled

action
CustomerRuleAction · object
required

The action that the rule takes when triggered. Only one action can be set per rule.

conditions
CustomRuleCondition · object[]
required

The conditions required for the WAAP engine to trigger the rule. Rules may have between 1 and 5 conditions. All conditions must pass for the rule to trigger

Required array length: 1 - 5 elements
id
integer
required

The unique identifier for the rule

description
string

The description assigned to the rule

Maximum string length: 100