MageSmith
POSTSalesRule · Magento 2.4.9 Admin · Magento_SalesRule::quote

POST /V1/coupons/generate

POST /V1/coupons/generate is a Magento 2 REST endpoint in the SalesRule module. Generate coupon for a rule. Requires an admin Bearer token with ACL Magento_SalesRule::quote.

Last verified: against Magento 2.4.9.

Returns

string[]

Service contract

Magento\SalesRule\Api\CouponManagementInterface::generate

Authorization

Admin Bearer token with ACL:

  • Magento_SalesRule::quote

Body parameters

couponSpec Magento\SalesRule\Api\Data\CouponGenerationSpecInterface 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/coupons/generate

Body

{
  "couponSpec": {
    "delimiter": "",
    "delimiter_at_every": 0,
    "extension_attributes": {},
    "format": "",
    "length": 0,
    "prefix": "",
    "quantity": 0,
    "rule_id": 0,
    "suffix": ""
  }
}

Every Magento dev tool, in one hosted workspace.

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