Need help with your APIs? I offer API discovery, governance & evangelism services. Explore services →
API Evangelist API Evangelist
Discovery
Learnings
Guidance
Toolbox
Alignment
API Evangelist LLC

Elastic Path Promotion Codes API

You can apply promotions automatically to all customer carts, or you can create promotion codes that customers must enter to receive the discount. You can enable this feature by setting the automatic attribute to `false` in the promotions schema when you create a promotion. For more information, see [Create Promotion Codes](/docs/api/promotions/create-promotion-codes).You can generate and export codes for a promotion using the bulk code generation feature, which allows you to create a large number of unique codes and export them in CSV format. For details, refer to the [Generating Bulk Codes](/docs/commerce-manager/promotions-standard/overview#generating-bulk-codes) and [Managing Export Codes](/docs/commerce-manager/promotions-standard/overview#managing-code-export) sections.You can generate a maximum of 1000 codes for a promotion. If you need to generate more than 1000 codes, limit the promotion's duration to a maximum of 365 days from its start date. The promotion expiry date is 365 days.With the consume unit feature, you can limit the number of usages of a code for a promotion. You must create a code for this promotion to track the usage of the promotion. The consume unit options are `per_cart` and `per_item`. For example, consider a store that offers 50% off on *SKU1*, but limits the promotion to a maximum of two usages. Under the `per_cart` setting, a shopper can buy *SKU1* twice in a separate transaction, each at a 50% discount. However, with the `per_item` setting, if a shopper buys two SKU1s in a single purchase, both items count toward the promotion's usage limit. Therefore, the shopper would use up both usages of the promotion in a single purchase.Promotion codes can be group codes or individual codes. For example, you can offer a seasonal discount to all customers, such as *SUMMER-SALE*, or you can offer preferred customers unique discount codes. Promotion codes expire automatically at the end of the promotion period and are removed from the promotion.When a promotion expires, the promotion codes attached to the promotion automatically become invalid. However, when you re-enable the expired promotion, the promotion codes attached to the promotion are deleted.When you checkout a cart with an expired promotion, the expired promotion will be automatically removed from a cart and the checkout process is initiated. As a best practice, we recommend to update your cart to remove the expired promotion before initiating the checkout process.When extending the end date of an expired promotion with over 1000 codes, you will receive an error response. See [Update a Promotion](/docs/api/promotions/update-a-promotion). In such cases, we recommend [duplicating the promotion](/docs/commerce-manager/promotions-standard/overview#duplicating-promotions), allowing you to set the new end dates and create promotion codes as needed.

Elastic Path Promotion Codes API is one of 100 APIs that Elastic Path publishes on the APIs.io network, described by a machine-readable OpenAPI specification.

Tagged areas include Promotion Codes. The published artifact set on APIs.io includes an OpenAPI specification and API documentation.

This API exposes 4 operations across 2 paths, and defines 39 schemas. It is described by OpenAPI 3.1.0, at version 25.1126.6886238.

Requests are made against 2 base URLs: https://useast.api.elasticpath.com, https://euwest.api.elasticpath.com.

4 operations 2 paths 39 schemas 2 DELETE1 GET1 POST

Metadata

The identity and technical contract details declared by the specification.

Specification
OpenAPI 3.1.0
API Version
25.1126.6886238
Base URL
https://useast.api.elasticpath.com
Authentication
HTTP Bearer
License
Resource Areas
1

Authentication & Security 1

Elastic Path Promotion Codes API declares 1 security scheme for authenticating requests. It accepts HTTP bearer tokens (BearerToken). By default, every request must be authenticated.

Paths & Operations 4

Across 2 paths, the API surfaces 4 operations — 2 DELETE, 1 GET, 1 POST. Each is listed below with its method, path, parameters, and response codes.

Promotion Codes 4

You can apply promotions automatically to all customer carts, or you can create promotion codes that customers must enter to receive the discount. You can enable this feature by s…

GET
/v2/promotions/{promotionID}/codes
Get Promotion Codes
getPromotionCodes 3 params → 200401
POST
/v2/promotions/{promotionID}/codes
Create Promotion Codes
createPromotionCodes 2 params body → 201401
DELETE
/v2/promotions/{promotionID}/codes
Delete Multiple Promotion Codes
deleteMultiplePromotionCodes 2 params → 204401404
DELETE
/v2/promotions/{promotionID}/codes/{code}
Delete a Promotion Code
deleteAPromotionCode 3 params → 204401404

Schemas 39

The contract defines 39 schemas that model the data the API accepts and returns. The most detailed are Data.BasePromotions (11 properties), Data.CodeResponse (6 properties), Response.PageLinks (5 properties), Data.CodeRequest (4 properties). Each schema is shown below with its type and property counts.

Data.AttributeObject
object
1 property
Data.FixedBundleDiscountPromotion
Data.XForAmountDiscountPromotion
Data.Promotions.Schema.Gifts
object
2 properties 1 required
Data.Promotions.Schema.TargetNodes
object
1 property
Data.Promotions.Schema.YValue
object
1 property 1 required
Data.Promotions.Schema.PercentageAndCurrencyArray
object
1 property 1 required
Data.Promotions.Schema.Currencies.AmountAndCurrency
object
2 properties 2 required
Data.ItemPercentDiscountPromotion
Data.Promotions.Schema.XValue
object
1 property 1 required
Response.PaginationPage
object
4 properties
Data.ItemFixedDiscountPromotion
Data.Promotions.Schema.Requirement
object
2 properties 2 required
Data.FreeGiftPromotion
Data.Promotions.Schema.AmountAndCurrencyArray
object
1 property 1 required
Data.Promotions.Schema.Currencies.PercentageAndCurrency
object
2 properties 2 required
Response.Error
array
3 properties
Data.CodeRequest
object
4 properties
Data.BasePromotions
object
11 properties 10 required
Data.Promotions.Schema.Exclude
object
1 property
Data.NodesObject
object
1 property
Data.Promotions.Schema.Percent
object
1 property 1 required
Data.PromotionsCodesRequest
object
2 properties
Response.Meta.Promotions
object
2 properties
Data.CartPercentDiscountPromotion
Data.PromotionsCodesObject
object
1 property
Data.PromotionsCodes
object
1 property
Data.CartFixedDiscountPromotion
Data.Promotions.Schema.TargetAttributes
object
1 property
Response.PaginationResults
object
1 property
Response.Data
object
Specifies the type of the resource. The type of resource for promotions is, promotioncodes.
1 property
Data.Promotions.Schema.Requirements
object
1 property 1 required
Response.PageLinks
object
5 properties
Data.Conditions
object
1 property
Data.Promotions.Schema.TargetCatalogs
object
1 property
Data.XForYDiscountPromotion
Data.Promotions.Schema.Targets
object
1 property
Data.PromotionObject
object
1 property 1 required
Data.CodeResponse
object
6 properties

Specification

The full machine-readable OpenAPI contract behind this narrative.

Source

elastic-path-promotion-codes-api-openapi.yml Raw ↑

Other APIs Elastic Path publishes across the network.

Elastic Path GraphQL API
Elastic Path Account Addresses API
Elastic Path Account Authentication Settings API
Elastic Path Account Cart Associations API
Elastic Path Account Management Authentication API
Elastic Path Account Members API
Elastic Path Account Membership API
Elastic Path Account Membership Settings API
Elastic Path Account Tags API
Elastic Path Accounts API
Elastic Path Administrator Latest Releases Catalog API API
Elastic Path Application Keys API