younifyd
Menu

Create coupons/generate

Create coupons/generate

POST/V1/coupons/generate

Use it in a workflow

  1. Add a step and choose the Adobe Commerce connector.
  2. Pick the Create coupons/generate action (under Promotions).
  3. Fill in the fields below, then reference the result from later steps as {{createCouponsGenerate.response.data}}.

Request

Request body

Enter the body as JSON in the step's Body field.

couponSpecobjectrequired

CouponGenerationSpecInterface

rule_idintegerrequired

The id of the rule associated with the coupon

formatstringrequired

Format of generated coupon code

quantityintegerrequired

Of coupons to generate

lengthintegerrequired

Length of coupon code

prefixstring

The prefix

suffixstring

The suffix

delimiter_at_everyinteger

The spacing where the delimiter should exist

delimiterstring

The delimiter

extension_attributesobject

ExtensionInterface class for @see \Magento\SalesRule\Api\Data\CouponGenerationSpecInterface

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

Response

Returns 200 with a array<string>. Read it in later steps with {{createCouponsGenerate.response.data.<field>}}.

Need more? See the Adobe Commerce guide for connection setup and behaviour shared by every action.

Create coupons/generate — Adobe Commerce — Documentation