younifyd
Menu

Post V2 Promotions Promotionid Jobs

Create a Promotion Job

POST/v2/promotions/{promotionID}/jobs

Use it in a workflow

  1. Add a step and choose the Elastic Path connector.
  2. Pick the Post V2 Promotions Promotionid Jobs action (under Promotions).
  3. Fill in the fields below, then reference the result from later steps as {{postV2PromotionsPromotionidJobs.response.data}}.

Request

Path parameters

promotionIDstringrequired

The unique identifier of a 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.

typestring

Must be set to `promotion_job`.

job_typestring

Specifies the type of task you want to run. For example, `code_generate` to generate codes or `code_export` to export codes.

One ofcode_generatecode_export

namestring

Represents the name of the job. The maximum allowed length is 50.

parametersobject
number_of_codesinteger

Specifies the number of codes to be generated. It cannot be greater than the maximum number of codes per promotion, which defaults at 1000.

max_uses_per_codeinteger

Specifies the maximum number of usages of a code. If set to zero, you cannot use this promotion. If no value is set, it can be used unlimited times.

consume_unitstring

Specifies whether the usage limitation is at the item-level or cart-level.

One ofper_itemper_cart

code_prefixstring

Indicates the prefix to include with the promotion code. For example, when the generated value is *aa2b-3c4d* and the prefix value is set as *summer*, the promotion code becomes *summer-aa2b-3c4d*.

code_lengthinteger

Specifies the code length, which ranges from 8 to 16 characters. The default code length is eight characters, and a dash is added after every four characters in the code. For example, *aa2b-3c4d*.

json
{
  "type": "promotion_job",
  "job_type": "code_generate",
  "name": "string",
  "parameters": {
    "number_of_codes": 0,
    "max_uses_per_code": 0,
    "consume_unit": "per_item",
    "code_prefix": "string",
    "code_length": 0
  }
}

Response

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

dataobject
idstring

A unique ID generated when a job is created.

typestring

Always `promotion_job`.

promotion_idstring

A unique ID of a promotion.

job_typestring

The type of job you want to run. For example, `code_generate` to generate codes or `code_export` to export codes.

namestring

The name of the job. The maximum length allowed is 50 characters.

parametersobject
statusstring

The status of the job. See [Overview](/docs/api/promotions/promotion-jobs).

metaobject1 fields
json
{
  "data": {
    "id": "string",
    "type": "promotion_job",
    "promotion_id": "string",
    "job_type": "string",
    "name": "string",
    "parameters": {},
    "status": "string",
    "meta": {
      "timestamps": {
        "created_at": "2025-01-01T00:00:00Z",
        "updated_at": "2025-01-01T00:00:00Z"
      }
    }
  }
}

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

Post V2 Promotions Promotionid Jobs — Elastic Path — Documentation