# Price rules

When you [create or patch a price list](/rules-engine/resources/price-lists.md) filling up the related `rules` object you're basically setting up **price rules**, meaning that the Core API integration will check your rules against the payload of a price. For performance reasons, it is a lightweight version of the [full price payload](/core-api-reference/prices/object.md), containing only the attributes and relationships needed to evaluate the rule [conditions](/rules-engine/conditions.md) and apply the related [actions](/rules-engine/actions.md) based on the values specified in the rule keys (e.g. fields, selectors, etc.).

{% hint style="info" %}
Adding a price rule to a price list will result in applying the discounts due to the rule actions to all the price list's prices that satisfy the rule conditions.
{% endhint %}

{% hint style="success" %}
The structure, constraints, and data types for the price rules JSON dataset are described in the public [Price Rules JSON schema](https://core.commercelayer.io/api/public/schemas/price_rules). Feel free to use it to implement validation scripts for your rules, automatically generate code, or just better understand how the Rules Engine works behind the scenes.
{% endhint %}

### Example

{% tabs %}
{% tab title="Rules" %}
The following rule offers a 20% discount on the prices of some promotional products (identified by a prefix in their SKU code) for the price lists associated with specific markets:

<pre class="language-json"><code class="lang-json">{
  "rules": [
    {
      "name": "20% discount off promo products in EU and AU markets",
      "conditions": [
        {
<strong>          "field": "price.sku.code",
</strong>          "matcher": "start_with",
          "value": "PROMO"
        },
        {
<strong>          "field": "price.jwt_markets.name",
</strong>          "matcher": "is_in",
          "value": ["Europe", "Australia"]
        }
      ],
      "actions": [
        {
          "type": "percentage",
<strong>          "selector": "price",
</strong>          "value": "0.2"
        }
      ]
    }
  ]
}
</code></pre>

{% endtab %}

{% tab title="Price" %}
The lightweight version of the price payload the rule is checked against by the Core API integration will contain only the strictly necessary information to evaluate the rule matching:

* The SKU associated with the price and its `code`
* The market associated with the JWT and its `name`

<pre class="language-json"><code class="lang-json">{
  "price": {
    "id": "lpeNYUvMTE",
<strong>    "sku": {
</strong>      "id": "klzEhmRAMM",
<strong>      "code": "PROMOTSHIRT"
</strong>    },
<strong>    "jwt_markets": [
</strong>      {
        "id": "jugEskRJSa",
<strong>        "name": "Europe"
</strong>      }
    ]
  }
}
</code></pre>

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.commercelayer.io/rules-engine/core-api-integration/price-rules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
