MageSmith
POSTSalesRule · Magento 2.4.9 Admin · Magento_SalesRule::quote

POST /V1/salesRules

POST /V1/salesRules is a Magento 2 REST endpoint in the SalesRule module. Save sales rule. Requires an admin Bearer token with ACL Magento_SalesRule::quote.

Last verified: against Magento 2.4.9.

Returns

Magento\SalesRule\Api\Data\RuleInterface

Service contract

Magento\SalesRule\Api\RuleRepositoryInterface::save

Authorization

Admin Bearer token with ACL:

  • Magento_SalesRule::quote

Body parameters

rule Magento\SalesRule\Api\Data\RuleInterface Required

Example request

Auto-generated from the service contract — paste-ready against your store's /rest/default base. Replace the host, store code, ACL token, and any required values before running.

Headers

Accept
application/json
Content-Type
application/json
Authorization
Bearer <ACCESS_TOKEN> admin token with ACL: Magento_SalesRule::quote

Path

/V1/salesRules

Body

{
  "rule": {
    "action_condition": {
      "aggregator_type": "",
      "attribute_name": "",
      "condition_type": "",
      "conditions": [
        {}
      ],
      "extension_attributes": {},
      "operator": "",
      "value": null
    },
    "apply_to_shipping": false,
    "condition": {
      "aggregator_type": "",
      "attribute_name": "",
      "condition_type": "",
      "conditions": [
        {}
      ],
      "extension_attributes": {},
      "operator": "",
      "value": null
    },
    "coupon_type": "",
    "customer_group_ids": [
      {}
    ],
    "description": "",
    "discount_amount": 0,
    "discount_qty": 0,
    "discount_step": 0,
    "extension_attributes": {},
    "from_date": "",
    "is_active": false,
    "is_advanced": false,
    "is_rss": false,
    "name": "",
    "product_ids": [
      {}
    ],
    "rule_id": 0,
    "simple_action": "",
    "simple_free_shipping": "",
    "sort_order": 0,
    "stop_rules_processing": false,
    "store_labels": [
      {
        "extension_attributes": {},
        "store_id": 0,
        "store_label": ""
      }
    ],
    "times_used": 0,
    "to_date": "",
    "use_auto_generation": false,
    "uses_per_coupon": 0,
    "uses_per_customer": 0,
    "website_ids": [
      {}
    ]
  }
}

Every Magento dev tool, in one hosted workspace.

Free to sign up. Nothing to install. Drafts, audits, and projects saved across every tool.