A developer is experiencing issues creating discount codes via Shopify’s API. POST requests to the discount codes endpoint return HTTP 200 but fail to create any codes.
Authentication: X-Shopify-Access-Token header included
Request body follows documented format with discount code object
Using a custom private app created in shop settings
Troubleshooting Attempts:
Manually created price rule and attempted to add codes via API
Tried creating price rule via API with same results
GET requests to same endpoint return 400 errors
Current Status:
A support representative (SBD) is investigating by requesting multiple request IDs from failed attempts. The developer has provided several request IDs for log analysis. Discussion remains open with the developer following up on whether any findings have been identified. Note: Some text appears reversed/encoded in the original posts.
Summarized with AI on November 14.
AI used: claude-sonnet-4-5-20250929.
I want to use the API to create custom discount codes. When sending a POST request to “/admin/api/2023-10/price_rules/1660066169167/discount_codes.json” it always returns a 200 and creates nothing. In request header I send the “X-Shopify-Access-Token” Parameter and my body looks like the following:
I created the price rule simply with creating a discount code manually and deactivating it. I tried this because creating a price rule via API has the same result. Even when trying the example code, nothing happens.
I am using a custom private app which I created directly in my shop settings.
What am I doing wrong? Any help would be really appreciated.
Hey @SBD , thanks for the reply. I am pretty sure that it was the POST request. Here is another request ID: 8bf84edb-74ea-4d34-9336-2cc6f937acb4. A GET request to the same URL results in an Error 400.