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
The unique identifier of a promotion.
Header Parameters
The Bearer token required to get access to the API.
- application/json
Body
required
Must be set to promotion_job
.
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.
Possible values: <= 50 characters
Represents the name of the job. The maximum allowed length is 50.
parameters object
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.
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.
Possible values: [per_item
, per_cart
]
Specifies whether the usage limitation is at the item-level or cart-level.
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.
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
- 201
Promotion job created
- application/json
- Schema
- Example (from schema)
Schema
data object
A unique ID generated when a job is created.
Always promotion_job
.
A unique ID of a promotion.
The type of job you want to run. For example, code_generate
to generate codes or code_export
to export codes.
The name of the job. The maximum length allowed is 50 characters.
The status of the job. See Overview.
meta object
timestamps object
The creation date of the job.
The last updated date of the job.
{
"data": {
"id": "string",
"type": "promotion_job",
"promotion_id": "string",
"job_type": "string",
"name": "string",
"parameters": {},
"status": "string",
"meta": {
"timestamps": {
"created_at": "2024-07-29T15:51:28.071Z",
"updated_at": "2024-07-29T15:51:28.071Z"
}
}
}
}