younifyd
Menu

Create Rule Promotion Codes

Create Rule Promotion Codes

POST/v2/rule-promotions/{promotionID}/codes

Use it in a workflow

  1. Add a step and choose the Elastic Path connector.
  2. Pick the Create Rule Promotion Codes action (under Promotions Builder).
  3. Fill in the fields below, then reference the result from later steps as {{createRulePromotionCodes.response.data}}.

Request

Path parameters

promotionIDstringrequired

The unique identifier of the rule promotion.

Headers

Authorizationstring (Bearer)required

The Bearer token required to get access to the API.

Request body

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

dataobject
typestring
codesarray<object>6 fields

Specifies the code details in an array of objects.

json
{
  "data": {
    "type": "string",
    "codes": [
      {
        "code": "string",
        "uses": 0,
        "user": "string",
        "consume_unit": "per_application",
        "max_uses_per_shopper": {
          "max_uses": 0,
          "includes_guests": false
        },
        "is_for_new_shopper": false
      }
    ]
  }
}

Response

Returns 201 with an object. Read it in later steps with {{createRulePromotionCodes.response.data.<field>}}.

dataarray<object>
idstring (uuid)
typestring
codestring
usesinteger
userstring
consume_unitstring

One ofper_applicationper_checkout

max_usesinteger
max_uses_per_shopperobject2 fields

Object for setting max uses per shopper. Only include this object, when you want to set limit per shopper.

is_for_new_shopperboolean
messagesarray<object>
sourceobject2 fields

Information about the affected promotion codes.

titlestring

A brief title summarizing the message.

descriptionstring

A detailed explanation of the message.

json
{
  "data": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "type": "string",
      "code": "string",
      "uses": 0,
      "user": "string",
      "consume_unit": "per_application",
      "max_uses": 0,
      "max_uses_per_shopper": {
        "max_uses": 0,
        "includes_guests": false
      },
      "is_for_new_shopper": false
    }
  ],
  "messages": [
    {
      "source": {
        "type": "string",
        "codes": [
          "spring2024"
        ]
      },
      "title": "Duplicate code names",
      "description": "Code names duplicated in other promotions"
    }
  ]
}

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