Appearance
Ad Rules Engine
Updated: Jun 26, 2026
The ad rules engine is a central rule management service that helps you manage ads automatically based on rules you define. Without the ad rules engine, you must query the Marketing API to monitor an ad's performance and manually take actions on certain conditions.
Since most conditions can be expressed as logical expressions, you can automate management in two ways: Schedule-based rules or Trigger-based rules.
Ad rules objects
You create ad rules as standalone objects and store them in the ad rules library. Each ad rule minimally contains a name, an evaluation_spec and an execution_spec.
Basic structure
To create an ad rule, send a POST request to the adrules_library edge of your ad account, as shown in the following example:
curl -X POST \
-F 'name=Rule 1' \
-F 'evaluation_spec={
...
}' \
-F 'execution_spec={
...
}' \
-F "access_token=<ACCESS_TOKEN>" \
https://graph.facebook.com/v25.0/act_<AD_ACCOUNT_ID>/adrules_libraryOptions
Trigger-based rules
Monitor the state of your ads in real-time. The ad rules engine evaluates a trigger-based rule as soon as the relevant ad objects' metadata or Ad Insights data change.
Schedule-based rules
Monitor the state of your ads by checking them at a set time interval to see if they meet the evaluation_spec criteria.
Components
Evaluation spec
The main purpose of the evaluation_spec of a rule is to determine the objects upon which the rule should execute its action.
Execution spec
The execution_spec of a rule determines the action that applies to all objects that pass evaluation.
Status
The status of a rule determines whether the rule should be running.
To temporarily turn off a rule, set its status to DISABLED. To reactivate a rule, set its status to ENABLED. To permanently remove a rule, delete it.