Requires read_price_rules access scope.
For more info, refer to:
GET https://{handle}.myshopline.com/admin/openapi/v20260301/sales/price_rules/:price_rule_id.json
handle : The store's unique identifier, which is the prefix of the store's domain name. For example, if a store's domain name is open001.myshopline.com , the store handle is open001 .
Get a price rule of discount code based on price rule ID. Supported code discount types include:
  • Fixed amount discount
  • Percentage discount
  • Buy X get Y discount
  • Free shipping discount
Path Parameters
  • price_rule_id string required
    The unique identifier for the price rule.
Request Headers
  • Content-Type string required
    The field must be set to the fixed value application/json; charset=utf-8.
  • Authorization string required
    The access token for the API resource. Refer to App authorization to obtain the access token, and then pass the obtained token in the Bearer format.
    Example:
    Bearer eyJhbGciOiJIUzUxMiJ9.eyJhcHBLZXkiOiJmMjM3OWQyMTYyOGMzM2QxMWRiMWZkYjY5N2EzZjdjMjZlNGMwYTA5Iiwic2VsbGVySWQiOiIyMDAwMjM0ODgwIiwic3RvcmVJZCI6IjE2NzIzNjk3Mjk2MDYiLCJ2ZXJzaW9uIjoiVjIiLCJkb21haW4iOiJodHRwczovL3NsLW9wZW4tc2cubXlzaG9wbGluZS5jb20iLCJ0aW1lc3RhbXAiOjE2NzUzMTk0OTI0MzksImlzcyI6Inlzb3VsIiwiZXhwIjoxNzY5OTI3NDkyfQ.UwQzomM2veGCUaOZ0paUxq5dpc7DXuhHYFvsQ_uIAKduzWcb_j2E4q_36El83sp145D4cKbpcE5KCeeIz-JNQw
Status Codes
For the complete list of codes and messages, see Http status code.

Response Headers
  • traceId
    A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise.
Response Body
  • price_ruleobject
    The price rule of a discount code.
  • allocation_limit string
    The maximum number of times the discount can be applied in a single order. Only applicable to Buy X Get Y discounts. Example: If the value of this parameter is 3, A Buy 1 hat Get 1 hat discount can be applied up to 3 times if more than 6 hats are in the cart. If null, there's no limit per order.
  • allocation_method string
    The allocation method of the price rule. Valid values are:
    • each: The discount is applied to each entitled item. For example, if the discount is $20 off, each entitled item will receive $20 off.
    • across: The discount is spread across all entitled items. For example, if the discount is $20 off, the discount will be applied across all the entitled items, totaling $20 off.
  • create_at string
    The date and time when the price rule was created.
    Format: ISO 8601.
    Example: 2021-08-31T02:20:26+08:00
  • ends_at string
    The date and time when the price rule ends. If null, the price rule has no end time.
    Format:ISO 8601.
    Example: 2023-08-31T02:20:26+08:00
  • entitled_collection_ids array
    A list of IDs of product collections entitled to the discount. If the discount is Buy X Get Y, this refers to the collections for product Y.
    Maximum size: 500
  • entitled_country_ids array
    A list of country or region IDs eligible for the discount. Only applicable to free shipping discount. If null, the discount applies to all countries or regions.
    Maximum size: 500
    Example: ["\"HK\",\"TW\",\"SG\""]
  • entitled_product_ids array
    A list of IDs of products that will be entitled to the discount. When the discount is Buy X Get Y, it indicates the list of the entitled products of product Y.
    Maximum size: 500
  • entitled_variant_idsobject[]
    A list of product variant IDs entitled to the discount. If the discount is Buy X Get Y, these are the variant IDs for product Y.
    Maximum size: 500
  • product_id string
    Product ID.
  • variant_id string
    Product variant ID.
  • id string
    The unique identifier for the price rule.
  • joint_discount boolean
    Whether the price rule combines with all automatic discounts.
    • true : The price rule combines with all automatic discounts.
    • false : The price rule does not combine with any automatic discounts.
  • joint_discount_order boolean
    Whether the price rule combines with order automatic discounts.
    • true : The price rule combines with order automatic discounts.
    • false : The price rule does not combine with any order automatic discounts.
  • joint_discount_product boolean
    Whether the price rule combines with product automatic discounts.
    • true : The price rule combines with product automatic discounts.
    • false : The price rule does not combine with any product automatic discounts.
  • joint_discount_shipping boolean
    Whether the price rule combines with shipping automatic discounts.
    • true : The price rule combines with shipping automatic discounts.
    • false : The price rule does not combine with any shipping automatic discounts.
  • overlay_discount_code boolean
    Whether the price rule combines with all discount codes.
    • true : The price rule combines with all discount codes.
    • false : The price rule does not combine with any discount codes.
  • overlay_discount_code_order boolean
    Whether the price rule combines with order discount codes.
    • true : The price rule combines with order discount codes.
    • false : The price rule does not combine with order discount codes.
  • overlay_discount_code_product boolean
    Whether the price rule combines with product discount codes.
    • true : The price rule combines with product discount codes.
    • false: The price rule does not combine with product discount codes.
  • overlay_discount_code_shipping boolean
    Whether the price rule combines with shipping discount codes.
    • true : The price rule combines with shipping discount codes.
    • false : The price rule does not combine with shipping discount codes.
  • prerequisite_collection_ids array
    If the discount is Buy X Get Y, this field specifies the collection ID list for product X.
    Maximum size: 500
  • prerequisite_customer_ids array
    A list of IDs of customers that can use the discount.
    Maximum size: 500
  • prerequisite_product_ids array
    If the discount is Buy X Get Y, this field specifies the product ID list for product X.
    Maximum size: 500
  • prerequisite_quantity_rangeobject
    The minimum quantity of items for the price rule to be applicable.
  • greater_than_or_equal_to integer
    The minimum quantity of items required. If null, no minimum quantity is required.
  • prerequisite_saved_search_ids array
    A list of IDs of customer segments that can use the discount.
    Maximum size: 500
  • prerequisite_shipping_price_rangeobject
    If the discount is for free shipping, this field defines the maximum shipping amount eligible for the discount.
  • less_than_or_equal_to string
    The maximum shipping price that qualifies for the discount.
  • prerequisite_subtotal_rangeobject
    The minimum subtotal that's required for the discount to be applied.
  • greater_than_or_equal_to string
    The minimum required subtotal.
  • prerequisite_to_entitlement_purchaseobject
    For Buy X Get Y discounts, defines the minimum total amount of product X required to apply the discount.
  • prerequisite_amount string
    The minimum required subtotal of X products.
  • prerequisite_to_entitlement_quantity_ratioobject
    Defines the Buy X Get Y ratio for the discount, including the minimum quantity of product X required to apply the discount and the number of product Y being discounted.
  • entitled_quantity integer
    The number of product Y being discounted.
  • prerequisite_quantity integer
    The minimum required quantity of product X.
  • prerequisite_variant_idsobject[]
    If the discount is Buy X Get Y, this field specifies the variant ID list for product X.
    Maximum size: 500
  • product_id string
    Product ID.
  • variant_id string
    Product variant ID.
  • recurring_cycle_limit integer
    Number of subscription billing cycles the discount applies to.
    This field is applicable only to the following types of discounts: order discount codes, product discount codes, and free shipping discount codes.
    For example: If the value of this parameter is 3, the discount will apply to the first three billing cycles of the subscription. If the value of this parameter is 1, the discount will only apply to the initial subscription order. If the value of this parameter is -1, the discount will apply to all recurring payments in the subscription.
    Example: -1
  • sales_channels array
    The sales channels eligible for the discount. When sales_channels is all, the discount applies to all sales channels. If sales_channels specifies certain channels, the discount is only valid on those channels.
    Example: ["web"]
  • starts_at string
    The date and time when the price rule starts.
    Format: ISO 8601.
    Example: 2021-08-31T02:20:26+08:00
  • target_selection string
    The product scope to which the price rule applies. Valid values are:
    • all: Applies to all products
    • entitled: Applies to selected products only
  • target_type string
    The target type that the price rule applies to. Valid values:
    • line_item: The price rule applies to the line items.
    • shipping_line: The price rule applies to the shipping line.
  • title string
    The title of the price rule, used for display to the buyer.
  • update_at string
    The date and time when the price rule was updated.
    Format: ISO 8601.
    Example: 2021-08-31T02:20:26+08:00
  • usage_limit integer
    The maximum number of times that the discount codes can be used. If null, usage is unlimited.
  • usage_per_customer integer
    The maximum number of times each customer can use each discount code under this price rule. If null, usage is unlimited.
  • value string
    The value of the price rule. If value_type is percentage, then value indicates the percentage value of the discount. If value_type is fixed_amount, then value indicates the amount value of the discount.
  • value_type string
    Defines how the discount is applied. Valid values are:
    • percentage:A discount that gives customers a percentage off.
    • fixed_amount:A discount that gives customers a fixed amount off.
API Explorer
https://openapiceshidianpu.myshopline.com/admin/openapi/v20260301

ParamOptions

path required
header required

Language

curl --request GET \
--url https://openapiceshidianpu.myshopline.com/admin/openapi/v20260301/sales/price_rules/price_rule_id.json \
--header 'Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJhcHBLZXkiOiJmMjM3OWQyMTYyOGMzM2QxMWRiMWZkYjY5N2EzZjdjMjZlNGMwYTA5Iiwic2VsbGVySWQiOiIyMDAwMjM0ODgwIiwic3RvcmVJZCI6IjE2NzIzNjk3Mjk2MDYiLCJ2ZXJzaW9uIjoiVjIiLCJkb21haW4iOiJodHRwczovL3NsLW9wZW4tc2cubXlzaG9wbGluZS5jb20iLCJ0aW1lc3RhbXAiOjE2NzUzMTk0OTI0MzksImlzcyI6Inlzb3VsIiwiZXhwIjoxNzY5OTI3NDkyfQ.UwQzomM2veGCUaOZ0paUxq5dpc7DXuhHYFvsQ_uIAKduzWcb_j2E4q_36El83sp145D4cKbpcE5KCeeIz-JNQw' \
--header 'Content-Type: application/json; charset=utf-8' \
--header 'accept: application/json'
Examples
Get a price rule of a code discount
Response
{
"price_rule": {
"allocation_method": "across",
"create_at": "2023-07-12T01:25:37+08:00",
"entitled_country_ids": [],
"id": "6019132058521049481",
"joint_discount": false,
"joint_discount_order": false,
"joint_discount_product": false,
"joint_discount_shipping": false,
"overlay_discount_code": false,
"overlay_discount_code_order": false,
"overlay_discount_code_product": false,
"overlay_discount_code_shipping": false,
"prerequisite_subtotal_range": {
"greater_than_or_equal_to": "100.00"
},
"sales_channels": [
"all"
],
"starts_at": "2023-07-12T01:25:37+08:00",
"target_selection": "all",
"target_type": "line_item",
"title": "Affiliate Distribution: Basic discount",
"update_at": "2023-07-12T01:25:37+08:00",
"value": "5",
"value_type": "percentage"
}
}
Was this article helpful to you?