Skip to main content

Create a Promotion Job

POST 

/v2/promotions/:promotionID/jobs

Use this endpoint to create an asynchronous job to generate codes and export promotion codes.

Request

Path Parameters

    promotionID stringrequired

    The unique identifier of a promotion.

Header Parameters

    Authorization Bearerrequired

    The Bearer token required to get access to the API.

Body

required
    type string

    Must be set to promotion_job.

    job_type string

    Possible values: [code_generate, code_export]

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

    name string

    Possible values: <= 50 characters

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

    parameters object
    number_of_codes integer

    Possible values: <= 1000

    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_code integer

    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_unit string

    Possible values: [per_item, per_cart]

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

    code_prefix string

    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_length integer

    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.

Responses

Promotion job created

Schema
    data object
    id string

    A unique ID generated when a job is created.

    type string

    Always promotion_job.

    promotion_id string

    A unique ID of a promotion.

    job_type string

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

    name string

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

    parameters object
    status string

    The status of the job. See Overview.

    meta object
    timestamps object
    created_at date-time

    The creation date of the job.

    updated_at date-time

    The last updated date of the job.

Loading...