Why am I getting an Invalid API key error when creating a discount code on Postman?

Topic summary

Issue: Creating a discount code via Shopify’s Admin API endpoint discount_codes.json (under a price rule) in Postman returns “[API] Invalid API key or access token (unrecognized login or wrong password).”

Context & Attempts:

  • User tries to create a discount code using the discount_codes.json endpoint for a specific price_rule (API version 2021-10).
  • When using Private App keys with Basic Authorization [email removed] URL), the invalid API key error stops, but Shopify then prompts to authorize the app (Postman), blocking the operation.
  • Other endpoints/webhooks do not show this problem; it occurs specifically on discount_codes.json.
  • Sample requests provided include both the standard endpoint and the Basic Auth URL format; a screenshot link is included but not essential to understand the issue.

Open Questions:

  • What is the correct authentication/authorization flow required for discount_codes.json?
  • Why does this endpoint trigger an app authorization prompt in Postman when Private App keys are used?

Status: Unresolved; user seeking guidance on proper auth for this endpoint.

Summarized with AI on February 27. AI used: gpt-5.

I’ve been using the Webhook for Discount Code to create one but I keep getting the "

[API] Invalid API key or access token (unrecognized login or wrong password)" error, I tried to use the Private App keys as my Basic Authorization and the Invalid API key or access token doesn’t occur but the issue I’m facing now is asking me to authorize the app I’m using ( which is postman ). I tried other webhooks but this doesn’t occur but on discount_codes.json

Below is the sample HTTP request I sent on postman:
https://.myshopify.com/admin/api/2021-10/price_rules//discount_codes.json - https://prnt.sc/1y58uep
https://:@.myshopify.com/admin/api/2021-10/price_rules//discount_codes.json