# PriceRule

        <div class="note">
          <h4>Note</h4>
          <p>We recommend using the GraphQL Admin API to manage discounts. The <a href="/api/examples/discounts">Discount types</a>
          available in the GraphQL Admin API are intended to replace the GraphQL Admin <code>PriceRule</code> object and REST Admin <code>PriceRule</code>
          and <code>DiscountCode</code> resources.</p>
        </div>
        <p>You can use the PriceRule resource to create discounts using conditions. You can then associate the conditions with a discount code by using the <a href="/docs/admin-api/rest/reference/discounts/discountcode">DiscountCode</a> resource. Merchants can distribute the discount codes to their customers.</p>
        <p>Using the PriceRule resource, you can create discounts that specify a discount as a percentage, a fixed amount, or free shipping. You use entitlements and prerequisites to dynamically build these discounts.</p>
        <p>To learn about how to associate a price rule with a discount code, see the <a href="/docs/admin-api/rest/reference/discounts/discountcode">DiscountCode</a> resource.</p>


        <h2>Create a price rule</h2>

        <p>You can create price rules with entitlements and prerequisites. Entitlements describe the designated resources that a discount applies to, such as specific products, variants, or collections.
        Prerequisites describe the requirements that must be met in order for the discount to apply to the entitled resources.
        For example, you might want a discount to apply only to a certain shipping price range, or a certain subtotal range.</p>

        <p>You can use entitlements, prereqisites, and other conditions to create discounts, such as the following examples:
        <ul>
          <li>$10 off the buyer's order if the total exceeds $40</li>
          <li>15% off certain collections</li>
          <li>free shipping on orders over $100.00 for Canadian buyers, redeemable up to 20 times</li>
        </ul>
        </p>
        <p>For examples of how to create price rules, see the <a href="/docs/admin-api/rest/reference/discounts/pricerule/#create-{{ current_version }}">POST method</a>.</p>


## Resource Properties

### PriceRule

* allocation_method:           <p>The allocation method of the price rule. Valid values:</p>
          <ul>
            <li><strong>each</strong>: The discount is applied to each of the entitled items. For example, for a price rule that takes $15 off,
            each entitled line item in a checkout will be discounted by $15.</li>
            <li><strong>across</strong>: The calculated discount amount will be applied across the entitled items. For example, for a price rule
            that takes $15 off, the discount will be applied across all the entitled items.</li>
          </ul>
          <p>When the value of <code>target_type</code> is <code>shipping_line</code>, then this value must be <code>each</code>.</p>

  * Type: x-string
  * Example: "each"
* created_at:           <p>The date and time (<a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601</a> format) when the price rule was created.</p>

  * Type: x-string
  * Example: "2017-03-13T16:09:54-04:00"
* updated_at:           <p>The date and time (<a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601</a> format) when the price rule was updated.</p>

  * Type: x-string
  * Example: "2017-03-14T16:09:54-04:00"
* customer_selection:           <p>The customer selection for the price rule. Valid values:</p>
          <ul>
            <li><strong>all</strong>: The price rule is valid for all customers.</li>
            <li><strong>prerequisite</strong>: The customer must either belong to one of the customer segments specified by <code>customer_segment_prerequisite_ids</code>, or be one of the customers specified by <code>prerequisite_customer_ids</code>.</li>
          </ul>

  * Type: x-string
  * Example: "prerequisite"
* ends_at:           <p>The date and time (<a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601</a>  format) when the price rule ends. Must be after <code>starts_at</code>.</p>

  * Type: x-string
  * Example: "2017-04-19T17:59:10Z"
* entitled_collection_ids:           <p>A list of IDs of collections whose products will be eligible to the discount. It can be used only with
          <code>target_type</code> set to <code>line_item</code> and <code>target_selection</code> set to <code>entitled</code>.
          It can't be used in combination with <code>entitled_product_ids</code> or <code>entitled_variant_ids</code>.</p>

  * Type: x-string
  * Example: [4564654869, 8979761006]
* entitled_country_ids:           <p>A list of IDs of shipping countries that will be entitled to the discount. It can be used only with <code>target_type</code> set to <code>shipping_line</code> and <code>target_selection</code> set to <code>entitled</code>.</p>

  * Type: x-string
  * Example: {" entitled_country_ids"=>[7897987023, 3569053679]}
* entitled_product_ids:           <p>A list of IDs of products that will be entitled to the discount. It can be used only with <code>target_type</code> set to <code>line_item</code>
          and <code>target_selection</code> set to <code>entitled</code>.</p>
          <div class="note note-caution">
            <p>If a product variant is included in <code>entitled_variant_ids</code>, then <code>entitled_product_ids</code> can't include the ID of the product associated with that variant.</p>
          </div>

  * Type: x-string
  * Example: [7897397755, 42382368242]
* entitled_variant_ids:           <p>A list of IDs of product variants that will be entitled to the discount. It can be used only with <code>target_type</code> set to <code>line_item</code>
          and <code>target_selection</code> set to <code>entitled</code>.</p>
          <div class="note note-caution">
            <p>If a product is included in <code>entitled_product_ids</code>, then <code>entitled_variant_ids</code> can't include the ID of any variants associated with that product.</p>
          </div>

  * Type: x-string
  * Example: [6798798798, 5675765905]
* id: The ID for the price rule.
  * Type: x-string
  * Example: 9808080986
* once_per_customer:           <p>Whether the generated discount code will be valid only for a single use per customer. This is tracked using customer ID.</p>

  * Type: x-string
  * Example: true
* prerequisite_customer_ids:           <p>A list of customer IDs. For the price rule to be applicable, the customer must match one of the specified <a href="/docs/admin-api/rest/reference/customers/customer">customers</a>.</p>
          <p>If <code>prerequisite_customer_ids</code> is populated, then <code>customer_segment_prerequisite_ids</code> must be empty.</p>

  * Type: x-string
  * Example: [384028349005, 3492039843]
* prerequisite_quantity_range:           <p>The minimum number of items for the price rule to be applicable. It has the following property:</p>
          <ul>
            <li><strong>greater_than_or_equal_to</strong>: The quantity of an entitled cart item must be greater than or equal to this value.</li>
          </ul>

  * Type: x-string
  * Example: {"greater_than_or_equal_to"=>2}
* customer_segment_prerequisite_ids:           <p>A list of customer segment IDs. For the price rule to be applicable, the customer must be in the group of customers matching a customer segment.</p>
          <p>If <code>customer_segment_prerequisite_ids</code> is populated, then <code>prerequisite_customer_ids</code> must be empty.</p>

  * Type: x-string
  * Example: [1122345432, 43535360314]
* prerequisite_shipping_price_range:           <p>The maximum shipping price for the price rule to be applicable. It has the following property:</p>
          <ul>
            <li><strong>less_than_or_equal_to</strong>: The shipping price must be less than or equal to this value.</li>
          </ul>

  * Type: x-string
  * Example: {"less_than_or_equal_to"=>"10.0"}
* prerequisite_subtotal_range:           <p>The minimum subtotal for the price rule to be applicable. It has the following property:</p>
          <ul>
            <li><strong>greater_than_or_equal_to</strong>: The subtotal of the entitled cart items must be greater than or equal to this value for the discount to apply.</li>
          </ul>

  * Type: x-string
  * Example: {"greater_than_or_equal_to"=>"40.0"}
* prerequisite_to_entitlement_purchase:           <p>The prerequisite purchase for a Buy X Get Y discount. It has the following property:</p>
          <ul>
            <li><strong>prerequisite_amount</strong>: The minimum purchase amount required to be entitled to the discount.</li>
          </ul>

  * Type: x-string
  * Example: {"prerequisite_amount"=>"80.00"}
* starts_at:           <p>The date and time (<a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601</a> format) when the price rule starts.

  * Type: x-string
  * Example: "2017-01-19T17:59:10Z"
* target_selection:           <p>The target selection method of the price rule. Valid values:</p>
          <ul>
            <li><strong>all</strong>: The price rule applies the discount to all line items in the checkout.</li>
            <li><strong>entitled</strong>: The price rule applies the discount to selected entitlements only.</li>
          </ul>

  * Type: x-string
  * Example: "entitled"
* target_type:           <p>The target type that the price rule applies to. Valid values:</p>
          <ul>
            <li><strong>line_item</strong>: The price rule applies to the cart's line items.</li>
            <li><strong>shipping_line</strong>: The price rule applies to the cart's shipping lines.</li>
          </ul>

  * Type: x-string
  * Example: "line_item"
* title:           <p>The title of the price rule. This is used by the Shopify admin search to retrieve discounts. It is also displayed on the <strong>Discounts</strong> page of the Shopify admin for bulk discounts.</p>
          <p>For non-bulk discounts, the discount code is displayed on the admin.</p>
          <div class="note note-caution">
            <p>For a consistent search experience, use the same value for <code>title</code> as the <code>code</code> property of the associated discount code.</p>
          </div>

  * Type: x-string
  * Example: "SUMMERSALE10OFF"
* usage_limit: The maximum number of times the price rule can be used, per discount code.
  * Type: x-string
  * Example: 10
* prerequisite_product_ids:           <p>List of product ids that will be a prerequisites for a Buy X Get Y type discount. The <code>prerequisite_product_ids</code> can be used only with:</p>
          <ul>
            <li><code>target_type</code> set to <code>line_item</code>,</li>
            <li><code>target_selection</code> set to <code>entitled</code>,</li>
            <li><code>allocation_method</code> set to <code>each</code> and</li>
            <li><code>prerequisite_to_entitlement_quantity_ratio</code> defined.</li>
          </ul>
          <div class="note note-caution">
            <h4>Caution</h4>
            <p>If a product variant is included in <code>prerequisite_variant_ids</code>, then <code>prerequisite_product_ids</code> can't include the ID of the product associated with that variant.</p>
          </div>

  * Type: x-string
  * Example: [7897397755, 42382368242]
* prerequisite_variant_ids:           <p>List of variant ids that will be a prerequisites for a Buy X Get Y type discount. The <code>entitled_variant_ids</code> can be used only with:</p>
          <ul>
            <li><code>target_type</code> set to <code>line_item</code>,</li>
            <li><code>target_selection</code> set to <code>entitled</code>,</li>
            <li><code>allocation_method</code> set to <code>each</code> and</li>
            <li><code>prerequisite_to_entitlement_quantity_ratio</code> defined.</li>
          </ul>
          <div class="note note-caution">
            <h4>Caution</h4>
            <p>If a product is included in <code>prerequisite_product_ids</code>, then <code>prerequisite_variant_ids</code> can't include the ID of any variants associated with that product.</p>
          </div>

  * Type: x-string
  * Example: [6798798798, 5675765905]
* prerequisite_collection_ids:           <p>List of collection ids that will be a prerequisites for a Buy X Get Y discount. The <code>entitled_collection_ids</code> can be used only with:</p>
          <ul>
            <li><code>target_type</code> set to <code>line_item</code>,</li>
            <li><code>target_selection</code> set to <code>entitled</code>,</li>
            <li><code>allocation_method</code> set to <code>each</code> and</li>
            <li><code>prerequisite_to_entitlement_quantity_ratio</code> defined.</li>
          </ul>
          Cannot be used in combination with <code>prerequisite_product_ids</code> or <code>prerequisite_variant_ids</code>.</p>

  * Type: x-string
  * Example: [4564654869, 8979761006]
* value:           <p>The value of the price rule. If if the value of <code>target_type</code> is <code>shipping_line</code>, then only <code>-100</code> is accepted.
          The value must be negative.</p>

  * Type: x-string
  * Example: -35
* value_type:           <p>The value type of the price rule. Valid values:</p>
          <ul>
            <li><strong>fixed_amount</strong>: Applies a discount of <code>value</code> as a unit of the store's currency. For example, if <code>value</code> is -30 and the store's currency is USD,
            then $30 USD is deducted when the discount is applied.</li>
            <li><strong>percentage</strong>: Applies a percentage discount of <code>value</code>. For example, if <code>value</code> is -30, then 30% will be deducted when the discount is applied.</li>
          </ul>
          <p>If <code>target_type</code> is <code>shipping_line</code>, then only <code>percentage</code> is accepted.</p>

  * Type: x-string
  * Example: "fixed_amount"
* prerequisite_to_entitlement_quantity_ratio:           <p>Buy/Get ratio for a Buy X Get Y discount. <code>prerequisite_quantity</code> defines the necessary 'buy' quantity and <code>entitled_quantity</code> the offered 'get' quantity.</p>
          <p>The <code>prerequisite_to_entitlement_quantity_ratio</code> can be used only with:</p>
          <ul>
            <li><code>value_type</code> set to <code>percentage</code>,</li>
            <li><code>target_type</code> set to <code>line_item</code>,</li>
            <li><code>target_selection</code> set to <code>entitled</code>,</li>
            <li><code>allocation_method</code> set to <code>each</code>,</li>
            <li><code>prerequisite_product_ids</code> or <code>prerequisite_variant_ids</code> or <code>prerequisite_collection_ids</code> defined and</li>
            <li><code>entitled_product_ids</code> or <code>entitled_variant_ids</code> or <code>entitled_collection_ids</code> defined.</li>
          </ul>
          <div class="note note-caution">
            <h4>Caution</h4>
            <p>Cannot be used in combination with <code>prerequisite_subtotal_range</code>, <code>prerequisite_quantity_range</code> or <code>prerequisite_shipping_price_range</code>.</p>
          </div>

  * Type: x-string
  * Example: {"prerequisite_quantity"=>2, "entitled_quantity"=>1}
* allocation_limit:           <p>The number of times the discount can be allocated on the cart - if eligible. For example a Buy 1 hat Get 1 hat for free discount can be applied 3 times on a cart having more than 6 hats, where maximum of 3 hats get discounted - if the <code>allocation_limit</code> is 3. Empty (<code>null</code>) <code>allocation_limit</code> means unlimited number of allocations.</p>
          <div class="note note-caution">
            <h4>Caution</h4>
            <p><code>allocation_limit</code> is only working with Buy X Get Y discount. The default value on creation will be <code>null</code> (unlimited).</p>
          </div>

  * Type: x-string
  * Example: 3
## Creates a price rule

Creates a price rule

### Endpoint
/admin/api/#{api_version}/price_rules.json (POST)

### Parameters
* api_version (required): 

### Responses
#### 201
Creates a price rule

Examples:
##### Create a Buy X Get Y price rule that gives one free ipod touch if customer buys 2 ipods
Request:
```
POST /admin/api/unstable/price_rules.json
{"price_rule":{"title":"Buy2iPodsGetiPodTouchForFree","value_type":"percentage","value":"-100.0","customer_selection":"all","target_type":"line_item","target_selection":"entitled","allocation_method":"each","starts_at":"2018-03-22T00:00:00-00:00","prerequisite_collection_ids":[841564295],"entitled_product_ids":[921728736],"prerequisite_to_entitlement_quantity_ratio":{"prerequisite_quantity":2,"entitled_quantity":1},"allocation_limit":3}}
```

Response:
```
HTTP/1.1 201 Created
{"price_rule":{"id":1057371197,"value_type":"percentage","value":"-100.0","customer_selection":"all","target_type":"line_item","target_selection":"entitled","allocation_method":"each","allocation_limit":3,"once_per_customer":false,"usage_limit":null,"starts_at":"2018-03-21T20:00:00-04:00","ends_at":null,"created_at":"2025-01-02T11:20:21-05:00","updated_at":"2025-01-02T11:20:21-05:00","entitled_product_ids":[921728736],"entitled_variant_ids":[],"entitled_collection_ids":[],"entitled_country_ids":[],"prerequisite_product_ids":[],"prerequisite_variant_ids":[],"prerequisite_collection_ids":[841564295],"customer_segment_prerequisite_ids":[],"prerequisite_customer_ids":[],"prerequisite_subtotal_range":null,"prerequisite_quantity_range":null,"prerequisite_shipping_price_range":null,"prerequisite_to_entitlement_quantity_ratio":{"prerequisite_quantity":2,"entitled_quantity":1},"prerequisite_to_entitlement_purchase":{"prerequisite_amount":null},"title":"Buy2iPodsGetiPodTouchForFree","admin_graphql_api_id":"gid://shopify/PriceRule/1057371197"}}
```
##### Create a price rule that gives the buyer $10.00 off an order
Request:
```
POST /admin/api/unstable/price_rules.json
{"price_rule":{"title":"SUMMERSALE10OFF","target_type":"line_item","target_selection":"all","allocation_method":"across","value_type":"fixed_amount","value":"-10.0","customer_selection":"all","starts_at":"2017-01-19T17:59:10Z"}}
```

Response:
```
HTTP/1.1 201 Created
{"price_rule":{"id":1057371199,"value_type":"fixed_amount","value":"-10.0","customer_selection":"all","target_type":"line_item","target_selection":"all","allocation_method":"across","allocation_limit":null,"once_per_customer":false,"usage_limit":null,"starts_at":"2017-01-19T12:59:10-05:00","ends_at":null,"created_at":"2025-01-02T11:20:24-05:00","updated_at":"2025-01-02T11:20:24-05:00","entitled_product_ids":[],"entitled_variant_ids":[],"entitled_collection_ids":[],"entitled_country_ids":[],"prerequisite_product_ids":[],"prerequisite_variant_ids":[],"prerequisite_collection_ids":[],"customer_segment_prerequisite_ids":[],"prerequisite_customer_ids":[],"prerequisite_subtotal_range":null,"prerequisite_quantity_range":null,"prerequisite_shipping_price_range":null,"prerequisite_to_entitlement_quantity_ratio":{"prerequisite_quantity":null,"entitled_quantity":null},"prerequisite_to_entitlement_purchase":{"prerequisite_amount":null},"title":"SUMMERSALE10OFF","admin_graphql_api_id":"gid://shopify/PriceRule/1057371199"}}
```
##### Create a price rule that gives the buyer 15% off a specific collection
Request:
```
POST /admin/api/unstable/price_rules.json
{"price_rule":{"title":"15OFFCOLLECTION","target_type":"line_item","target_selection":"entitled","allocation_method":"across","value_type":"percentage","value":"-15.0","customer_selection":"all","entitled_collection_ids":[841564295],"starts_at":"2017-01-19T17:59:10Z"}}
```

Response:
```
HTTP/1.1 201 Created
{"price_rule":{"id":1057371198,"value_type":"percentage","value":"-15.0","customer_selection":"all","target_type":"line_item","target_selection":"entitled","allocation_method":"across","allocation_limit":null,"once_per_customer":false,"usage_limit":null,"starts_at":"2017-01-19T12:59:10-05:00","ends_at":null,"created_at":"2025-01-02T11:20:23-05:00","updated_at":"2025-01-02T11:20:23-05:00","entitled_product_ids":[],"entitled_variant_ids":[],"entitled_collection_ids":[841564295],"entitled_country_ids":[],"prerequisite_product_ids":[],"prerequisite_variant_ids":[],"prerequisite_collection_ids":[],"customer_segment_prerequisite_ids":[],"prerequisite_customer_ids":[],"prerequisite_subtotal_range":null,"prerequisite_quantity_range":null,"prerequisite_shipping_price_range":null,"prerequisite_to_entitlement_quantity_ratio":{"prerequisite_quantity":null,"entitled_quantity":null},"prerequisite_to_entitlement_purchase":{"prerequisite_amount":null},"title":"15OFFCOLLECTION","admin_graphql_api_id":"gid://shopify/PriceRule/1057371198"}}
```
##### Create a price rule that gives the buyer free shipping on orders
        over $50.00 that can be used up to 20 times
Request:
```
POST /admin/api/unstable/price_rules.json
{"price_rule":{"title":"FREESHIPPING","target_type":"shipping_line","target_selection":"all","allocation_method":"each","value_type":"percentage","value":"-100.0","usage_limit":20,"customer_selection":"all","prerequisite_subtotal_range":{"greater_than_or_equal_to":"50.0"},"starts_at":"2017-01-19T17:59:10Z"}}
```

Response:
```
HTTP/1.1 201 Created
{"price_rule":{"id":1057371196,"value_type":"percentage","value":"-100.0","customer_selection":"all","target_type":"shipping_line","target_selection":"all","allocation_method":"each","allocation_limit":null,"once_per_customer":false,"usage_limit":20,"starts_at":"2017-01-19T12:59:10-05:00","ends_at":null,"created_at":"2025-01-02T11:20:20-05:00","updated_at":"2025-01-02T11:20:20-05:00","entitled_product_ids":[],"entitled_variant_ids":[],"entitled_collection_ids":[],"entitled_country_ids":[],"prerequisite_product_ids":[],"prerequisite_variant_ids":[],"prerequisite_collection_ids":[],"customer_segment_prerequisite_ids":[],"prerequisite_customer_ids":[],"prerequisite_subtotal_range":{"greater_than_or_equal_to":"50.0"},"prerequisite_quantity_range":null,"prerequisite_shipping_price_range":null,"prerequisite_to_entitlement_quantity_ratio":{"prerequisite_quantity":null,"entitled_quantity":null},"prerequisite_to_entitlement_purchase":{"prerequisite_amount":null},"title":"FREESHIPPING","admin_graphql_api_id":"gid://shopify/PriceRule/1057371196"}}
```
#### 422
Creates a price rule

Examples:
##### Create a price rule that gives a select group of customers $5 off their order
Request:
```
POST /admin/api/unstable/price_rules.json
{"price_rule":{"title":"5OFFCUSTOMERGROUP","target_type":"line_item","target_selection":"all","allocation_method":"across","value_type":"fixed_amount","value":"-5.0","customer_selection":"prerequisite","customer_segment_prerequisite_ids":[210588551],"starts_at":"2017-01-19T17:59:10Z"}}
```

Response:
```
HTTP/1.1 422 Unprocessable Entity
{"errors":{"customer_segment_prerequisite_ids":["segment with id: 210588551 is invalid"]}}
```
## Retrieves a list of price rules

Retrieves a list of price rules. <strong>Note:</strong> This endpoint implements pagination by using links that are provided in the response header. To learn more, refer to <a href='/api/usage/pagination-rest'>Make paginated requests to the REST Admin API</a>.

### Endpoint
/admin/api/#{api_version}/price_rules.json (GET)

### Parameters
* api_version (required): 
* created_at_max: Show price rules created before date (format 2017-03-25T16:15:47-04:00).
* created_at_min: Show price rules created after date (format 2017-03-25T16:15:47-04:00).
* ends_at_max: Show price rules ending before date (format 2017-03-25T16:15:47-04:00).
* ends_at_min: Show price rules ending after date (format 2017-03-25T16:15:47-04:00).
* limit: The maximum number of results to retrieve.
* since_id: Restrict results to after the specified ID.
* starts_at_max: Show price rules starting before date (format 2017-03-25T16:15:47-04:00).
* starts_at_min: Show price rules starting after date (format 2017-03-25T16:15:47-04:00).
* times_used: Show price rules with times used.
* updated_at_max: Show price rules last updated before date (format 2017-03-25T16:15:47-04:00).
* updated_at_min: Show price rules last updated after date (format 2017-03-25T16:15:47-04:00).

### Responses
#### 200
Retrieves a list of price rules

Examples:
##### Retrieve all price rules
Request:
```
GET /admin/api/unstable/price_rules.json
```

Response:
```
HTTP/1.1 200 OK
{"price_rules":[{"id":507328175,"value_type":"fixed_amount","value":"-10.0","customer_selection":"all","target_type":"line_item","target_selection":"all","allocation_method":"across","allocation_limit":null,"once_per_customer":false,"usage_limit":null,"starts_at":"2024-12-27T11:09:43-05:00","ends_at":"2025-01-08T11:09:43-05:00","created_at":"2025-01-02T11:09:43-05:00","updated_at":"2025-01-02T11:09:43-05:00","entitled_product_ids":[],"entitled_variant_ids":[],"entitled_collection_ids":[],"entitled_country_ids":[],"prerequisite_product_ids":[],"prerequisite_variant_ids":[],"prerequisite_collection_ids":[],"customer_segment_prerequisite_ids":[],"prerequisite_customer_ids":[],"prerequisite_subtotal_range":null,"prerequisite_quantity_range":null,"prerequisite_shipping_price_range":null,"prerequisite_to_entitlement_quantity_ratio":{"prerequisite_quantity":null,"entitled_quantity":null},"prerequisite_to_entitlement_purchase":{"prerequisite_amount":null},"title":"SUMMERSALE10OFF","admin_graphql_api_id":"gid://shopify/PriceRule/507328175"},{"id":106886544,"value_type":"fixed_amount","value":"-10.0","customer_selection":"all","target_type":"line_item","target_selection":"all","allocation_method":"across","allocation_limit":null,"once_per_customer":false,"usage_limit":null,"starts_at":"2024-12-31T11:09:43-05:00","ends_at":"2025-01-04T11:09:43-05:00","created_at":"2025-01-02T11:09:43-05:00","updated_at":"2025-01-02T11:09:43-05:00","entitled_product_ids":[],"entitled_variant_ids":[],"entitled_collection_ids":[],"entitled_country_ids":[],"prerequisite_product_ids":[],"prerequisite_variant_ids":[],"prerequisite_collection_ids":[],"customer_segment_prerequisite_ids":[],"prerequisite_customer_ids":[],"prerequisite_subtotal_range":null,"prerequisite_quantity_range":null,"prerequisite_shipping_price_range":null,"prerequisite_to_entitlement_quantity_ratio":{"prerequisite_quantity":null,"entitled_quantity":null},"prerequisite_to_entitlement_purchase":{"prerequisite_amount":null},"title":"TENOFF","admin_graphql_api_id":"gid://shopify/PriceRule/106886544"}]}
```
##### Retrieve all price rules after a specified ID
Request:
```
GET /admin/api/unstable/price_rules.json
```

Response:
```
HTTP/1.1 200 OK
{"price_rules":[{"id":507328175,"value_type":"fixed_amount","value":"-10.0","customer_selection":"all","target_type":"line_item","target_selection":"all","allocation_method":"across","allocation_limit":null,"once_per_customer":false,"usage_limit":null,"starts_at":"2024-12-27T11:09:43-05:00","ends_at":"2025-01-08T11:09:43-05:00","created_at":"2025-01-02T11:09:43-05:00","updated_at":"2025-01-02T11:09:43-05:00","entitled_product_ids":[],"entitled_variant_ids":[],"entitled_collection_ids":[],"entitled_country_ids":[],"prerequisite_product_ids":[],"prerequisite_variant_ids":[],"prerequisite_collection_ids":[],"customer_segment_prerequisite_ids":[],"prerequisite_customer_ids":[],"prerequisite_subtotal_range":null,"prerequisite_quantity_range":null,"prerequisite_shipping_price_range":null,"prerequisite_to_entitlement_quantity_ratio":{"prerequisite_quantity":null,"entitled_quantity":null},"prerequisite_to_entitlement_purchase":{"prerequisite_amount":null},"title":"SUMMERSALE10OFF","admin_graphql_api_id":"gid://shopify/PriceRule/507328175"}]}
```
## Updates an existing a price rule

Updates an existing a price rule

### Endpoint
/admin/api/#{api_version}/price_rules/{price_rule_id}.json (PUT)

### Parameters
* api_version (required): 
* price_rule_id (required): 

### Responses
#### 200
Updates an existing a price rule

Examples:
##### Update the title of a price rule
Request:
```
PUT /admin/api/unstable/price_rules/507328175.json
{"price_rule":{"id":507328175,"title":"WINTER SALE"}}
```

Response:
```
HTTP/1.1 200 OK
{"price_rule":{"id":507328175,"value_type":"fixed_amount","value":"-10.0","customer_selection":"all","target_type":"line_item","target_selection":"all","allocation_method":"across","allocation_limit":null,"once_per_customer":false,"usage_limit":null,"starts_at":"2024-12-27T11:09:43-05:00","ends_at":"2025-01-08T11:09:43-05:00","created_at":"2025-01-02T11:09:43-05:00","updated_at":"2025-01-02T11:20:24-05:00","entitled_product_ids":[],"entitled_variant_ids":[],"entitled_collection_ids":[],"entitled_country_ids":[],"prerequisite_product_ids":[],"prerequisite_variant_ids":[],"prerequisite_collection_ids":[],"customer_segment_prerequisite_ids":[],"prerequisite_customer_ids":[],"prerequisite_subtotal_range":null,"prerequisite_quantity_range":null,"prerequisite_shipping_price_range":null,"prerequisite_to_entitlement_quantity_ratio":{"prerequisite_quantity":null,"entitled_quantity":null},"prerequisite_to_entitlement_purchase":{"prerequisite_amount":null},"title":"WINTER SALE","admin_graphql_api_id":"gid://shopify/PriceRule/507328175"}}
```
## Retrieves a single price rule

Retrieves a single price rule

### Endpoint
/admin/api/#{api_version}/price_rules/{price_rule_id}.json (GET)

### Parameters
* api_version (required): 
* price_rule_id (required): 

### Responses
#### 200
Retrieves a single price rule

Examples:
##### Retrieve a single price rule by its ID
Request:
```
GET /admin/api/unstable/price_rules/507328175.json
```

Response:
```
HTTP/1.1 200 OK
{"price_rule":{"id":507328175,"value_type":"fixed_amount","value":"-10.0","customer_selection":"all","target_type":"line_item","target_selection":"all","allocation_method":"across","allocation_limit":null,"once_per_customer":false,"usage_limit":null,"starts_at":"2024-12-27T11:09:43-05:00","ends_at":"2025-01-08T11:09:43-05:00","created_at":"2025-01-02T11:09:43-05:00","updated_at":"2025-01-02T11:09:43-05:00","entitled_product_ids":[],"entitled_variant_ids":[],"entitled_collection_ids":[],"entitled_country_ids":[],"prerequisite_product_ids":[],"prerequisite_variant_ids":[],"prerequisite_collection_ids":[],"customer_segment_prerequisite_ids":[],"prerequisite_customer_ids":[],"prerequisite_subtotal_range":null,"prerequisite_quantity_range":null,"prerequisite_shipping_price_range":null,"prerequisite_to_entitlement_quantity_ratio":{"prerequisite_quantity":null,"entitled_quantity":null},"prerequisite_to_entitlement_purchase":{"prerequisite_amount":null},"title":"SUMMERSALE10OFF","admin_graphql_api_id":"gid://shopify/PriceRule/507328175"}}
```
## Remove an existing PriceRule

Deletes a price rule

### Endpoint
/admin/api/#{api_version}/price_rules/{price_rule_id}.json (DELETE)

### Parameters
* api_version (required): 
* price_rule_id (required): 

### Responses
#### 204
Remove an existing PriceRule

Examples:
##### Delete a price rule
Request:
```
DELETE /admin/api/unstable/price_rules/507328175.json
```

Response:
```
HTTP/1.1 204 No Content

```
## Retrieves a count of all price rules

Retrieves a count of all price rules.

### Endpoint
/admin/api/#{api_version}/price_rules/count.json (GET)

### Parameters
* api_version (required): 

### Responses
#### 200
Retrieves a count of all price rules

Examples:
##### Retrieve a count of all price rules
Request:
```
GET /admin/api/unstable/price_rules/count.json
```

Response:
```
HTTP/1.1 200 OK
{"count":2}
```