Requires read_discounts access scope.
An access token is required to call this API. Refer to Authorization for more information about how to obtain the token.
Get the store's discount code activities.
Arguments
after ● String
Returns elements following the specified cursor. The first argument must also be specified when using this argument.
before ● String
Returns elements preceding the specified cursor. The last argument must also be specified when using this argument.
first ● Int
Returns the first n elements in the list.
last ● Int
Returns the last n elements in the list.
reverse ● Boolean
Whether to reverse the order of the list.
● true: reverse
● false: do not reverse
Default value: false
query ● String
Specify one or more query filters. Supported filters and their valid values are as follows:
  • discount_type: The discount benefit type. Valid values are:
    • bogo: Buy X, get Y free.
    • fix_amount: Amount discount.
    • percentage: Percentage discount.
    • free_shipping: Free shipping.
  • status: The activity status. Valid values are:
    • active: The activity is live and ongoing.
    • expired: The activity has expired.
    • scheduled: The activity has not started yet.
  • times_used: The usage count or the usage count range of the discount.
    For example, times_used:>0 means filtering discounts that have been used at least once.
  • starts_at: The date and time when the activity starts, or a time scope during which the activity starts.
    For example, starts_at:>='2023-01-10T00:00:00Z' means filtering activities that started after 2023-01-10T00:00:00Z.
  • title: The name of the activity, where any keyword passed in must be enclosed in ''.
    Filtering by title applies fuzzy matching.
  • code: The discount code, where any keyword passed in must be enclosed in ''.
    Filtering by discount code applies exact matching.
  • sales_channel: The sales channel. Valid values are:
    • web: Online sales channel.
    • pos: POS channel.
    • all: All sales channels.
  • source_key: Specifies the creation source of the discount.
sortKey ● CodeDiscountSortKeys
The key for sorting the filtered discount code activities. For example, STARTS_AT means sorting by the start time, and TIMES_USED means sorting by the usage count.
More
Return
edges ● [DiscountCodeNodeEdge!]non-null
A list of edges.
More
nodes ● [DiscountCodeNode]
Information to aid in pagination.
More
pageInfo ● PageInfo!non-null
A list of the nodes contained in DiscountCodeNodeEdge.
More
Status and error codes
For detailed information about common codes, see Status and error codes.
Example
Get discount code activities by title
query MyQuery {
codeDiscountNodes(
first: 10
query: "title:'demo'"
sortKey: CREATED_AT
reverse: true
) {
pageInfo {
endCursor
hasNextPage
hasPreviousPage
startCursor
}
edges {
cursor
node {
codeDiscount {
... on DiscountCodeBasic {
summary
shareableUrls {
targetType
title
url
}
asyncUsageCount
codeCount
codes
appliesTimesPerCustomer
createdAt
combinesWith {
orderDiscounts
productDiscounts
shippingDiscounts
}
customerGets {
items {
... on AllDiscountItems {
__typename
allItems
}
... on DiscountCollections {
__typename
collections
}
... on DiscountProducts {
__typename
productVariants
products
}
}
value {
... on DiscountAmount {
appliesOnEachItem
amount {
amount
currencyCode
}
}
... on DiscountPercentage {
__typename
percentage
}
... on DiscountOnQuantity {
__typename
effect {
... on DiscountAmount {
appliesOnEachItem
amount {
amount
currencyCode
}
}
... on DiscountPercentage {
__typename
percentage
}
}
quantity {
quantity
}
}
}
}
customerSelection {
... on DiscountCustomerAll {
allCustomers
}
... on DiscountCustomerSegments {
__typename
segments
}
... on DiscountCustomers {
__typename
customers
}
}
discountClass
endsAt
minimumRequirement {
... on DiscountMinimumQuantity {
__typename
greaterThanOrEqualToQuantity
}
... on DiscountMinimumSubtotal {
__typename
greaterThanOrEqualToSubtotal {
amount
currencyCode
}
}
}
shareableUrls {
targetType
title
url
}
shortSummary
startsAt
status
title
updatedAt
totalSales {
amount
currencyCode
}
usageLimit
}
... on DiscountCodeBxgy {
summary
asyncUsageCount
appliesTimesPerCustomer
codeCount
combinesWith {
orderDiscounts
productDiscounts
shippingDiscounts
}
createdAt
customerBuys {
items {
... on AllDiscountItems {
__typename
allItems
}
... on DiscountCollections {
__typename
collections
}
... on DiscountProducts {
__typename
productVariants
products
}
}
value {
... on DiscountQuantity {
__typename
quantity
}
... on DiscountPurchaseAmount {
amount
}
}
}
customerGets {
items {
... on AllDiscountItems {
__typename
allItems
}
... on DiscountCollections {
__typename
collections
}
... on DiscountProducts {
__typename
productVariants
products
}
}
value {
... on DiscountAmount {
appliesOnEachItem
amount {
amount
currencyCode
}
}
... on DiscountPercentage {
__typename
percentage
}
... on DiscountOnQuantity {
__typename
effect {
... on DiscountAmount {
appliesOnEachItem
amount {
amount
currencyCode
}
}
... on DiscountPercentage {
__typename
percentage
}
}
quantity {
quantity
}
}
}
}
customerSelection {
... on DiscountCustomerAll {
allCustomers
}
... on DiscountCustomerSegments {
__typename
segments
}
... on DiscountCustomers {
__typename
customers
}
}
discountClass
endsAt
shareableUrls {
targetType
title
url
}
startsAt
status
title
totalSales {
amount
currencyCode
}
usageLimit
usesPerOrderLimit
}
... on DiscountCodeFreeShipping {
summary
asyncUsageCount
appliesTimesPerCustomer
codeCount
combinesWith {
orderDiscounts
productDiscounts
shippingDiscounts
}
createdAt
customerSelection {
... on DiscountCustomerAll {
allCustomers
}
... on DiscountCustomerSegments {
__typename
segments
}
... on DiscountCustomers {
__typename
customers
}
}
destinationSelection {
... on DiscountCountries {
includeRestOfWorld
countries
}
... on DiscountCountryAll {
allCountries
}
}
discountClass
endsAt
maximumShippingPrice {
amount
currencyCode
}
minimumRequirement {
... on DiscountMinimumQuantity {
__typename
greaterThanOrEqualToQuantity
}
... on DiscountMinimumSubtotal {
__typename
greaterThanOrEqualToSubtotal {
amount
currencyCode
}
}
}
shareableUrls {
targetType
title
url
}
shortSummary
startsAt
status
title
updatedAt
usageLimit
totalSales {
amount
currencyCode
}
}
}
id
}
}
nodes {
codeDiscount {
... on DiscountCodeBasic {
summary
shareableUrls {
targetType
title
url
}
asyncUsageCount
codeCount
createdAt
endsAt
shortSummary
startsAt
status
title
codes
updatedAt
usageLimit
appliesTimesPerCustomer
combinesWith {
orderDiscounts
productDiscounts
shippingDiscounts
}
customerGets {
items {
... on AllDiscountItems {
__typename
allItems
}
... on DiscountCollections {
__typename
collections
}
... on DiscountProducts {
__typename
productVariants
products
}
}
value {
... on DiscountAmount {
appliesOnEachItem
amount {
amount
currencyCode
}
}
... on DiscountPercentage {
__typename
percentage
}
... on DiscountOnQuantity {
__typename
effect {
... on DiscountAmount {
appliesOnEachItem
amount {
amount
currencyCode
}
}
... on DiscountPercentage {
__typename
percentage
}
}
quantity {
quantity
}
}
}
}
customerSelection {
... on DiscountCustomerAll {
allCustomers
}
... on DiscountCustomerSegments {
__typename
segments
}
... on DiscountCustomers {
__typename
customers
}
}
discountClass
minimumRequirement {
... on DiscountMinimumQuantity {
__typename
greaterThanOrEqualToQuantity
}
... on DiscountMinimumSubtotal {
__typename
greaterThanOrEqualToSubtotal {
amount
currencyCode
}
}
}

totalSales {
amount
currencyCode
}
}
... on DiscountCodeBxgy {
summary
asyncUsageCount
title
appliesTimesPerCustomer
combinesWith {
orderDiscounts
productDiscounts
shippingDiscounts
}
codeCount
createdAt
customerBuys {
items {
... on AllDiscountItems {
__typename
allItems
}
... on DiscountCollections {
__typename
collections
}
... on DiscountProducts {
__typename
productVariants
products
}
}
value {
... on DiscountQuantity {
__typename
quantity
}
... on DiscountPurchaseAmount {
amount
}
}
}
customerGets {
items {
... on AllDiscountItems {
__typename
allItems
}
... on DiscountCollections {
__typename
collections
}
... on DiscountProducts {
__typename
productVariants
products
}
}
value {
... on DiscountAmount {
appliesOnEachItem
amount {
amount
currencyCode
}
}
... on DiscountPercentage {
__typename
percentage
}
... on DiscountOnQuantity {
__typename
effect {
... on DiscountAmount {
appliesOnEachItem
amount {
amount
currencyCode
}
}
... on DiscountPercentage {
__typename
percentage
}
}
quantity {
quantity
}
}
}
}
customerSelection {
... on DiscountCustomerAll {
allCustomers
}
... on DiscountCustomerSegments {
__typename
segments
}
... on DiscountCustomers {
__typename
customers
}
}
discountClass
endsAt
shareableUrls {
targetType
title
url
}
startsAt
status
totalSales {
amount
currencyCode
}
usageLimit
usesPerOrderLimit
}
... on DiscountCodeFreeShipping {
summary
asyncUsageCount
appliesTimesPerCustomer
codeCount
combinesWith {
orderDiscounts
productDiscounts
shippingDiscounts
}
createdAt
customerSelection {
... on DiscountCustomerAll {
allCustomers
}
... on DiscountCustomerSegments {
__typename
segments
}
... on DiscountCustomers {
__typename
customers
}
}
destinationSelection {
... on DiscountCountries {
includeRestOfWorld
countries
}
... on DiscountCountryAll {
allCountries
}
}
discountClass
endsAt
maximumShippingPrice {
amount
currencyCode
}
minimumRequirement {
... on DiscountMinimumQuantity {
__typename
greaterThanOrEqualToQuantity
}
... on DiscountMinimumSubtotal {
__typename
greaterThanOrEqualToSubtotal {
amount
currencyCode
}
}
}
shareableUrls {
targetType
title
url
}
shortSummary
startsAt
status
title
totalSales {
amount
currencyCode
}
updatedAt
usageLimit
}
}
id
}
}
}
Response
{
"data": {
"codeDiscountNodes": {
"pageInfo": {
"startCursor": "2AAF90F13C58A5EF353DD555E8D6CCD6",
"endCursor": "C61FAE0199C84A33DB551A7831B8E034",
"hasNextPage": false,
"hasPreviousPage": false
},
"edges": [
{
"cursor": "-",
"node": {
"codeDiscount": {
"combinesWith": {
"orderDiscounts": false,
"productDiscounts": false,
"shippingDiscounts": false
},
"shareableUrls": [
{
"targetType": "HOME",
"title": "demo",
"url": "https://ella01pre.myshoplinestg.com/activity/SL201SAS07614802632470692879"
}
],
"status": "ACTIVE",
"endsAt": "2026-07-18T08:41:54.000Z",
"totalSales": {
"amount": "0",
"currencyCode": "SGD"
},
"updatedAt": "2026-07-16T12:41:55.000Z",
"customerSelection": {
"__typename": "DiscountCustomers",
"customers": [
"4208821948"
]
},
"discountClass": "PRODUCT",
"minimumRequirement": {
"__typename": "DiscountMinimumSubtotal",
"greaterThanOrEqualToSubtotal": {
"amount": "100.56",
"currencyCode": "SGD"
}
},
"shortSummary": "22.32 off 6 products",
"startsAt": "2025-12-30T08:41:54.000Z",
"asyncUsageCount": 0,
"codeCount": 1,
"createdAt": "2026-07-16T12:41:54.000Z",
"customerGets": {
"items": {
"__typename": "DiscountProducts",
"productVariants": [],
"products": [
"16064393365790313753160195",
"16064393365833431198690195",
"16064393365879904087440195",
"16064393365916813963040195",
"16064393365975701991600195",
"16064393366023181513580195"
]
},
"value": {
"amount": {
"currencyCode": "SGD",
"amount": "22.32"
},
"appliesOnEachItem": true
}
},
"summary": "22.32 off 6 products • Minimum purchase of 100.56 • Applies to each eligible item per order",
"title": "demo",
"usageLimit": -1,
"appliesTimesPerCustomer": -1,
"codes": [
"995639"
]
},
"id": "gid://shopline/DiscountCodeNode/SL201SAS07614802632470692879"
}
}
],
"nodes": [
{
"codeDiscount": {
"appliesTimesPerCustomer": -1,
"minimumRequirement": {
"__typename": "DiscountMinimumSubtotal",
"greaterThanOrEqualToSubtotal": {
"amount": "100.56",
"currencyCode": "SGD"
}
},
"shortSummary": "22.32 off 6 products",
"totalSales": {
"amount": "0",
"currencyCode": "SGD"
},
"customerGets": {
"items": {
"__typename": "DiscountProducts",
"productVariants": [],
"products": [
"16064393365790313753160195",
"16064393365833431198690195",
"16064393365879904087440195",
"16064393365916813963040195",
"16064393365975701991600195",
"16064393366023181513580195"
]
},
"value": {
"amount": {
"amount": "22.32",
"currencyCode": "SGD"
},
"appliesOnEachItem": true
}
},
"discountClass": "PRODUCT",
"summary": "22.32 off 6 products • Minimum purchase of 100.56 • Applies to each eligible item per order",
"title": "demo",
"asyncUsageCount": 0,
"codeCount": 1,
"endsAt": "2026-07-18T08:41:54.000Z",
"startsAt": "2025-12-30T08:41:54.000Z",
"status": "ACTIVE",
"updatedAt": "2026-07-16T12:41:55.000Z",
"codes": [
"995639"
],
"combinesWith": {
"orderDiscounts": false,
"productDiscounts": false,
"shippingDiscounts": false
},
"createdAt": "2026-07-16T12:41:54.000Z",
"customerSelection": {
"__typename": "DiscountCustomers",
"customers": [
"4208821948"
]
},
"shareableUrls": [
{
"targetType": "HOME",
"title": "demo",
"url": "https://ella01pre.myshoplinestg.com/activity/SL201SAS07614802632470692879"
}
],
"usageLimit": -1
},
"id": "gid://shopline/DiscountCodeNode/SL201SAS07614802632470692879"
}
]
}
},
"extensions": {
"cost": {
"actualQueryCost": 131,
"requestedQueryCost": 131,
"throttleStatus": {
"currentlyAvailable": 49869,
"maximumAvailable": 50000,
"restoreRate": 50000
}
}
}
}
Was this article helpful to you?