get https://{subdomain}.myshoplaza.com/openapi/2022-01/price_rules
Requires
price_rules
access scope. More access scope
The Price Rule List API retrieves a list of price rules that can be applied to customer orders.
This API is especially useful for:
- Fetching all active and inactive price rules in your store.
- Filtering price rules by specific criteria such as start date, end date, or usage count.
- Retrieving detailed configurations of discount rules for analysis or updates.
Request Parameters
Public Request Parameters
Query Parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
limit | int32 | No | Result per page. Maximum is 250 . Default is 50 . | 50 |
starts_at_min | int32 | No | Filter price rules that started after this date (Unix timestamp). | 1581152471 |
starts_at_max | int32 | No | Filter price rules that started before this date (Unix timestamp). | 1581152471 |
ends_at_min | int32 | No | Filter price rules that ended after this date (Unix timestamp). | 1581152471 |
ends_at_max | int32 | No | Filter price rules that ended before this date (Unix timestamp). | 1581152471 |
times_used | int32 | No | Filter price rules by the number of times they have been used. | 0 |
Response Explanation
Public Response Parameters
Successful Response
Field | Type | Example | Description |
---|---|---|---|
price_rules | array[object] | See below. | Array containing price rule objects. |
price_rules[].id | string | "91f9a466-7c8c-46e7-9774-64874a641534" | Unique identifier of the price rule. |
price_rules[].title | string | "Buy $180 get $20 off,once for one customer" | Title of the price rule. |
price_rules[].value | double | 20 | Value of the discount. |
price_rules[].value_type | string | "fixed_amount" | Type of the discount value. Options: percentage , fixed_amount . |
price_rules[].usage_limit | string | "100" | Maximum number of times the discount can be used. -1 means no limit. |
price_rules[].times_used | string | "0" | Number of times the discount has been used. |
price_rules[].allocation_method | string | "" | Allocation method for the discount. |
price_rules[].allocation_limit | string | "0" | Redeem count limit per checkout. 0 means no limit. |
price_rules[].once_per_customer | string | "1" | Indicates if the discount can be used only once per customer. "1" means yes. |
price_rules[].prerequisite | string | "1" | Indicates if the discount has prerequisites. "1" means yes. |
price_rules[].customer_selection | string | "all" | Specifies the customer selection for the discount. |
price_rules[].target_selection | string | "all" | Specifies the target product selection for the discount. |
price_rules[].target_type | string | "" | Specifies the type of target for the discount. |
price_rules[].created_at | string | "2022-06-17 15:00:03" | Timestamp of when the price rule was created. |
price_rules[].updated_at | string | "2022-06-17 15:00:03" | Timestamp of when the price rule was last updated. |
price_rules[].starts_at | string | "1655431200" | Start time of the discount (Unix timestamp). |
price_rules[].ends_at | string | "-1" | End time of the discount (Unix timestamp). |
price_rules[].entitled_product_ids | array[string] | [] | List of product IDs entitled for the discount. |
price_rules[].entitled_filter_ids | array[string] | [] | List of filter IDs entitled for the discount. |
price_rules[].entitled_filter_list | array[string] | [] | List of entitled filter data for the discount. |
price_rules[].variant_product_ids | array[string] | [] | List of variant product IDs entitled for the discount. |
price_rules[].prerequisite_subtotal_range | array[object] | See below. | Prerequisite for total amount range. |
price_rules[].prerequisite_subtotal_range[].greater_than_or_equal_to | string | "180" | Minimum subtotal value to qualify for the discount. |
price_rules[].prerequisite_subtotal_range[].value | string | "20" | Discount value applied. |
price_rules[].prerequisite_quantity_range | array[object] | See below. | Prerequisite for total quantity range. |
price_rules[].prerequisite_quantity_range[].greater_than_or_equal_to | string | "5" | Minimum quantity to qualify for the discount. |
price_rules[].prerequisite_quantity_range[].value | string | "20" | Discount value applied. |
Error Response
Error responses in the API can be represented using two different fields: errors
and error
. Both fields provide details about issues encountered during request processing. Below is an explanation of the fields with their respective examples and descriptions.
Field | Type | Example | Description |
---|---|---|---|
errors | Array | [ "invalid line_item id"] | A list of errors encountered during the request processing. |
Field | Type | Example | Description |
---|---|---|---|
error | String | "store is not active" | Indicates an error encountered during the process |
Error Detail
Status Code | Message | Possible Reason | Example Response |
---|---|---|---|
400 | Bad Request | Invalid input format or request structure (e.g., missing required fields or incorrect data types). | Bad Request |
Unauthorized | The request is missing valid authentication credentials or the credentials provided are invalid. | Unauthorized | |
422 | Limit must be an integer. | The limit provided is invalid. | Limit must be an integer. |
Starts At Min must be an integer. | The Starts At Min provided is invalid. | tarts At Min must be an integer | |
Starts At Max must be an integer | The Starts At Max provided is invalid. | Starts At Max must be an integer | |
Ends At Min must be an integer | The Ends At Min provided is invalid. | Ends At Min must be an integer | |
Times Used must be an integer. | The Times provided is invalid. | Times Used must be an integer |