Get Promotion Codes
GET/v2/promotions/:promotionID/codes
You can use this endpoint to retrieve promotion codes.
- The
codes.max_uses
attribute represents the maximum usage of the codes. - The
codes.uses
attribute represents the remaining number of times the codes can be used for the promotion. - Codes created before April 27, 2023 will only have
codes.uses
attribute in the response body.
Request
Path Parameters
The unique identifier of the promotion.
Header Parameters
The Bearer token required to get access to the API.
Responses
- 200
- 401
Response Headers
- application/json
- Schema
- Example (from schema)
Schema
- Array [
- Array [
- ]
- ]
data object[]
data object
codes object[]
Specifies the name of the code.
Specifies whether the code is applied to a line item or cart. The options are per_item
or per_cart
. The default setting is per_cart
, which is applied at cart level. The per_item
setting specifies how many times a buyer can use a promotion code on promotion items in a cart. For example, in a store that offers 50% off on SKU1, but limits the maximum usage of the promotion code to two, buyer can apply the promotion to SKU1 up to 2 times if cart has two quantities of SKU1. The third SKU1 is sold for regular price. The code usage is applied at checkout. You must set the automatic setting to false and create a code for this promotion to work.
Specifies the users who can use the code. You can use the customer object ID or an array of customer object IDs. For more information, see the Create a customer section. Additionally, you could pass any identifying string to the promotions service that identifies a user.
Specifies the maximum number of times the code can be used. If no value is set, the shopper can use the code any number of times.
Specifies by whom it was created.
meta object
timestamps object
Specifies the date the code was created.
links object
Always the current page.
Always the first page.
If there is only one page, it returns null
.
If there is only one page, it returns null
.
If the user is on the first page, it returns null
.
meta object
page object
The current page.
The maximum number of records per page for this response. You can set this value up to 100.
The current offset by number of records, not pages. Offset is zero-based.
The total page count.
results object
The total number of results.
{
"data": [
{
"data": {
"codes": [
{
"code": "string",
"consume_unit": "string",
"user": "string",
"uses": 0,
"created_by": "string",
"meta": {
"timestamps": {
"created_at": "2023-11-07T23:04:18.845Z"
}
}
}
]
}
}
],
"links": {
"current": "string",
"first": "string",
"last": "string",
"next": "string",
"prev": "string"
},
"meta": {
"page": {
"current": 0,
"limit": 0,
"offset": 0,
"total": 0
},
"results": {
"total": 0
}
}
}
Unauthorized
- application/json
- Schema
- Example (from schema)
- Example
Schema
[
null
]
{
"errors": {
"status": 401,
"title": "Unauthorized"
}
}