Elastic Path Rule Promotion Jobs API
The Rule Promotion Jobs API from Elastic Path — 3 operation(s) for rule promotion jobs.
The Rule Promotion Jobs API from Elastic Path — 3 operation(s) for rule promotion jobs.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/elastic-path-rule-promotion-jobs-api"
curl "https://apis.io/api/v1/apis?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Rule Promotions Rule Promotion Jobs API
description: "Rule Promotions provide the flexibility to offer diverse discounts to shoppers. This functionality supports discounts of varying complexities, from code-based customer discounts, to \"Buy X Get Y\" scenarios, fixed price promotions, and more based on your business needs.\n\nYou can create a Rule Promotion using the Rule Promotions API or through the Promotions Builder in Commerce Manager.\n\nTo apply Rule Promotions in carts and orders across an entire store, please enable the `use_rule_promotions` configuration in Cart Settings. You can also update a specific cart to use Rule Promotions by updating the cart's specific discount settings. Please see [Update A Cart](/docs/api/carts/update-a-cart) for more details. \n\nEnabling Rule Promotions enacts Hybrid Mode, allowing simultaneous use of both Promotions Standard and Rule Promotions discounts.\n\nFor example, let's say a store provides the following promotions:\n- A Promotions Standard discount for 10% off the shopping cart\n- A Rule Promotion offering for a 20% discount on the shopping cart\n\nIf a cart qualifies for both discounts based on the respective eligibility criteria, the system applies both types of discounts to the shopping cart, starting with Promotions Standard definitions before applying Rule Promotions. In this case, the application results in a 10% discount from the Promotions Standard definition and a 20% discount from the Rule Promotion. \n\n### Rule Set\nA rule set is the criteria that determine when and how promotions get applied. Rule Sets consist of rule conditions and corresponding actions, which define eligibility and application details, respectively. Rule Sets may also contain targeted catalogs and currencies for further application granularity.\n\n**Example**\nBuy an apple, get an orange 50% off.\n\nHere, buying an apple is the rule and the 50% discount on an orange is the action.\n\n#### Rules\nRules describe the conditions necessary for promotion eligibility. \n\nIn our apple-orange example above, the rule indicates the shopper must buy an apple to get the discount on an orange. In other words, the buying of an apple is the condition which determines eligibility for the corresponding discount.\n\n**Condition Architecture:**\nAll conditions follow a consistent structure with three primary components: - **`strategy`**: Defines the type of condition (e.g., `cart_total`, `item_category`) - **`operator`**: Specifies how the condition is evaluated (e.g., `gte`, `in`, `contains_all`) - **`args`**: Contains the values to evaluate against\nSome conditions support additional components for complex scenarios: - **`children`**: Sub-conditions that provide additional specificity - **`condition`**: Used in actions to define item-specific restrictions\n\n**Condition Categories:** - **Cart-level**: Evaluate entire cart properties (total, custom attributes) - **Account-level**: Consider customer account characteristics (tags, segments) - **Item-level**: Target specific products, categories, or attributes - **Bundle conditions**: Complex multi-item requirements for \"Buy X, Get Y\" scenarios - **Logical operators**: AND/OR logic for sophisticated eligibility rules\n\n**Key Design Considerations:** - **Performance**: Order conditions from most to least restrictive for optimal evaluation - **Maintainability**: Use `item_identifier` instead of legacy `item_sku`/`item_product_id` strategies - **Complexity**: Limit nesting depth and consider evaluation costs for complex bundle conditions - **Business Logic**: Ensure condition combinations align with promotion goals and margin requirements\n\n#### Actions\nActions describe how discounts apply to eligible carts and orders. These signify the discount type, level, configurations, and any limitations or restrictions when applying.\n\nActions can also include:\n- Action conditions: specify which items should be included or excluded when applying the discounts. These can be based on factors such as item SKUs, product attributes, quantities, or categories.\n- Action limitations: impose restrictions on the number of products eligible for discounts, maximum discount amounts, and/or total applications for discounts.\n\nIn the apple-orange example, the action denotes the system applies a 50% discount to an orange, assuming the eligibility rules are met. For more complex scenarios, the action might say to provide a 50% discount on up to three oranges or might provide a fixed $1 discount on the two most expensive items from the \"fruit\" category.\n\n:::note\n\nFor promotions that include a mix of item and cart rules or actions, we recommend including the specific item conditions in all item strategies to ensure desired discount applications.\n\nFor complex promotions in general, we recommend including specific item conditions on all item strategies to ensure the appropriate items receive discounts. Please see the [Create a Rule Promotion API Request Examples](/docs/api/promotions-builder/create-rule-promotion) for more details on specifying conditions, restrictions, and inclusions.\n\n:::\n\n#### Action Limitations\nAction limitations define constraints or rules that govern how a promotion's action is applied. While actions specify what discount is given (e.g., 10% off the cart), limitations control how much, to which items, and under what circumstances that action is applied.\nLimitations include:\n - **`max_discount`**: Caps the total value of the discount.\n - **`max_quantity`**: Limits the number of discounted units per item.\n - **`items`**: Restricts how many and which items are eligible, and in what order (e.g., max_items, price_strategy).\n - **`max_items`**: Specifies the maximum number of items eligible for the discount.\n - **`price_strategy`**: Determines how eligible items are selected based on price:\n - **Cheapest (default)**: The discount is applied to the cheapest item(s) in the cart.\n - **Expensive**: The discount applies to the most expensive item(s) in the cart.\n Some limitations, like auto_add, influence the application behavior of the action rather than its scope.\n - **`auto_add`**: Automatically adds items to the cart once conditions are met, \n providing additional configuration for the promotion’s application mode.\n - **`show_suggestions`**: A flag indicating whether to show suggestions for eligible items in the cart \n if the item is not in the cart. \n\nIn this way, limitations can affect either the scope of the discount or the manner in which it is applied, providing both technical and user-facing boundaries around a promotion’s behavior.\nFor example, consider a **50% discount on items from a category**, with the following limitations:\n - **Applies to a maximum of two items (`max_items: 2`)**\n - **Only applies to the two cheapest eligible items (`price_strategy: cheapest`)**\n - **Limits the total discount to $10 (`max_discount: 1000`)**\n - **Ensures a maximum of two units per eligible item receive the discount (`max_quantity: 2`)**\n\n#### Catalogs and Currencies\nAs part of the Rule Set, you can also specify the catalogs and currencies for a given Rule Promotion. \n\nWith catalogs defined, the promotion only considers items from the identified catalogs and therefore will not consider custom items or items from other catalogs. With no catalogs defined, the promotion considers all items, including custom items.\n\nSpecifying a currency for a Rule Promotion restricts it to carts using that currency. Rule Promotions support multiple currencies when using a percent discount. If no currencies are defined, the discount applies to carts in any currency.\n\n### Building Blocks\n\n#### Strategies\nStrategies describe the types of condition criteria or application actions used to build a promotion. A given promotion can be comprised of several strategies in its rules and actions. These might include several instances of similar strategies, different strategies, or some combination thereof. Think of these as building blocks that can be applied together to provide a functional discount.\n\n- Rule strategies define the types of conditions that need to be met for eligibility. These might include cart total amount, item prices, cart custom attributes, and more.\n- Action strategies refer to the type of action execution run when the eligibility criteria are met. For actions, the possible strategies are `cart_discount`, `item_discount`, `item_bundle_discount` and `shipping_discount`. For more information, please see [Promotions Builder API Overview](/docs/promotions-builder/promotions-builder-api/promotions-builder-api-overview).\n#### Operators and Args\nOperators determine how to evaluate a given strategy, while `args` define the value threshold to measure against. For example, please consider the following condition strategy:\n\n```\n{\n \"strategy\": \"cart_total\",\n \"operator\": \"gte\",\n \"args\": [ 10000 ]\n}\n```\n\nIn this example, the strategy is `cart_total`, telling the system to assess eligibility based on the total cart value. The operator is a greater-than-or-equal-to (`gte`) evaluation, indicating the candidate value (in this case, cart total) becomes eligible once it reaches or exceeds the threshold. Finally, the `args` value provides the threshold value to compare against, 10000. Taken together, then, this strategy looks for cart totals greater than or equal to 10000.\n\n::: note Different strategies support different operators. For more information, please see [Rule Promotions API Overview](/docs/promotions-builder/promotions-builder-api/promotions-builder-api-overview). :::\n#### Children and Sub-Conditions\nFor additional promotion granularity, some strategies support additional specifications via `children` and `condition` fields. \nThese fields contain strategies, which provide further specifications around their parent strategy evaluations. \nIn other words, sub-conditions refer to additional criteria or conditions that must be met for a particular promotion to be applied.\n\nThe following strategies support children/sub-conditions:\n- `item_price`\n- `item_quantity`\n- `item_category`\n- `item_attribute`\n- `and`\n- `or`\n\nNotably, when multiple sub-condition siblings exist, they are combined together, such that all sub-conditions must be met to fulfill eligibility.\n\n### Stacking\nPromotion stacking and priority are key elements in managing discounts, ensuring promotions are applied as intended. Stacking allows multiple promotions to be applied to a single cart, either targeting the same items or different ones. The `stackable` flag determines whether a promotion can stack with others, defaulting to `true`. If set to `false`, no other promotion can stack on top, and the highest-priority promotion takes precedence. \n\nPriority settings dictate the order in which promotions are applied, with higher numbers indicating higher priorities. By default, promotions without assigned priorities are applied in reverse order of creation, with newer promotions applied first and calculated against any existing discounted prices.\n\nHybrid Mode enables the coexistence of Standard Promotions and those configured in the Promotions Builder, with each functioning independently. This means Standard Promotions can stack alongside non-stackable Builder promotions, and their stackability and priority settings remain unaffected by Standard Promotions.\n\nOverride stacking, set using the `override_stacking` flag, provides an additional layer of control over how promotions interact. This flag determines whether the promotion can stack with other promotions that are typically non-stackable and defaults to `false` when not set. When set to `true`, the promotion can stack with promotions configured as non-stackable, unless those non-stackable promotions also override stacking.\n\n### Shipping\nRule Promotions support shipping discounts, identified by the corresponding strategies during promotion creation. Shipping discounts apply to shipping group base prices and do not impact shipping taxes or configured shipping fees. Please see [Shipping Groups](/docs/ship-groups/shipping-groups/index) for more information on creating and interacting with shipping groups.\n\n### Items Bundle\nYou can promote and discount groups of items together using the `items_bundle` rule strategy and the `items_bundle_discount` action strategy. When these strategies are applied, the cart must contain items that meet all specified criteria to qualify for the discount.\n- The `items_bundle` rule strategy defines the required group of items for discount eligibility.\n- The `items_bundle_discount` action strategy specifies how the discount is applied to the qualifying group.\n- The `items_bundle` strategy requires **at least one** requirement that defines which items are eligible. Bundle items can be mixed across categories or attributes to form a valid bundle.\n- The `item_quantity` can be used with any of the bundling strategies, including `item_category`, `item_identifier`, `item_attribute`, etc.\n - `item_quantity` only support `eq` operator when configuring `items_bundle` strategy.\n - For instance, targeting a category with `item_quantity` with operator `eq` 2 means any two items from that category can form a bundle. The system will prioritize individual line items with sufficient quantity first before combining quantities of separate line items.\n```\n{\n \"strategy\": \"items_bundle\",\n \"children\": [\n {\n \"strategy\": \"and\",\n \"children\": [\n {\n \"strategy\": \"item_category\",\n \"operator\": \"in\",\n \"args\": [\n \"667d9fae-d8c7-4941-b556-70cb4b8612f1\"\n ]\n },\n {\n \"strategy\": \"item_quantity\",\n \"operator\": \"gte\",\n \"args\": [\n 2\n ]\n }\n ]\n }\n ]\n}\n```\n- When using `item_quantity` to target specific items or categories, the required quantity can be fulfilled by a combination of eligible items.\n - For example, if the rule is `item_quantity` with operator `eq` 3 for products in the \"Office Supplies\" category, the discount will apply when the cart includes any of the following combinations:\n - 2 packs of printer paper + 1 box of pens\n - 1 stapler + 2 notepad\n - 1 box of pens + 1 notepad + 1 pack of printer paper\n - 3 identical items, such as 3 boxes of pens\n\n - **Please Note**: the system considers line items sequentially based on their quantities, using the order of addition to the cart as a fallback tie-breaker. If the first eligible item has sufficient quantity to fulfill the bundle criteria, it will consume the required quantity and complete the evaluation for that criteria. The system does not re-evaluate these processed items to share any remaining quantities with other items. This behaviour may result in differing total discount amounts for two shopping carts with the same items added in a different order if those items have the same quantity values.\n\nAvailable discount types:\n - `fixed_price` – Sets a fixed total price for the group (e.g., If the fixed price is set at $100, then the group's subtotal is exactly $100)\n - `percent` – Applies a percentage-based discount to the group.\n - `fixed` – Deducts a fixed amount from the group's total price.\n"
version: 26.0504.7552059
x-version-timestamp: 2026-05-04 17:39:21+00:00
contact:
name: Elastic Path
url: https://elasticpath.com
license:
name: MIT
url: assets/LICENSE
servers:
- url: https://useast.api.elasticpath.com
description: US East Production Server
variables: {}
- url: https://euwest.api.elasticpath.com
description: EU West Production Server
variables: {}
tags:
- name: Rule Promotion Jobs
paths:
/v2/rule-promotions/{uuid}/jobs:
post:
operationId: createRulePromotionJob
summary: Create a Rule Promotion Job
description: 'Creates an asynchronous job for a specific Rule Promotion. Jobs are used to generate or export promotion codes in bulk.
The following job types are supported:
- **`code_generate`**: Generates a batch of unique promotion codes.
- **`code_export`**: Exports all existing promotion codes as a downloadable CSV file.
Job processing occurs asynchronously. The job request is queued, and its status must be checked separately.
### Job Processing Status
Jobs can have the following statuses:
- `pending`: Job is in the queue, waiting to be processed.
- `processing`: Job is actively being processed.
- `completed`: Job completed successfully.
- `failed`: Job encountered an error and did not complete.
- `cancelling`: Cancellation in progress (for long-running jobs).
- `cancelled`: Job was successfully cancelled.
Please refer to the **OpenAPI examples** section on this page for sample job creation requests.
'
tags:
- Rule Promotion Jobs
parameters:
- name: uuid
in: path
required: true
schema:
type: string
description: The unique identifier of the rule promotion.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/PromotionJob'
examples:
GenerateBulkPromotionCodes:
summary: Create a Job to Generate 100 Bulk Promotion Codes
description: "Create an asynchronous job to generate **100 unique promotion codes** with specific parameters.\n\n- The `job_type` is `\"code_generate\"`, meaning this job will generate new promotion codes.\n- The `parameters` field defines:\n - `number_of_codes: 100`, meaning **100 unique codes will be generated**.\n - `max_uses_per_code: 1`, restricting **each code to a single use**.\n - `consume_unit: per_checkout`, meaning **each code is consumed once per successful checkout**.\n - `code_prefix: \"summer-\"`, ensuring that **each generated code starts with \"summer-\"**.\n - `code_length: 8`, specifying that **each code will have 8 characters after the prefix**.\n\n**Job Processing:**\n- The job will run asynchronously, and the status must be checked separately.\n- You can retrieve the job's status and results using the **Get Rule Promotion Jobs** endpoint.\n"
value:
data:
type: promotion_job
job_type: code_generate
name: Demo bulk code generate
parameters:
number_of_codes: 100
max_uses_per_code: 1
consume_unit: per_checkout
code_prefix: summer-
code_length: 8
ExportPromotionCodes:
summary: Create a Rule Promotion Job to Export All Promotion Codes
description: 'Create an asynchronous job to export all **existing promotion codes** as a downloadable CSV file.
**Job Processing:**
- The job runs asynchronously, and its status must be checked separately.
- Once the job completes, the exported file will be available for download.
- You can track the job''s status using the **Get Rule Promotion Jobs** endpoint.
'
value:
data:
type: promotion_job
job_type: code_export
name: Demo export codes
responses:
'201':
description: Promotion job created
content:
application/json:
schema:
type: object
description: Promotion job response
properties:
data:
$ref: '#/components/schemas/PromotionJobResponse'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
errors:
type: array
items:
type: object
properties:
status:
type: string
example: '400'
title:
type: string
example: Too many jobs
detail:
type: string
example: Only 1 pending or processing job is allowed per promotion.
examples:
TooManyJobsError:
summary: Error When Attempting to Create a Job While Another Job is Still Processing
description: 'This error occurs when a **new job is requested while another job is still pending or processing** for the same promotion.
'
value:
errors:
- status: '400'
title: Too many jobs
detail: Only 1 pending or processing job is allowed per promotion.
security:
- bearerAuth: []
get:
operationId: getRulePromotionJobs
summary: Get Rule Promotion Jobs
description: 'Retrieves a list of jobs associated with a specific rule promotion. Each job represents an asynchronous operation such as promotion code generation or export.
The response includes details such as:
- **Job type** (`code_generate` or `code_export`)
- **Job status** (`pending`, `processing`, `completed`, `failed`, `cancelling`, or `cancelled`)
- **Parameters used** (such as number of codes generated)
- **Results** (such as number of codes successfully generated or deleted)
### Filtering
You can filter jobs by:
- **Job Type** (`eq(job_type, code_export)`)
- **Status** (`eq(status, complete)`)
'
tags:
- Rule Promotion Jobs
parameters:
- name: uuid
in: path
required: true
schema:
type: string
description: The unique identifier of a rule promotion.
- name: filter
in: query
required: false
schema:
type: string
description: Specifies filter attributes.
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/PromotionJobsListResponse'
security:
- bearerAuth: []
/v2/rule-promotions/{uuid}/jobs/{job-uuid}/file:
get:
operationId: getRulePromotionJobFile
summary: Get Rule Promotion Code Exported File
description: 'Retrieves the exported promotion codes for a rule promotion job in a CSV format.
- The file contains the generated codes along with relevant metadata.
- This endpoint is applicable only for jobs of type `code_export`.
- The job must be in a `completed` state before the file can be retrieved.
'
tags:
- Rule Promotion Jobs
parameters:
- name: uuid
in: path
required: true
schema:
type: string
description: The unique identifier of the rule promotion.
- name: job-uuid
in: path
required: true
schema:
type: string
description: The unique identifier of the job associated with the file.
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/PromotionCodeExportedFileResponse'
security:
- bearerAuth: []
/v2/rule-promotions/{uuid}/jobs/{job-uuid}/cancel:
post:
operationId: cancelRulePromotionJob
summary: Cancel a Rule Promotion Job
description: 'Cancels an asynchronous job for a rule promotion if its status is `pending` or `processing`.
- Only jobs that have not yet completed can be canceled.
- Once canceled, no further processing occurs, and partially completed results may be deleted.
'
tags:
- Rule Promotion Jobs
parameters:
- name: uuid
in: path
required: true
schema:
type: string
description: The unique identifier of the rule promotion.
- name: job-uuid
in: path
required: true
schema:
type: string
description: The unique identifier of the job to be canceled.
responses:
'200':
description: Successfully Canceled the Rule Promotion Job
content:
application/json:
schema:
type: object
description: Promotion job response
properties:
data:
$ref: '#/components/schemas/PromotionJobResponse'
examples:
PromotionJobCancellingResponse:
summary: Successful Cancellation Request for a Rule Promotion Job
description: 'This response indicates that the **job cancellation request was successfully submitted**, and the job is now in the `"cancelling"` state.
- The job has entered the **cancelling state**, meaning the system is stopping it.
- To check the job''s final status, use the **Get Rule Promotion Jobs** endpoint.
- If the job successfully cancels, it will transition to `"cancelled"`.
- If cancellation fails (e.g., the job completes before being stopped), it may remain `"completed"`.
'
value:
data:
type: promotion_job
id: 9bc1391c-1b65-419e-940e-66ed86c07001
rule_promotion_id: 8c150382-b258-4c88-a2d4-b9ea0be74a07
job_type: code_generate
name: Demo bulk code generate
parameters:
number_of_codes: 100
max_uses_per_code: 1
consume_unit: per_checkout
code_prefix: summer-
code_length: 8
status: cancelling
meta:
timestamps:
created_at: '2024-12-03T23:31:40.962680423Z'
updated_at: '2024-12-03T23:31:40.962680423Z'
'422':
description: Unprocessable Entity
content:
application/json:
schema:
type: object
properties:
errors:
type: array
items:
type: object
properties:
status:
type: string
example: '422'
title:
type: string
example: Unprocessable Entity
detail:
type: string
example: Only pending or processing jobs can be cancelled.
examples:
CannotCancelCompletedJobError:
summary: Error When Attempting to Cancel a Job That Is Not Pending or Processing
description: 'This error occurs when a **job cancellation request** is made for a job that **is not in a `pending` or `processing` state**.
**Possible Causes:**
- Attempting to cancel a job that has already **completed**, **failed**, or was **previously cancelled**.
- The job may have already transitioned out of `pending` or `processing` by the time the request was made.
'
value:
errors:
- status: '422'
title: Unprocessable Entity
detail: Only pending or processing jobs can be cancelled.
security:
- bearerAuth: []
components:
schemas:
PromotionCodeExportedFileResponse:
type: object
description: Successful response
properties:
href:
type: string
description: URL to download the CSV file.
PromotionJobResponse:
allOf:
- $ref: '#/components/schemas/PromotionJob'
- type: object
properties:
status:
description: The status of the job.
type: string
enum:
- pending
- processing
- completed
- failed
- cancelling
- cancelled
x-enumDescriptions:
pending: Commerce Cloud has received the request but is currently busy processing other requests.
processing: Commerce Cloud has initiated processing the job.
completed: The job is successfully completed.
failed: The job has failed.
cancelling: The job is currently in the process of being canceled. You need to wait for the cancellation process to complete.
cancelled: The job request is canceled.
error:
description: The error encountered during job execution, if applicable.
type: string
meta:
type: object
properties:
timestamps:
type: object
properties:
created_at:
description: The creation date of the job.
type: string
format: date-time
updated_at:
description: The last updated date of the job.
type: string
format: date-time
result:
$ref: '#/components/schemas/GenerateResult'
PromotionJobsListResponse:
type: object
description: Successful response
properties:
data:
type: array
items:
$ref: '#/components/schemas/PromotionJobResponse'
links:
$ref: '#/components/schemas/PaginationLinks'
meta:
$ref: '#/components/schemas/PaginationMeta'
PaginationMeta:
type: object
properties:
page:
type: object
properties:
current:
type: integer
description: Current page number
limit:
type: integer
description: Number of items per page
offset:
type: integer
description: Offset from the first result
total:
type: integer
description: Total number of pages
results:
type: object
properties:
total:
type: integer
description: Total number of results
total_method:
type: string
description: Method used to calculate the total (e.g., 'exact')
GenerateResult:
type: object
description: 'Represents the result of a promotion job, including the number of generated and deleted promotion codes.
- `generated`: Total number of successfully generated codes.
- `deleted`: Number of codes that were deleted during job cancellation, if applicable.
'
properties:
generated:
type: integer
description: Number of successfully generated promotion codes.
example: 1000
deleted:
type:
- integer
- 'null'
description: Number of codes deleted due to job cancellation.
example: 50
PaginationLinks:
type: object
properties:
current:
type: string
format: uri
description: URL for the current page of results
first:
type: string
format: uri
description: URL for the first page of result
# --- truncated at 32 KB (34 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/elastic-path/refs/heads/main/openapi/elastic-path-rule-promotion-jobs-api-openapi.yml