discount codes API issue

New Member
1 0 0

We are using Shopify API to get a list of price_rules and discounts_codes into our local database

The sync works well and we are able to get most of the data except some missing discount codes.

API calls reruns 404 error "Not found"  for all discount codes where "Customer spends" option set to   "Minimum purchase amount"

API calls we use:

GET /admin/api/2020-07/price_rules/{price_rule_id}/discount_codes.json
GET /admin/api/2020-07/discount_codes/lookup.json?code=
GET /admin/api/2020-07/price_rules/{price_rule_id}.json

If "Minimum quantity or items" option selected - all works.

if "Minimum purchase amount" - API returns 404 error.

See an example bellow: Discount code BFPJN7TTZ42 (where "Customer spends" set originally to  "Minimum purchase amount")


If I change  "Customer spends" option to "Minimum quantity or items" :


I checked a few more discount codes we are missing from the sync and all of them "Customer spends" set to "Minimum purchase amount".


This looks like a bug.

Shopify Staff
Shopify Staff
834 98 188

Hey @sil2,

This is actually expected. When buy X get Y discounts were launched, the functionality was only implemented on the GraphQL endpoints. 

However, we've since implemented the REST functionality on the unstable version, and will be adding it to a numbered version soon. In the meantime, you can get this data call the unstable version using REST.

GET /admin/api/unstable/discount_codes/lookup.json?code=

JB | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit or the Shopify Web Design and Development Blog